Skip to content

KVM problem with volume snapshots kept only on the primary storage (non-managed storages) #5433

Closed

Description

@slavkap
ISSUE TYPE
  • Bug Report
COMPONENT NAME
volume snapshots 
CLOUDSTACK VERSION
from 4.11.3.0 to main
SUMMARY

When snapshot.backup.to.secondary is set to false the snapshots are kept only on the primary storage. When you take more than one snapshot of a volume and delete this volume the snapshots are still active in the UI/DB but deleted from the storage. The problem with different primary storages is:

  • for the current NFS implementation is that the snapshots are internal, and they are deleted when you delete the volume - active in the UI/DB
  • for Ceph - the snapshots are deleted from the pool, but active in DB/UI
  • probably with the new Linstor driver the problem will be the same
  • for StorPool the snapshots are not deleted, but a random record is deleted from the snapshot_store_ref table and the reference to the snapshot's path is lost
  • with this PR - #5297 - the problem will be the same as the StorPool primary storage
STEPS TO REPRODUCE
- set `snapshot.backup.to.secondary` to `false`
- take a few snapshots of a volume
- delete the volume

The snapshots are visible in the UI, active in DB table `snapshots` and one of them is deleted in `snapshot_store_ref` DB table, because of this code in VolumeServiceImpl.deleteVolumeCallback:


                SnapshotDataStoreVO snapStoreVo = _snapshotStoreDao.findByVolume(vo.getId(), DataStoreRole.Primary);

                if (snapStoreVo != null) {
                    long storagePoolId = snapStoreVo.getDataStoreId();
                    StoragePoolVO storagePoolVO = storagePoolDao.findById(storagePoolId);

                    if (storagePoolVO.isManaged()) {
                        DataStore primaryDataStore = dataStoreMgr.getPrimaryDataStore(storagePoolId);
                        Map<String, String> mapCapabilities = primaryDataStore.getDriver().getCapabilities();

                        String value = mapCapabilities.get(DataStoreCapabilities.STORAGE_SYSTEM_SNAPSHOT.toString());
                        Boolean supportsStorageSystemSnapshots = new Boolean(value);

                        if (!supportsStorageSystemSnapshots) {
                            _snapshotStoreDao.remove(snapStoreVo.getId());
                        }
                    } else {
                        _snapshotStoreDao.remove(snapStoreVo.getId());
                    }
                }



EXPECTED RESULTS
Probably for all non-managed primary storages we should not delete the snapshots. For NFS this PR - #5297 will fix the problem with the internal snapshots. 

ACTUAL RESULTS
Snapshots are deleted from the storage, but active in the UI/DB as a garbage 

Activity

  1. added this to the 4.16.0.0 milestone on Sep 10, 2021
  2. slavkap commented on Sep 13, 2021

    @slavkap
    ContributorAuthor

    @rhtyd, I think there is a need to discuss how to proceed with this fix. Maybe @GabrielBrascher, @wido, and @rp- have to tell what has to be done with snapshots kept only on primary storage. Is it the right option to delete the snapshots when a volume is deleted?

  3. nvazquez commented on Sep 14, 2021

    @nvazquez
    Contributor

    Thanks @slavkap - looping @andrijapanicsb @sureshanaparti as well for feedback/discussion

  4. rp- commented on Sep 14, 2021

    @rp-
    Contributor

    For me(or Linstors POV) it make no sense (and doesn't work) to have snapshots without the volume.
    So deleting would be fine for me, also in Linstor you can't delete a volume as long as it has snapshots.

  5. yadvr commented on Sep 14, 2021

    @yadvr
    Member

    @slavkap thanks, I suggest that you start a discussion thread on dev@ ML as a lot of people don't check/read Github comments (I'm guilty of that too).

  6. slavkap commented on Sep 14, 2021

    @slavkap
    ContributorAuthor

    Thanks all! I'll open a discussion on the ML

  7. andrijapanicsb commented on Sep 14, 2021

    @andrijapanicsb
    Contributor

    I will just say, that this feature (to keep snaps on primary and NOT copy them on secondary) is developed for Ceph only, and doesn't work nor was tested to work on other storage solutions. Things needs to be properly implemented/from scratch for other storage types.

  8. slavkap commented on Sep 14, 2021

    @slavkap
    ContributorAuthor

    @andrijapanicsb, I agree with you, but this works for StorPool and will work with the PR that I've mentioned above. I think that the problem also affects the Linstor driver without the option for bypassing secondary storage and maybe Nexenta driver (but not sure how they handle the deletion of the volume after checking their code).

  9. slavkap commented on Sep 14, 2021

    @slavkap
    ContributorAuthor

    Also, I think this part of the code (which is partly wrong) is not in the right place. My opinion is that the drivers should care about what happens with snapshots, not CS.

  10. yadvr commented on Sep 21, 2021

    @yadvr
    Member

    Assigned to @GutoVeronezi who has submitted a PR on the same

  11. GutoVeronezi commented on Sep 22, 2021

    @GutoVeronezi
    Contributor

    @rhtyd @slavkap actually PR #5297 does not solve this issue, it refers only to issue #5124. Both regards to the same feature, however, in different contexts.

    (see #5297 (comment))

  12. removed their assignment
    on Sep 22, 2021
  13. modified the milestones: 4.16.0.0, 4.17.0.0 on Sep 28, 2021
  14. nvazquez commented on Sep 28, 2021

    @nvazquez
    Contributor

    Moved to the 4.17 milestone since we are close to the RC cut date and the PR still needs lot of effort on testing as the changes may introduce potential regressions if not tested properly

  15. nvazquez commented on Feb 4, 2022

    @nvazquez
    Contributor

    Hi @slavkap @GutoVeronezi - I see there has been recent activity on PR #5297 mentioned in this issue, does it solve this issue?

  16. slavkap commented on Feb 4, 2022

    @slavkap
    ContributorAuthor

    @nvazquez, I think PR #5297 doesn't fix the issue, but better @GutoVeronezi to answer

  17. GutoVeronezi commented on Feb 4, 2022

    @GutoVeronezi
    Contributor

    Hi, @nvazquez, PR #5297 does not solve this issue, it refers only to issue #5124. Both regards to the same feature, however, in different contexts (see #5297 (comment)).

  18. self-assigned this
    on Mar 3, 2022
  19. moved this to Ready For Review in Apache CloudStack 4.17.0on Mar 7, 2022
  20. nvazquez commented on Mar 10, 2022

    @nvazquez
    Contributor

    Fixed on #6057

  21. Repository owner moved this from Ready For Review to Done in Apache CloudStack 4.17.0on Mar 10, 2022
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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions