Repository navigation
kvm: fix delete of failed Instance Snapshot on stopped VM with RBD storage - #14456
Open
weizhouapache wants to merge 1 commit into
Open
weizhouapache wants to merge 1 commit into
weizhouapache wants to merge 1 commit into
Conversation
…orage StorageVMSnapshotStrategy.canHandle() required either State.Allocated or a persisted vm_snapshot_details/STORAGE_SNAPSHOT row before it would claim a VM snapshot. A snapshot that fails before any underlying disk snapshot is taken (e.g. VM freeze fails because the QEMU guest agent is not connected) transitions to State.Error without ever persisting such a row, so canHandle() returned CANT_HANDLE and deletion fell back to DefaultVMSnapshotStrategy. That strategy sends a DeleteVMSnapshotCommand to the KVM agent, which requires a live libvirt domain - failing with 'Domain not found' once the VM is stopped, and blocking both snapshot deletion and VM destruction. Let StorageVMSnapshotStrategy also claim ownership of snapshots in State.Error even when no disk-snapshot details were persisted: there is nothing on the hypervisor to clean up in that case, and deleteVMSnapshot()/deleteDiskSnapshot() are already safe no-ops when the details list is empty - no libvirt domain is required. Fixes apache#13972
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14456 +/- ##
=========================================
Coverage 18.06% 18.07%
- Complexity 16356 16362 +6
=========================================
Files 5937 5937
Lines 537015 537015
Branches 65830 65830
=========================================
+ Hits 97026 97059 +33
+ Misses 428913 428869 -44
- Partials 11076 11087 +11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Member
Author
|
Manual test of this change on KVM with Ceph RBD primary storage (4.23.0 build with this commit, deployed on both management servers): Setup
Steps and results
Unit tests
Not tested
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
StorageVMSnapshotStrategy.canHandle() required either State.Allocated or a persisted vm_snapshot_details/STORAGE_SNAPSHOT row before it would claim a VM snapshot. A snapshot that fails before any underlying disk snapshot is taken (e.g. VM freeze fails because the QEMU guest agent is not connected) transitions to State.Error without ever persisting such a row, so canHandle() returned CANT_HANDLE and deletion fell back to DefaultVMSnapshotStrategy. That strategy sends a DeleteVMSnapshotCommand to the KVM agent, which requires a live libvirt domain - failing with 'Domain not found' once the VM is stopped, and blocking both snapshot deletion and VM destruction.
Let StorageVMSnapshotStrategy also claim ownership of snapshots in State.Error even when no disk-snapshot details were persisted: there is nothing on the hypervisor to clean up in that case, and deleteVMSnapshot()/deleteDiskSnapshot() are already safe no-ops when the details list is empty - no libvirt domain is required.
Fixes #13972
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?