From 3bd17ffe972af03924fda476e2ebfe89f53a8f4f Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Tue, 9 Sep 2025 17:10:36 +0200 Subject: [PATCH] ch: Actually remove device in chDomainDetachDeviceLive() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- 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.47.3