]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Fix depedency order in qemuRemoveDiskDevice
authorJohn Ferlan <jferlan@redhat.com>
Tue, 25 Oct 2016 19:32:27 +0000 (15:32 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 26 Oct 2016 10:56:00 +0000 (06:56 -0400)
Need to remove the drive first, then the secobj and/or encobj if they exist.
This is because the drive has a dependency on secobj (or the secret for
the networked storage server) and/or the encobj (or the secret for the
LUKS encrypted volume).  Deleting either object first leaves an drive
without it's respective objects.

Signed-off-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_hotplug.c

index 7a21dc67f5338f8f90b1440d3c96bcecd92efcb7..30565d500217e1e1b9554c4a82bf22155427feaa 100644 (file)
@@ -3176,6 +3176,9 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
 
     qemuDomainObjEnterMonitor(driver, vm);
 
+    qemuMonitorDriveDel(priv->mon, drivestr);
+    VIR_FREE(drivestr);
+
     /* If it fails, then so be it - it was a best shot */
     if (objAlias)
         ignore_value(qemuMonitorDelObject(priv->mon, objAlias));
@@ -3186,8 +3189,6 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
         ignore_value(qemuMonitorDelObject(priv->mon, encAlias));
     VIR_FREE(encAlias);
 
-    qemuMonitorDriveDel(priv->mon, drivestr);
-    VIR_FREE(drivestr);
     if (qemuDomainObjExitMonitor(driver, vm) < 0)
         return -1;