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.
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
src/qemu/qemu_hotplug.c | 8 ++++++--
.../qemuhotplug-base-with-scsi-controller-live.xml | 8 ++++----
.../qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml | 8 ++++----
3 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 6b245bd6a..fccbc29a0 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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;
diff --git a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml
index 63eb77007..d23d3d483 100644
--- a/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml
+++ b/tests/qemuhotplugtestdomains/qemuhotplug-base-with-scsi-controller-live.xml
@@ -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>
diff --git
a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
index c12d18f71..cceb678bb 100644
---
a/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
+++
b/tests/qemuhotplugtestdomains/qemuhotplug-base-without-scsi-controller-live+disk-scsi-2.xml
@@ -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>
--
2.13.6