render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
c401cc
From 93b4590ec1403a870bdc96f6bf8f032932860e86 Mon Sep 17 00:00:00 2001
c401cc
Message-Id: <93b4590ec1403a870bdc96f6bf8f032932860e86.1385135432.git.jdenemar@redhat.com>
c401cc
From: Eric Farman <farman@linux.vnet.ibm.com>
c401cc
Date: Fri, 15 Nov 2013 15:44:19 +0100
c401cc
Subject: [PATCH] qemu: Allow hotplug of multiple SCSI devices
c401cc
c401cc
https://bugzilla.redhat.com/show_bug.cgi?id=1031062
c401cc
c401cc
Hotplugging a single SCSI device works, but adding additional ones
c401cc
result in an error from QEMU:
c401cc
c401cc
[root@gpok197 ~]# virsh attach-device guest01 blah.xml
c401cc
Device attached successfully
c401cc
[root@gpok197 ~]# virsh attach-device guest01 blah2.xml
c401cc
error: Failed to attach device from blah2.xml
c401cc
error: internal error unable to execute QEMU command 'device_add': Duplicate ID 'hostdev0' for device
c401cc
c401cc
The hostdev ID that is created is always set to zero, regardless
c401cc
of the contents of the XML.  Changing the index in the hotplug case
c401cc
to a negative one so the next available index is used.
c401cc
c401cc
Signed-off-by: Eric Farman <farman@linux.vnet.ibm.com>
c401cc
Reviewed-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
c401cc
(cherry picked from commit c4eb12067e020b0b30c34b0f8d67943da654761d)
c401cc
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
c401cc
---
c401cc
 src/qemu/qemu_hotplug.c | 2 +-
c401cc
 1 file changed, 1 insertion(+), 1 deletion(-)
c401cc
c401cc
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
c401cc
index f87b893..4b9cc07 100644
c401cc
--- a/src/qemu/qemu_hotplug.c
c401cc
+++ b/src/qemu/qemu_hotplug.c
c401cc
@@ -1375,7 +1375,7 @@ qemuDomainAttachHostScsiDevice(virQEMUDriverPtr driver,
c401cc
         return -1;
c401cc
     }
c401cc
 
c401cc
-    if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, 0) < 0)
c401cc
+    if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
c401cc
         goto cleanup;
c401cc
 
c401cc
     if (!(drvstr = qemuBuildSCSIHostdevDrvStr(hostdev, priv->qemuCaps,
c401cc
-- 
c401cc
1.8.4.4
c401cc