]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: Drop deadcode from chDomainDetachDeviceLive()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Sep 2025 14:01:18 +0000 (16:01 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Sep 2025 09:44:51 +0000 (11:44 +0200)
At the end of chDomainDetachDeviceLive() there's a code that
tries to remove the disk that's being detached from the domain
definition. Well, it's a leftover from the original patch which I
forgot to remove when rewriting it to use chDomainRemoveDevice().
The disk is removed there so this code has no chance in removing
it again. Drop the code.

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

index b06fdbe5a8de3520d42a5953940c22fd02497765..aa723dd123df123e025cc287b347ce4eb8aa906c 100644 (file)
@@ -263,7 +263,6 @@ chDomainDetachDeviceLive(virDomainObj *vm,
     virDomainDeviceDef detach = { .type = match->type };
     virDomainDeviceInfo *info = NULL;
     virCHDomainObjPrivate *priv = vm->privateData;
-    int idx = 0;
 
     switch (match->type) {
     case VIR_DOMAIN_DEVICE_DISK:
@@ -339,13 +338,6 @@ chDomainDetachDeviceLive(virDomainObj *vm,
     if (chDomainRemoveDevice(vm, &detach) < 0)
         return -1;
 
-    if (match->type == VIR_DOMAIN_DEVICE_DISK) {
-        idx = chFindDiskId(vm->def, match->data.disk->dst);
-        if (idx >= 0) {
-            virDomainDiskRemove(vm->def, idx);
-        }
-    }
-
     return 0;
 }