[libvirt] [PATCH 2/2] qemu: Call virDomainDefCompatibleDevice when live add cdrom/floppy

John Ferlan jferlan at redhat.com
Thu Mar 1 13:03:39 UTC 2018


Prior to calling qemuDomainChangeEjectableMedia when adding
the cdrom/floppy to the guest, make a second pass at the
virDomainDefCompatibleDevice with the old_disk that's being
updated by the call.

This is similar to the qemuDomainChangeDiskLive path from
qemuDomainUpdateDeviceLive prior to making the same call to
qemuDomainChangeEjectableMedia when the cdrom/floppy is
updated rather than added.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_hotplug.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index e0a5300f0..4fbc0f48c 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -697,6 +697,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
     size_t i;
     virDomainDiskDefPtr disk = dev->data.disk;
     virDomainDiskDefPtr orig_disk = NULL;
+    virDomainDeviceDef orig_dev = { .type = dev->type };
     int ret = -1;
 
     if (STRNEQ_NULLABLE(virDomainDiskGetDriver(disk), "qemu")) {
@@ -732,6 +733,13 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr driver,
             goto cleanup;
         }
 
+        /* Although called in qemuDomainAttachDeviceLiveAndConfig, now we
+         * know the orig_disk/dev so let's make the additional check for
+         * boot order checking */
+        orig_dev.data.disk = orig_disk;
+        if (virDomainDefCompatibleDevice(vm->def, dev, &orig_dev) < 0)
+            goto cleanup;
+
         if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk,
                                            disk->src, false) < 0)
             goto cleanup;
-- 
2.13.6




More information about the libvir-list mailing list