mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-09 01:18:00 +03:00
conf: Allow configuration of implicit controller model
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.
This commit is contained in:
parent
62f8c94732
commit
d1b59c6214
@ -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);
|
||||
|
||||
|
@ -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'/>
|
||||
|
@ -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'/>
|
||||
|
@ -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'/>
|
||||
|
Loading…
Reference in New Issue
Block a user