提交 62f8c947 编写于 作者: J John Ferlan

qemu: Introduce qemuDomainSetSCSIControllerModel

During post parse processing, let's force setting the controller
model to default value if not already set for defined controllers
(e.g. the non implicit ones).
上级 13d21661
......@@ -4251,11 +4251,9 @@ qemuDomainControllerDefPostParse(virDomainControllerDefPtr cont,
{
switch ((virDomainControllerType)cont->type) {
case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
/* set the default SCSI controller model for S390 arches */
if (cont->model == -1 &&
ARCH_IS_S390(def->os.arch)) {
cont->model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
}
/* Set the default SCSI controller model if not already set */
if (qemuDomainSetSCSIControllerModel(def, cont, qemuCaps) < 0)
return -1;
break;
case VIR_DOMAIN_CONTROLLER_TYPE_USB:
......
......@@ -60,6 +60,8 @@ qemuDomainGetSCSIControllerModel(const virDomainDef *def,
if (qemuDomainIsPSeries(def))
return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
else if (ARCH_IS_S390(def->os.arch))
return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI))
return VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI))
......@@ -72,6 +74,31 @@ qemuDomainGetSCSIControllerModel(const virDomainDef *def,
}
/**
* @def: Domain definition
* @cont: Domain controller def
* @qemuCaps: qemu capabilities
*
* Set the controller model based on the existing value and the
* capabilities if possible.
*
* Returns 0 on success, -1 on failure with error set.
*/
int
qemuDomainSetSCSIControllerModel(const virDomainDef *def,
virDomainControllerDefPtr cont,
virQEMUCapsPtr qemuCaps)
{
int model = qemuDomainGetSCSIControllerModel(def, cont, qemuCaps);
if (model < 0)
return -1;
cont->model = model;
return 0;
}
/**
* @def: Domain definition
* @info: Domain device info
......
......@@ -32,6 +32,10 @@ int qemuDomainGetSCSIControllerModel(const virDomainDef *def,
const virDomainControllerDef *cont,
virQEMUCapsPtr qemuCaps);
int qemuDomainSetSCSIControllerModel(const virDomainDef *def,
virDomainControllerDefPtr cont,
virQEMUCapsPtr qemuCaps);
int qemuDomainFindSCSIControllerModel(const virDomainDef *def,
virDomainDeviceInfoPtr info,
virQEMUCapsPtr qemuCaps);
......
......@@ -19,7 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='scsi' index='0'>
<controller type='scsi' index='0' model='lsilogic'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<controller type='usb' index='0'>
......
......@@ -19,7 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='scsi' index='0'>
<controller type='scsi' index='0' model='lsilogic'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<controller type='usb' index='0'>
......
......@@ -19,7 +19,7 @@
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='scsi' index='0'>
<controller type='scsi' index='0' model='lsilogic'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<controller type='usb' index='0'>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册