[PATCH 2/4] ch: Drop deadcode from chDomainDetachDeviceLive()

Michal Privoznik via Devel posted 4 patches 3 weeks, 3 days ago
[PATCH 2/4] ch: Drop deadcode from chDomainDetachDeviceLive()
Posted by Michal Privoznik via Devel 3 weeks, 3 days ago
From: Michal Privoznik <mprivozn@redhat.com>

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>
---
 src/ch/ch_hotplug.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/ch/ch_hotplug.c b/src/ch/ch_hotplug.c
index b06fdbe5a8..aa723dd123 100644
--- a/src/ch/ch_hotplug.c
+++ b/src/ch/ch_hotplug.c
@@ -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;
 }
 
-- 
2.49.1