Skip to content

Snapshot usage reported incorrectly when number of Daily Snapshot less than the snapshot.delta.max #9416

Closed

Description

@nxsbi
ISSUE TYPE
  • Bug Report
COMPONENT NAME
UI
CLOUDSTACK VERSION
4.19
CONFIGURATION

XCP_NG 8, Cloudstack 4.19

OS / ENVIRONMENT

NA

SUMMARY

When a user sets up recurring volume snapshot, if the number of snapshots to keep (example 3) is less than the snapshot.delta.max (example 7), it creates a chain of 7, but the cloud_usage table shows as if the first 4 snapshots were destroyed, while the physically continue to exist and take up secondary storage space. This is creating artifically low secondary storage usage and creates billing challenges as well as shows incorrect information to users.

NOTE - this used to work correctly in 4.17 (I upgraded from 4.17 to 4.19 recently - I skipped 4.18).

STEPS TO REPRODUCE
Set up global config snapshot.delta.max = 7.
Setup a Volume recurring snapshot with Keep = 3 (I only used the Daily option). 
Observe the cloud_usage table. On Fourth day, you will notice that there are 4 physical snapshots present in secondary storage due to chaining, but the usage for 4th day only shows as if 3 were in use. 
EXPECTED RESULTS
The entire snapshot chain should be shown in the cloud_usage for each date regardless of the number of snapshots to keep. 
ACTUAL RESULTS
Only the last 3 snapshots are shown as existing ones. 

Activity

  1. added this to the 4.19.2.0 milestone on Jul 19, 2024
  2. sureshanaparti commented on Jul 23, 2024

    @sureshanaparti
    Contributor

    It seems the snapshots in the chain are marked as destroyed, but not removed. These will be removed by the storage garbage collector. So, maybe these are not counted in usage. Some related some ref below.

    if (deleteSnapshotChain(snapshotInfo, storageToString)) {
    s_logger.debug(String.format("%s was deleted on %s. We will mark the snapshot as destroyed.", snapshotVo, storageToString));
    } else {
    s_logger.debug(String.format("%s was not deleted on %s; however, we will mark the snapshot as destroyed for future garbage collecting.", snapshotVo,
    storageToString));
    }

    while (snapshot != null && snapshotStatesAbleToDeleteSnapshot.contains(snapshot.getState())) {
    SnapshotInfo child = snapshot.getChild();
    if (child != null) {
    s_logger.debug(String.format("Snapshot [%s] has child [%s], not deleting it on the storage [%s]", snapshotTo, child.getTO(), storageToString));
    break;
    }

    @nxsbi Have you noticed any log like "we will mark the snapshot as destroyed for future garbage collecting"? Is the storage garbage cleanup enabled (setting: storage.cleanup.enabled)?

  3. nxsbi commented on Jul 23, 2024

    @nxsbi
    Author

    Hello, Yes the storage.cleanup.enabled = True

    You are correct in that the snapshot is marked as Destroyed, but snapshot_store_ref still shows it as Ready. But keep in mind that this is part of a chain, so it cannot be deleted until it reaches the snapshot.delta.max = 7 + Keep 3

    The "Destroyed" is set based on "Keep X snapshots" that is set by users. In the usage side of it, it does not list the Destroyed snapshot.

    What I am saying is that logical "Destroyed" makes sense from user perspective, but not from usage perspective. In Usage perspective, it should show all the chain vhd files as USAGE.

    Example below - Whats happening is that (in example below) on Jul 25, usage would only show 500 + 8 + 11 = 519 GB, where as in reality it is using (1096 GB ===500+25+33+10+9+11+8+500. What I am asking is that it should show the 1096 GB as used.
    It may be helpful to show on UI to the users that the snapshot is base or incremental.

    image

  4. DaanHoogland commented on Jul 25, 2024

    @DaanHoogland
    Contributor

    @nxsbi , are you proposing an extra status to signify usage-unusable vs usable?

    I am asking because at first sight a user would find it unfair they get charged for a snapshot they can not use. They might even argue that it is not their responcibility it is being kept around

  5. nxsbi commented on Jul 26, 2024

    @nxsbi
    Author

    I see your point @DaanHoogland
    2 things come to mind

    1. Yes, one column that is aligned to physical data store - does the file exist - Yes or No - and what is the physical size on disk - this columns needs to be added. Then the Second column that shows client recorvery available Yes/No (this is exactly what the current "status" column shows today).
    2. I would suggest that instead of showing the size of the physical size of the last chain vhd file, we shold show the total chain size. This way the client can see that on Day 1 its the physical size used, which grows until day 7, and when a full snapshot takes palce, it resets to new disk size. Reasoning = many of these snapshots can be of a few MB in size on daily basis while base disk is 500 GB. So if the 3 sizes are only 100 MB for last 3 snapshots, but as a provider we have to provide free 500GB storage for base snapshot, its not right for provider - and in reality is the total that is stored, So showing the total chain size is closest thing to reality for client as well.

    Note - I have had question from client as why sometimes the snapshot size on the UI shows as 0.1 GB when the disk is 500GB.

    I will be happy to do testing of any development that is done for this (althrough someone will need to provide me the install files of the release candidate)

  6. modified the milestones: 4.19.2, 4.19.3 on Feb 13, 2025
  7. modified the milestones: 4.19.3, 4.19.4 on Jun 5, 2025
  8. self-assigned this
    on Jul 16, 2025
  9. moved this from Todo to Dev In Progress in Apache CloudStack BugFest - Issueson Jul 17, 2025
  10. abh1sar commented on Jul 29, 2025

    @abh1sar
    Contributor

    @nxsbi After talking to a few folks, approach 2 suggested by you is making a lot of sense.

    We should be showing chain size along with physical size for incremental snapshots.
    So if we have an incremental snapshot size 100MB and the full parent snapshot of size 1GB, and the parent snapshot is deleted, the users should see the physical size of the incremental snapshot as 100MB and the chain size as 1.1GB.

    This way the user is aware that the snapshot is actually not taking only 100MB of disk space.
    I have raised a PR #11313 for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions