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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux