1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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.
This commit is contained in:
John Ferlan 2018-01-30 17:29:48 -05:00
parent fadfb4f9b3
commit 13d216617d
3 changed files with 14 additions and 10 deletions

View File

@ -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;

View File

@ -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>

View File

@ -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>