[PATCH 1/4] ch: Actually remove device in chDomainDetachDeviceLive()

Michal Privoznik via Devel posted 4 patches 3 weeks, 3 days ago
[PATCH 1/4] ch: Actually remove device in chDomainDetachDeviceLive()
Posted by Michal Privoznik via Devel 3 weeks, 3 days ago
From: Michal Privoznik <mprivozn@redhat.com>

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>
---
 src/ch/ch_hotplug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ch/ch_hotplug.c b/src/ch/ch_hotplug.c
index 058954035d..b06fdbe5a8 100644
--- a/src/ch/ch_hotplug.c
+++ b/src/ch/ch_hotplug.c
@@ -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) {
-- 
2.49.1