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. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/conf/domain_conf.c | 17 +++++++++++++++++ tests/qemuargv2xmldata/nomachine-ppc64.xml | 2 +- tests/qemuargv2xmldata/pseries-disk.xml | 2 +- tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml | 2 +- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b39667952..8efe83489 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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); diff --git a/tests/qemuargv2xmldata/nomachine-ppc64.xml b/tests/qemuargv2xmldata/nomachine-ppc64.xml index fa41070cb..439f9e9ac 100644 --- a/tests/qemuargv2xmldata/nomachine-ppc64.xml +++ b/tests/qemuargv2xmldata/nomachine-ppc64.xml @@ -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'/> diff --git a/tests/qemuargv2xmldata/pseries-disk.xml b/tests/qemuargv2xmldata/pseries-disk.xml index 601d0f7f6..1f15a950e 100644 --- a/tests/qemuargv2xmldata/pseries-disk.xml +++ b/tests/qemuargv2xmldata/pseries-disk.xml @@ -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'/> diff --git a/tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml b/tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml index dde374590..a0db32b56 100644 --- a/tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml +++ b/tests/qemuxml2xmloutdata/disk-scsi-device-auto.xml @@ -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'/> -- 2.13.6 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list