diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 117542f47ebe19ac65e5dcf47e32d1daef5a7efc..0a85d19a3fda4819cf4dc1a4da24a7afac0a5e7c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -779,6 +779,7 @@ qemuAssignSpaprVIOAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info, int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) { int i, rc; + int model; /* Default values match QEMU. See spapr_(llan|vscsi|vty).c */ @@ -790,10 +791,18 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def) } for (i = 0 ; i < def->ncontrollers; i++) { - rc = qemuAssignSpaprVIOAddress(def, &def->controllers[i]->info, - 0x2000ul); - if (rc) - return rc; + model = def->controllers[i]->model; + if (model == -1 && + def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) + model = qemuDefaultScsiControllerModel(def); + if (model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI && + def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) { + def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO; + rc = qemuAssignSpaprVIOAddress(def, &def->controllers[i]->info, + 0x2000ul); + if (rc) + return rc; + } } for (i = 0 ; i < def->nserials; i++) { diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.args index 4261a8493191d65159dbe6ad0134d4df2fffe8cd..d57159ff5285fd84904a2bb85c9476608ab1b3d7 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-scsi-vscsi.args @@ -1,8 +1,8 @@ LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \ pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults -monitor \ unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -device spapr-vscsi,id=scsi0,\ -bus=pci.0,addr=0x3 -drive file=/dev/HostVG/QEMUGuest1,if=none,\ +reg=0x2000 -drive file=/dev/HostVG/QEMUGuest1,if=none,\ id=drive-ide0-0-0 -device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \ -drive file=/tmp/scsidisk.img,if=none,id=drive-scsi0-0-3-0 \ -device scsi-disk,bus=scsi0.0,channel=0,scsi-id=3,lun=0,drive=drive-scsi0-0-3-0,id=scsi0-0-3-0 \ --usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4 +-usb -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3