]> xenbits.xensource.com Git - libvirt.git/commitdiff
conf: Allow configuration of implicit controller model
authorJohn Ferlan <jferlan@redhat.com>
Tue, 30 Jan 2018 21:09:30 +0000 (16:09 -0500)
committerJohn Ferlan <jferlan@redhat.com>
Wed, 31 Jan 2018 16:32:04 +0000 (11:32 -0500)
When an implicit controller is added, the model is defined as -1
(IOW: undefined). So, if an implicit SCSI controller was added,
can set the model to the default value if the underlying hypervisor
supports it.

src/conf/domain_conf.c
tests/qemuargv2xmldata/nomachine-ppc64.xml
tests/qemuargv2xmldata/pseries-disk.xml
tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml

index b396679521854ea0ffa73578b1c15f4023d7a097..8efe8348943e3fbadacb1753df56e2ae3ed4db9b 100644 (file)
@@ -4924,6 +4924,8 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
                             struct virDomainDefPostParseDeviceIteratorData *data,
                             virHashTablePtr bootHash)
 {
+    size_t i;
+
     /* verify init path for container based domains */
     if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
@@ -4991,6 +4993,21 @@ virDomainDefPostParseCommon(virDomainDefPtr def,
             return -1;
     }
 
+    /* Implicit SCSI controllers without a defined model might have
+     * been added in AddImplicitDevices, after we've done the per-device
+     * post-parse. */
+    for (i = 0; i < def->ncontrollers; i++) {
+        if (def->controllers[i]->model == -1 &&
+            def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
+            virDomainDeviceDef device = {
+                .type = VIR_DOMAIN_DEVICE_CONTROLLER,
+                .data.controller = def->controllers[i],
+            };
+            if (virDomainDefPostParseDeviceIterator(def, &device, NULL, data) < 0)
+                return -1;
+        }
+    }
+
     /* clean up possibly duplicated metadata entries */
     virXMLNodeSanitizeNamespaces(def->metadata);
 
index fa41070cb4b04b683372e0d8f39666b4667708f0..439f9e9ac6d0d6399bb2917a24c48763f938347b 100644 (file)
@@ -33,7 +33,7 @@
       <model name='spapr-pci-host-bridge'/>
       <target index='0'/>
     </controller>
-    <controller type='scsi' index='0'>
+    <controller type='scsi' index='0' model='ibmvscsi'>
       <address type='spapr-vio' reg='0x2000'/>
     </controller>
     <input type='keyboard' bus='usb'/>
index 601d0f7f62535d2f3d714a260d8aa9cd06bf2190..1f15a950e3a8599f18cf2c8a975d1ba03d9a76b5 100644 (file)
@@ -34,7 +34,7 @@
       <model name='spapr-pci-host-bridge'/>
       <target index='0'/>
     </controller>
-    <controller type='scsi' index='0'>
+    <controller type='scsi' index='0' model='ibmvscsi'>
       <address type='spapr-vio' reg='0x2000'/>
     </controller>
     <input type='keyboard' bus='usb'/>
index dde3745900bb516f7b41975a1881b0400db9cc59..a0db32b56fee23b49de0a2b8eb04b9aa86719962 100644 (file)
@@ -31,7 +31,7 @@
       <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
     </controller>
     <controller type='pci' index='0' model='pci-root'/>
-    <controller type='scsi' index='0'>
+    <controller type='scsi' index='0' model='lsilogic'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
     </controller>
     <input type='mouse' bus='ps2'/>