]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: Actually remove device in chDomainDetachDeviceLive()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Sep 2025 15:10:36 +0000 (17:10 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Sep 2025 09:44:24 +0000 (11:44 +0200)
Inside of chDomainDetachDeviceLive() there are two variables that
are important in this case: 'match' and 'detach'. The first one
contains device definition as parsed from user provided XML, the
other contains pointer to the device definition inside
virDomainDef (as returned by chDomainFindDisk()).

Now, when chDomainRemoveDevice() is called, it looks up the
device inside virDomainDef and removes it (using pointer
comparison). Well, that means 'detach' must be passed as an
argument instead of 'match'.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/ch/ch_hotplug.c

index 058954035d5420f3af851e441f880f9a3f4c88e6..b06fdbe5a8de3520d42a5953940c22fd02497765 100644 (file)
@@ -336,7 +336,7 @@ chDomainDetachDeviceLive(virDomainObj *vm,
         return -1;
     }
 
-    if (chDomainRemoveDevice(vm, match) < 0)
+    if (chDomainRemoveDevice(vm, &detach) < 0)
         return -1;
 
     if (match->type == VIR_DOMAIN_DEVICE_DISK) {