(2.10) drive_del after device_del in disk hot-remove
authorDimitris Aragiorgis <dimara@grnet.gr>
Thu, 17 Oct 2013 12:25:12 +0000 (15:25 +0300)
committerDimitris Aragiorgis <dimara@grnet.gr>
Thu, 27 Mar 2014 07:57:04 +0000 (09:57 +0200)
This is needed so that qemu process really releases the
corresponding file descriptor and thus we can dmsetup/lvremove
the device without errors.

Signed-off-by: Dimitris Aragiorgis <dimara@grnet.gr>
Signed-off-by: Thomas Thrainer <thomasth@google.com>
Reviewed-by: Thomas Thrainer <thomasth@google.com>

lib/hypervisor/hv_kvm.py

index 4876b73..3c623a1 100644 (file)
@@ -2061,7 +2061,8 @@ class KVMHypervisor(hv_base.BaseHypervisor):
     kvm_device = _RUNTIME_DEVICE[dev_type](entry)
     kvm_devid = _GenerateDeviceKVMId(dev_type, kvm_device)
     if dev_type == constants.HOTPLUG_TARGET_DISK:
-      command = "device_del %s" % kvm_devid
+      command = "device_del %s\n" % kvm_devid
+      command += "drive_del %s" % kvm_devid
     elif dev_type == constants.HOTPLUG_TARGET_NIC:
       command = "device_del %s\n" % kvm_devid
       command += "netdev_del %s" % kvm_devid