[PATCH 3/3] Automatic SCSI controller creation in SCSI disk hotplug broken

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

 



When a SCSI disk is hotplugged to a domain that does not have the required
scsi controller already defined the following internal error occurs

error: Failed to attach device from scsi_disk.xml
error: internal error: Could not find scsi controller with index 0 required for device

Commit 0260506c added in method qemuBuildDriveDevStr a lookup of the controller
alias. The internal error occurs because in method qemuDomainAttachSCSIDisk
the automatic creation of the potentially missing SCSI controller occurs after
calling qemuBuildDriveDevStr.

This patch reverses the calling sequence.

Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx>
Reviewed-by: Stefan Zimmermann <stzi@xxxxxxxxxxxxxxxxxx>
---
 src/qemu/qemu_hotplug.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 8804d3d..210d485 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -607,6 +607,12 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
         goto error;
     }
 
+    for (i = 0; i <= disk->info.addr.drive.controller; i++) {
+        cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i);
+        if (!cont)
+            goto error;
+    }
+
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
             goto error;
@@ -617,12 +623,6 @@ qemuDomainAttachSCSIDisk(virConnectPtr conn,
     if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
         goto error;
 
-    for (i = 0; i <= disk->info.addr.drive.controller; i++) {
-        cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i);
-        if (!cont)
-            goto error;
-    }
-
     /* Tell clang that "cont" is non-NULL.
        This is because disk->info.addr.driver.controller is unsigned,
        and hence the above loop must iterate at least once.  */
-- 
2.3.0

--
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]