Skip to content

server: mark volume snapshots as Destroyed if it does not exist on primary and secondary storage when delete a volume - #6057

Merged
nvazquez merged 2 commits into
apache:4.16from
weizhouapache:4.16-mark-volume-snapshots-as-destroyed
Mar 10, 2022
Merged

nvazquez merged 2 commits into
apache:4.16from
weizhouapache:4.16-mark-volume-snapshots-as-destroyed

Conversation

@weizhouapache

Copy link
Copy Markdown
Member

when delete a volume in QCOW2 format, if volume snapshot does not exist on primary and secondary storage, mark the snapshot as Destroyed.

This fixes #5433

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

…a volume in QCOW2 format

when delete a volume in QCOW2 format, if volume snapshot does not exist on primary and secondary storage, mark the snapshot as Destroyed.
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan package

@weizhouapache weizhouapache changed the title server: mark volume snapshots as Destroyed in some cases when a volume in QCOW2 format server: mark volume snapshots as Destroyed in some cases when delete a volume in QCOW2 format Mar 4, 2022
@nvazquez

nvazquez commented Mar 4, 2022 •

Copy link
Copy Markdown
Contributor

@blueorangutan package

@nvazquez nvazquez added this to the 4.17.0.0 milestone Mar 4, 2022
@blueorangutan

Copy link
Copy Markdown

@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2765

@nvazquez

nvazquez commented Mar 4, 2022

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3498)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 32258 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6057-t3498-kvm-centos7.zip
Smoke tests completed. 91 look OK, 1 have errors
Only failed tests results shown below:

Test Result Time (s) Test File
test_03_ssvm_internals Failure 14.28 test_ssvm.py

@nvazquez

nvazquez commented Mar 5, 2022

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@nvazquez a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3504)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 31741 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6057-t3504-kvm-centos7.zip
Smoke tests completed. 92 look OK, 0 have errors
Only failed tests results shown below:

Test Result Time (s) Test File

@nvazquez nvazquez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nvazquez
nvazquez requested a review from slavkap March 7, 2022 10:41
}

private void markVolumeSnapshotsAsDestroyed(VolumeVO volume) {
if (!Storage.ImageFormat.QCOW2.equals(volume.getFormat())) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have a VM with Ceph's volumes, for example, and snapshot.backup.to.secondary is disabled when you expunge the VM, all snapshots remain active in UI, but there are no records in the snapshot_store_ref table.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavkap
I was not quite sure if the snapshots still work and removing this check will not lead to other unexpected issues.
If we can make sure it is not a problem to mark volume snapshot as destroyed if snapshot does not exist in primary and secondary storage, we can remove this check.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's better to remove this check because if we don't have snapshots on primary and secondary storage, the snapshot has to be marked as destroyed. I will test it

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavkap
good.
I have removed this check, and fixed the issue in vm expunge/destroy.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @weizhouapache. I will test it and let you know

@nvazquez

nvazquez commented Mar 8, 2022

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@nvazquez a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔️ el7 ✔️ el8 ✔️ debian ✔️ suse15. SL-JID 2795

@weizhouapache weizhouapache changed the title server: mark volume snapshots as Destroyed in some cases when delete a volume in QCOW2 format server: mark volume snapshots as Destroyed if it does not exist on primary and secondary storage when delete a volume Mar 8, 2022
@weizhouapache

Copy link
Copy Markdown
Member Author

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-3530)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 28307 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6057-t3530-kvm-centos7.zip
Intermittent failure detected: /marvin/tests/smoke/test_internal_lb.py

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@@ -468,6 +471,7 @@ public Void deleteVolumeCallback(AsyncCallbackDispatcher<VolumeServiceImpl, Comm
_snapshotStoreDao.remove(snapStoreVo.getId());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @weizhouapache, isn't it better to keep the info in the DB for the snapshots and update the State as Destroyed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavkap
is there any benifit ?
the records will be cleaned up by storage garbage collector.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavkap
thanks for testing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weizhouapache, to keep it as history, nothing more

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@slavkap ah ok, thanks for reply.
the records will be finally cleaned up by storage garbage collector (by default run once every day). They will be kept for only 1 day.
The behaviour is not changed by this PR. It was introduced by 336df84 and ccb68e1

@slavkap slavkap left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code LGTM - tested but left a comment

@nvazquez

Copy link
Copy Markdown
Contributor

Merging based on approvals and test results

@nvazquez
nvazquez merged commit 3a456f1 into apache:4.16 Mar 10, 2022
yadvr pushed a commit to shapeblue/cloudstack that referenced this pull request May 18, 2022
…imary and secondary storage when delete a volume (apache#6057)

* server: mark volume snapshots as Destroyed in some cases when delete a volume in QCOW2 format

when delete a volume in QCOW2 format, if volume snapshot does not exist on primary and secondary storage, mark the snapshot as Destroyed.

* Update apache#6057: remove check on volume format

(cherry picked from commit 3a456f1)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
@weizhouapache
weizhouapache deleted the 4.16-mark-volume-snapshots-as-destroyed branch December 9, 2022 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants