[libvirt] [PATCH 3/4] qemu: Drop support of media update in live disk attach API

Han Han hhan at redhat.com
Wed Jan 15 08:24:57 UTC 2020


virDomainUpdateDeviceFlags has been introduced since v0.8.0. There is no
reason to use virDomainAttachDevice* API to update media for cdrom or
floopy device.

https://bugzilla.redhat.com/show_bug.cgi?id=1788793

Signed-off-by: Han Han <hhan at redhat.com>
---
 src/qemu/qemu_hotplug.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 31d455505b..db8cb0e696 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -1076,7 +1076,7 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriverPtr driver,
  * @vm: domain object
  * @dev: device to attach (expected type is DISK)
  *
- * Attach a new disk or in case of cdroms/floppies change the media in the drive.
+ * Attach a new disk in the drive.
  * This function handles all the necessary steps to attach a new storage source
  * to the VM.
  */
@@ -1088,17 +1088,13 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
     virDomainDiskDefPtr disk = dev->data.disk;
     virDomainDiskDefPtr orig_disk = NULL;
 
-    /* this API overloads media change semantics on disk hotplug
-     * for devices supporting media changes */
     if ((disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ||
          disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) &&
         (orig_disk = virDomainDiskByTarget(vm->def, disk->dst))) {
-        if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk,
-                                           disk->src, false) < 0)
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+                           _("cdrom/floppy media update isn't supported. "
+                             "Use virDomainUpdateDeviceFlags instead."));
             return -1;
-
-        disk->src = NULL;
-        return 0;
     }
 
     return qemuDomainAttachDeviceDiskLiveInternal(driver, vm, dev);
-- 
2.24.0.rc1




More information about the libvir-list mailing list