提交 13d21661 编写于 作者: J John Ferlan

qemu: Fetch/save the default SCSI controller model during hotplug

If we're going to add a controller to the domain, let's set the
default SCSI model value if we cannot find another SCSI controller
already present.

NB: Requires updating the live output test data since the model
will now be formatted.
上级 fadfb4f9
......@@ -587,6 +587,7 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverPtr driver,
{
size_t i;
virDomainControllerDefPtr cont;
qemuDomainObjPrivatePtr priv = vm->privateData;
int model = -1;
for (i = 0; i < vm->def->ncontrollers; i++) {
......@@ -615,10 +616,13 @@ qemuDomainFindOrCreateSCSIDiskController(virQEMUDriverPtr driver,
return NULL;
cont->type = VIR_DOMAIN_CONTROLLER_TYPE_SCSI;
cont->idx = controller;
cont->model = model;
if (model == -1)
cont->model = qemuDomainGetSCSIControllerModel(vm->def, cont, priv->qemuCaps);
else
cont->model = model;
VIR_INFO("No SCSI controller present, hotplugging one model=%s",
virDomainControllerModelSCSITypeToString(model));
virDomainControllerModelSCSITypeToString(cont->model));
if (qemuDomainAttachControllerDevice(driver, vm, cont) < 0) {
VIR_FREE(cont);
return NULL;
......
......@@ -26,19 +26,19 @@
<controller type='pci' index='0' model='pci-root'>
<alias name='pci'/>
</controller>
<controller type='scsi' index='0'>
<controller type='scsi' index='0' model='virtio-scsi'>
<alias name='scsi0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<controller type='scsi' index='1'>
<controller type='scsi' index='1' model='virtio-scsi'>
<alias name='scsi1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
<controller type='scsi' index='2'>
<controller type='scsi' index='2' model='virtio-scsi'>
<alias name='scsi2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<controller type='scsi' index='3'>
<controller type='scsi' index='3' model='virtio-scsi'>
<alias name='scsi3'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
......
......@@ -36,19 +36,19 @@
<controller type='pci' index='0' model='pci-root'>
<alias name='pci'/>
</controller>
<controller type='scsi' index='0'>
<controller type='scsi' index='0' model='virtio-scsi'>
<alias name='scsi0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<controller type='scsi' index='1'>
<controller type='scsi' index='1' model='virtio-scsi'>
<alias name='scsi1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</controller>
<controller type='scsi' index='2'>
<controller type='scsi' index='2' model='virtio-scsi'>
<alias name='scsi2'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</controller>
<controller type='scsi' index='3'>
<controller type='scsi' index='3' model='virtio-scsi'>
<alias name='scsi3'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</controller>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册