[libvirt] [PATCH 1/3] conf: Reposition adding SCSI controller for SCSI hostdev hotplug

Boris Fiuczynski fiuczy at linux.vnet.ibm.com
Mon Nov 30 11:05:59 UTC 2015

This patch reverts a part of commit 0d8b24f6b.
With commits 0d8b24g6 and 0785966d automatically adding a required controller
had been moved from the domain xml parsing code section into the device post
xml parsing code section and in doing so breaking as a side effect the SCSI
hostdev hotplugging in case the required SCSI controller had not been defined
in the domain. This behavior occurs because the SCSI controller gets added but
is NOT hotplugged. In the hotplug code section the controller is searched for
and if not found would be hotplugged but since a SCSI controller already exists
in the domain defintion the required SCSI controller hotplug is never executed.
This results later in the internal error:

error: Failed to attach device from st0.xml
error: internal error: Device alias was not set for scsi controller with index 0

This patch moves the automatic add of a SCSI controller for a SCSI hostdev
device back into the domain xml parsing code section.

Signed-off-by: Boris Fiuczynski <fiuczy at linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk at linux.vnet.ibm.com>
Reviewed-by: Stefan Zimmermann <stzi at linux.vnet.ibm.com>
 src/conf/domain_conf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cbfc41e..69cfd0f 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -16285,6 +16285,9 @@ virDomainDefParseXML(xmlDocPtr xml,
         def->hostdevs[def->nhostdevs++] = hostdev;
+        if (virDomainDefMaybeAddHostdevSCSIcontroller(def) < 0)
+            goto error;

More information about the libvir-list mailing list