From: Michal Privoznik Date: Tue, 9 Sep 2025 15:10:36 +0000 (+0200) Subject: ch: Actually remove device in chDomainDetachDeviceLive() X-Git-Tag: v11.8.0-rc1~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bd17ffe972af03924fda476e2ebfe89f53a8f4f;p=thirdparty%2Flibvirt.git ch: Actually remove device in chDomainDetachDeviceLive() 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 Reviewed-by: Ján Tomko --- 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) {