Repository navigation
Conversation
detachVolume looked up the disk in the domain XML by comparing the path string of the volume with the source of the disks. If the domain references the same device through a different path nothing was found, no detach-device was sent, but the detach was still answered as successful. The volume was then marked as detached while it stayed attached to the running instance and could be attached to a second one. This happens for Linstor volumes of instances started before apache#12300: their domain XML still has /dev/drbdX while the plugin now returns /dev/drbd/by-res/<resource>/0. If no disk matches the path as is, compare the files the paths resolve to. Fixes: apache#14508
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14975 +/- ##
=========================================
Coverage 18.34% 18.35%
- Complexity 16679 16690 +11
=========================================
Files 5940 5940
Lines 537840 537860 +20
Branches 65940 65942 +2
=========================================
+ Hits 98668 98708 +40
+ Misses 427946 427926 -20
Partials 11226 11226
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:
|
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
This PR fixes
detachVolumeon KVM reporting success without detaching the disk, when the running instance references the volume through a different path than the one the storage plugin returns.On detach,
KVMStorageProcessor.attachOrDetachDisksearched the disk in the live domain XML by comparing the path string of the volume with the source of each disk. If nothing matched, it loggedand returned without sending
detach-device. The detach was answered as successful, so the volume was marked as detached in the database while it stayed attached to the running instance.This happens for Linstor volumes of instances started before #12300. Their domain XML still has
/dev/drbdX(live migration keeps it), while the plugin now returns/dev/drbd/by-res/<resource>/0, a symlink to the same device. Consequences, as described in #14508:Wrong medium typetarget 'vdb' duplicated for disk sources ...With this change the disk is searched with the new
findDiskDefByPath:Path.toRealPath()).The detach then uses the disk definition taken from the domain XML, so
detach-deviceand the check that the device is gone both use the path the domain knows.The second step only applies to absolute local paths that exist, so network disks (RBD, Gluster) are not affected. If no disk matches after resolving either, the behavior is unchanged.
Not part of this PR: the live resize notification in
resizevolume.shalso selects the disk by path (virsh domblklist ... | grep $path), so for such instances the guest only sees a new size after a restart.Fixes: #14508
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A
How Has This Been Tested?
Unit tests in
KVMStorageProcessorTest(all 42 tests of the class pass), with three new tests forfindDiskDefByPath:findDiskDefByPathTestReturnsDiskWithSamePath: a disk with the identical path is returned.findDiskDefByPathTestReturnsDiskAttachedWithTargetOfLink: the volume path is a symlink and the domain has the link target, as in the Linstor case; the right disk is returned.findDiskDefByPathTestReturnsNullWhenNoDiskUsesThePath: no disk is returned for another existing device, a path that does not exist, and a non-absolute (network) path.How did you try to break this feature and the system with this change?