-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[WIP] Remove allocated snapshots / vm snapshots on start #8452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.19
Are you sure you want to change the base?
[WIP] Remove allocated snapshots / vm snapshots on start #8452
Conversation
@blueorangutan package |
@sureshanaparti a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.19 #8452 +/- ##
============================================
- Coverage 30.85% 22.99% -7.86%
+ Complexity 34048 23743 -10305
============================================
Files 5341 5209 -132
Lines 374861 352833 -22028
Branches 54518 50531 -3987
============================================
- Hits 115659 81140 -34519
- Misses 243973 260029 +16056
+ Partials 15229 11664 -3565
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@sureshanaparti |
Packaging result [SF]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 8207 |
@weizhouapache issue is some active snapshots / vm snapshots are left in allocated when MS is stopped, no point in keeping them and wait until storage garbage collector cleans up (what if storage cleanup is disabled?) as these are listed / shown in UI as well (which are not allowed to delete). So, I think, it's better remove them on start itself. Any other thoughts / suggestions? |
@sureshanaparti
We could add the cleanup of Allocated snapshot and Allocated/Error vm snapshots in the process IMHO, it is not the right place to cleanup during mgmt server start, as mgmt server might be running for several days. |
@weizhouapache Agreed for the resources in error state (as there might be things to reset / cleanup) and MS is running. snapshot / vm snapshots are in Allocated, mostly for the very recent active snapshot / vm snapshots before MS is stopped, so no need for any cleanup, better to set them as removed (Any event through state transition would still keep it in Allocated). Otherwise, at least have to not list them on UI, or allow explicit deletion from the UI. Snapshots in destroying state are deleted here. So, I thought, it's better to remove there on MS start. cloudstack/server/src/main/java/com/cloud/storage/snapshot/SnapshotManagerImpl.java Lines 1519 to 1523 in 3f9dd4d
|
@sureshanaparti (OK with cleaning up resource in both start process and garbage collector) |
ok, will check & update. thanks @weizhouapache |
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
@sureshanaparti , does this need rebasing? |
on another note, is it maybe safe to first mark it as State == Error and then delete? (I think this is the same @weizhouapache suggests) |
@sureshanaparti , any progress on this? |
@blueorangutan package |
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 12329 |
@sureshanaparti are you working on this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sureshanaparti what is the status for this? Do we need more changes or it needs testing?
//remove snapshots in allocated state | ||
List<SnapshotVO> allocatedSnapshots = _snapshotDao.listAllByStatus(Snapshot.State.Allocated); | ||
for (SnapshotVO snapshot : allocatedSnapshots) { | ||
_snapshotDao.remove(snapshot.getId()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be a single call to DB - removeAllByStatus
?
//Remove VM Snapshots in allocated state | ||
List<VMSnapshotVO> allocatedVMSnapshots = _vmSnapshotDao.listAllByStatus(VMSnapshot.State.Allocated); | ||
for (VMSnapshotVO vmSnapshot : allocatedVMSnapshots) { | ||
_vmSnapshotDao.remove(vmSnapshot.getId()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be a single call to DB - removeAllByStatus
?
Description
Some latest active snapshots / vm snapshots are stuck in allocated state when MS is stopped, these are listed / shown in UI as well (not allowed to delete). Remove them on MS start itself.
This PR removes allocated snapshots / vm snapshots on start.
Fixes #8424
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Manually tested: Take VM Snapshot -> Stop MS -> Start MS
VM Snapshot record after MS stopped =>
VM Snapshot record after MS started (Not listed / shown in the UI) =>
How did you try to break this feature and the system with this change?