[libvirt] [PATCH 2/3] Revert "conf: Try controller add when searching hostdev bus for unit"

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


This reverts commit 0785966d03c9b26ce127aadb93b4d3130a3af79f.

Trying to hotplug a scsi hostdev to a domain without the required SCSI
controller fails. Commits 0d8b24f6 and 0785966d rearranged the automatic
creation of the required SCSI controllers from the domain parsing xml code into
the device post xml parsing code section.

Doing so will create but not hotplug the missing SCSI controller and on
the hotplug path through the same code the SCSI controller will not get
hotplugged since it already exits. When the SCSI hostdev device afterwards
is hotplugged the following internal error occurs:

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

This patch reverts the code from the device post 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 | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 69cfd0f..6fb70db 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4181,7 +4181,7 @@ virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt,
     int next_unit = 0;
     unsigned controller = 0;
     size_t i;
-    int ret = -1;
+    int ret;
 
     for (i = 0; i < def->ncontrollers; i++) {
         if (def->controllers[i]->type != VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
@@ -4200,17 +4200,6 @@ virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt,
         }
     }
 
-    /* If failed to find any VIR_DOMAIN_CONTROLLER_TYPE_SCSI or any space
-     * on existing VIR_DOMAIN_CONTROLLER_TYPE_SCSI controller(s), then
-     * try to add a new controller resulting in placement of this entry
-     * as unit=0
-     */
-    if (ret == -1 &&
-        virDomainDefMaybeAddController((virDomainDefPtr) def,
-                                           VIR_DOMAIN_CONTROLLER_TYPE_SCSI,
-                                           controller, -1) < 0)
-        return -1;
-
     hostdev->info->type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE;
     hostdev->info->addr.drive.controller = controller;
     hostdev->info->addr.drive.bus = 0;
-- 
2.3.0




More information about the libvir-list mailing list