diff mbox series

[v3,16/17] qemu: Support scsi controller model=virtio-{non-}transitional

Message ID a0eacddce7e714b93d39b2460af68afddd539122.1549663397.git.crobinso@redhat.com
State Accepted
Commit 448a0947174ffcc3047bb2ad2d3709d02c894257
Headers show
Series qemu: virtio-{non-}transitional support | expand

Commit Message

Cole Robinson Feb. 8, 2019, 10:12 p.m. UTC
Add <controller type='scsi' model handling for virtio transitional
devices. Ex:

  <controller type='scsi' model='virtio-transitional'/>

* "virtio-transitional" maps to qemu "virtio-scsi-pci-transitional"
* "virtio-non-transitional" maps to qemu "virtio-scsi-non-transitional"

The naming here doesn't match the pre-existing model=virtio-scsi.
The prescence of '-scsi' there seems kind of redundant as we have
type='scsi' already, so I decided to follow the pattern of other
patches and use virtio-transitional etc.

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 docs/formatdomain.html.in                     |  7 +++++--
 docs/schemas/domaincommon.rng                 |  2 ++
 src/conf/domain_conf.c                        | 14 ++++++++-----
 src/conf/domain_conf.h                        |  2 ++
 src/qemu/qemu_command.c                       |  5 +++++
 src/qemu/qemu_domain.c                        |  8 +++++++-
 src/qemu/qemu_domain_address.c                |  3 +++
 src/vbox/vbox_common.c                        |  2 ++
 src/vmx/vmx.c                                 |  5 ++++-
 .../virtio-non-transitional.x86_64-3.1.0.args | 15 ++++++++------
 ...virtio-non-transitional.x86_64-latest.args | 14 +++++++------
 .../virtio-non-transitional.xml               |  1 +
 .../virtio-transitional.x86_64-3.1.0.args     | 14 +++++++------
 .../virtio-transitional.x86_64-latest.args    | 13 ++++++------
 .../qemuxml2argvdata/virtio-transitional.xml  |  1 +
 .../virtio-non-transitional.xml               | 20 +++++++++++++------
 .../virtio-transitional.xml                   | 15 ++++++++------
 tests/qemuxml2xmltest.c                       |  6 ++++--
 18 files changed, 100 insertions(+), 47 deletions(-)

-- 
2.20.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Comments

Andrea Bolognani Feb. 12, 2019, 5:08 p.m. UTC | #1
On Fri, 2019-02-08 at 17:12 -0500, Cole Robinson wrote:
> Add <controller type='scsi' model handling for virtio transitional

> devices. Ex:

> 

>   <controller type='scsi' model='virtio-transitional'/>

> 

> * "virtio-transitional" maps to qemu "virtio-scsi-pci-transitional"

> * "virtio-non-transitional" maps to qemu "virtio-scsi-non-transitional"

> 

> The naming here doesn't match the pre-existing model=virtio-scsi.

> The prescence of '-scsi' there seems kind of redundant as we have

> type='scsi' already, so I decided to follow the pattern of other

> patches and use virtio-transitional etc.

> 

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>  docs/formatdomain.html.in                     |  7 +++++--

>  docs/schemas/domaincommon.rng                 |  2 ++

>  src/conf/domain_conf.c                        | 14 ++++++++-----

>  src/conf/domain_conf.h                        |  2 ++

>  src/qemu/qemu_command.c                       |  5 +++++

>  src/qemu/qemu_domain.c                        |  8 +++++++-

>  src/qemu/qemu_domain_address.c                |  3 +++

>  src/vbox/vbox_common.c                        |  2 ++

>  src/vmx/vmx.c                                 |  5 ++++-

>  .../virtio-non-transitional.x86_64-3.1.0.args | 15 ++++++++------

>  ...virtio-non-transitional.x86_64-latest.args | 14 +++++++------

>  .../virtio-non-transitional.xml               |  1 +

>  .../virtio-transitional.x86_64-3.1.0.args     | 14 +++++++------

>  .../virtio-transitional.x86_64-latest.args    | 13 ++++++------

>  .../qemuxml2argvdata/virtio-transitional.xml  |  1 +

>  .../virtio-non-transitional.xml               | 20 +++++++++++++------

>  .../virtio-transitional.xml                   | 15 ++++++++------

>  tests/qemuxml2xmltest.c                       |  6 ++++--

>  18 files changed, 100 insertions(+), 47 deletions(-)


Reviewed-by: Andrea Bolognani <abologna@redhat.com>


-- 
Andrea Bolognani / Red Hat / Virtualization

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
diff mbox series

Patch

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 32e40e8765..cd0468f3cb 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -4180,8 +4180,11 @@ 
         <dt><code>scsi</code></dt>
         <dd>A <code>scsi</code> controller has an optional attribute
         <code>model</code>, which is one of 'auto', 'buslogic', 'ibmvscsi',
-        'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi' or
-        'vmpvscsi'.</dd>
+        'lsilogic', 'lsisas1068', 'lsisas1078', 'virtio-scsi',
+        'vmpvscsi', 'virtio-transitional', 'virtio-non-transitional'. See
+        <a href="#elementsVirtioTransitional">Virtio transitional devices</a>
+        for more details.
+        </dd>
         <dt><code>usb</code></dt>
         <dd>A <code>usb</code> controller has an optional attribute
         <code>model</code>, which is one of "piix3-uhci", "piix4-uhci",
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index da2545b889..1332e0d464 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2156,6 +2156,8 @@ 
                   <value>ibmvscsi</value>
                   <value>virtio-scsi</value>
                   <value>lsisas1078</value>
+                  <value>virtio-transitional</value>
+                  <value>virtio-non-transitional</value>
                 </choice>
               </attribute>
             </optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 44c9aa5b83..78425d0142 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -379,7 +379,10 @@  VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS
               "vmpvscsi",
               "ibmvscsi",
               "virtio-scsi",
-              "lsisas1078");
+              "lsisas1078",
+              "virtio-transitional",
+              "virtio-non-transitional",
+);
 
 VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
               "piix3-uhci",
@@ -4965,11 +4968,12 @@  virDomainDeviceDefPostParseCommon(virDomainDeviceDefPtr dev,
         virDomainControllerDefPtr cdev = dev->data.controller;
 
         if (cdev->iothread &&
-            cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) {
-            virReportError(VIR_ERR_XML_ERROR,
+            cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI &&
+            cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL &&
+            cdev->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL) {
+            virReportError(VIR_ERR_XML_ERROR, "%s",
                            _("'iothread' attribute only supported for "
-                             "controller model '%s'"),
-                           virDomainControllerModelSCSITypeToString(VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI));
+                             "virtio scsi controllers"));
             return -1;
         }
     }
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a6b32b17bd..caa018a4cf 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -756,6 +756,8 @@  typedef enum {
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078,
+    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL,
+    VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL,
 
     VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
 } virDomainControllerModelSCSI;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ded9773499..dbf4f7b783 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -523,6 +523,9 @@  qemuBuildVirtioDevStr(virBufferPtr buf,
             if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {
                 has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_TRANSITIONAL;
                 has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_VIRTIO_SERIAL_VIRTIO_NON_TRANSITIONAL;
+            } else if (device.data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
+                has_tmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL;
+                has_ntmodel = device.data.controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL;
             } else {
                 return 0;
             }
@@ -2997,6 +3000,8 @@  qemuBuildControllerDevStr(const virDomainDef *domainDef,
     case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
         switch ((virDomainControllerModelSCSI) def->model) {
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL:
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL:
             if (qemuBuildVirtioDevStr(&buf, "virtio-scsi", qemuCaps,
                                       VIR_DOMAIN_DEVICE_CONTROLLER, def) < 0) {
                 goto error;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 16929ea656..c83a4cd451 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5099,7 +5099,9 @@  static int
 qemuDomainDeviceDefValidateControllerAttributes(const virDomainControllerDef *controller)
 {
     if (!(controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
-          controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) {
+          (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI ||
+           controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL ||
+           controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL))) {
         if (controller->queues) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("'queues' is only supported by virtio-scsi controller"));
@@ -5153,6 +5155,8 @@  qemuDomainCheckSCSIControllerModel(virQEMUCapsPtr qemuCaps,
         }
         break;
     case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
+    case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL:
+    case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL:
         if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("This QEMU doesn't support "
@@ -5268,6 +5272,8 @@  qemuDomainDeviceDefValidateControllerSCSI(const virDomainControllerDef *controll
 {
     switch ((virDomainControllerModelSCSI) controller->model) {
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL:
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL:
             if (!qemuDomainCheckSCSIControllerIOThreads(controller, def))
                 return -1;
             break;
diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c
index 78695fdc0a..ce3a513823 100644
--- a/src/qemu/qemu_domain_address.c
+++ b/src/qemu/qemu_domain_address.c
@@ -648,8 +648,11 @@  qemuDomainDeviceCalculatePCIConnectFlags(virDomainDeviceDefPtr dev,
                 return 0;
 
             case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
+            case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL:
                 return virtioFlags;
 
+            /* Transitional devices only work in conventional PCI slots */
+            case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL:
             case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO:
             case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC:
             case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index 664650f217..00d43d9a83 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -406,6 +406,8 @@  vboxSetStorageController(virDomainControllerDefPtr controller,
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI:
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI:
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_TRANSITIONAL:
+        case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_NON_TRANSITIONAL:
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078:
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("The vbox driver does not support %s SCSI "
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index d525f187e9..75cdea9067 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -517,7 +517,10 @@  VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
               "pvscsi",
               "UNUSED ibmvscsi",
               "UNUSED virtio-scsi",
-              "UNUSED lsisas1078");
+              "UNUSED lsisas1078",
+              "UNUSED virtio-transitional",
+              "UNUSED virtio-non-transitional",
+);
 
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
index 7543a225cb..52f0855611 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-3.1.0.args
@@ -35,10 +35,13 @@  addr=0x1 \
 -device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\
 multifunction=on,addr=0x2 \
 -device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \
+-device pcie-root-port,port=0x12,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 \
+-device virtio-scsi-pci,disable-legacy=on,disable-modern=off,id=scsi0,\
+bus=pci.4,addr=0x0 \
 -device virtio-serial-pci,disable-legacy=on,disable-modern=off,\
 id=virtio-serial0,bus=pci.3,addr=0x0 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.4,\
+-device virtio-blk-pci,disable-legacy=on,disable-modern=off,scsi=off,bus=pci.5,\
 addr=0x0,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci,disable-legacy=on,disable-modern=off,id=fs0,\
@@ -47,16 +50,16 @@  fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.1,addr=0x0 \
 -device virtio-net-pci,disable-legacy=on,disable-modern=off,netdev=hostnet0,\
 id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
 -device virtio-input-host-pci,disable-legacy=on,disable-modern=off,id=input0,\
-evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \
+evdev=/dev/input/event1234,bus=pci.9,addr=0x0 \
 -device vhost-scsi-pci,disable-legacy=on,disable-modern=off,\
-wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.5,addr=0x0 \
+wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.6,addr=0x0 \
 -device virtio-balloon-pci,disable-legacy=on,disable-modern=off,id=balloon0,\
-bus=pci.6,addr=0x0 \
+bus=pci.7,addr=0x0 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
 -device virtio-rng-pci,disable-legacy=on,disable-modern=off,rng=objrng0,\
-id=rng0,bus=pci.7,addr=0x0 \
+id=rng0,bus=pci.8,addr=0x0 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci,disable-legacy=on,disable-modern=off,id=vsock0,\
-guest-cid=4,vhostfd=6789,bus=pci.9,addr=0x0 \
+guest-cid=4,vhostfd=6789,bus=pci.10,addr=0x0 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
index 514db3ee7f..54125d2102 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.x86_64-latest.args
@@ -35,10 +35,12 @@  addr=0x1 \
 -device pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,\
 multifunction=on,addr=0x2 \
 -device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \
+-device pcie-root-port,port=0x12,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 \
+-device virtio-scsi-pci-non-transitional,id=scsi0,bus=pci.4,addr=0x0 \
 -device virtio-serial-pci-non-transitional,id=virtio-serial0,bus=pci.3,\
 addr=0x0 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci-non-transitional,scsi=off,bus=pci.4,addr=0x0,\
+-device virtio-blk-pci-non-transitional,scsi=off,bus=pci.5,addr=0x0,\
 drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci-non-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
@@ -47,14 +49,14 @@  bus=pci.1,addr=0x0 \
 -device virtio-net-pci-non-transitional,netdev=hostnet0,id=net0,\
 mac=00:11:22:33:44:55,bus=pci.2,addr=0x0 \
 -device virtio-input-host-pci-non-transitional,id=input0,\
-evdev=/dev/input/event1234,bus=pci.8,addr=0x0 \
+evdev=/dev/input/event1234,bus=pci.9,addr=0x0 \
 -device vhost-scsi-pci-non-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.5,addr=0x0 \
--device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.6,addr=0x0 \
+id=hostdev0,bus=pci.6,addr=0x0 \
+-device virtio-balloon-pci-non-transitional,id=balloon0,bus=pci.7,addr=0x0 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.7,addr=0x0 \
+-device virtio-rng-pci-non-transitional,rng=objrng0,id=rng0,bus=pci.8,addr=0x0 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci-non-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\
-bus=pci.9,addr=0x0 \
+bus=pci.10,addr=0x0 \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-non-transitional.xml b/tests/qemuxml2argvdata/virtio-non-transitional.xml
index 4e1b0084c5..adcbcec33e 100644
--- a/tests/qemuxml2argvdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-non-transitional.xml
@@ -29,6 +29,7 @@ 
       <source evdev='/dev/input/event1234'/>
     </input>
     <controller type='virtio-serial' model='virtio-non-transitional'/>
+    <controller type='scsi' model='virtio-non-transitional'/>
     <controller type='usb' index='0' model='none'/>
     <memballoon model='virtio-non-transitional'/>
     <vsock model='virtio-non-transitional'>
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
index b07f77511f..4f8958f336 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-3.1.0.args
@@ -27,11 +27,13 @@  file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 addr=0x1 \
 -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
 -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
+-device virtio-scsi-pci,disable-legacy=off,disable-modern=off,id=scsi0,\
+bus=pci.2,addr=0x4 \
 -device virtio-serial-pci,disable-legacy=off,disable-modern=off,\
 id=virtio-serial0,bus=pci.2,addr=0x3 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
 -device virtio-blk-pci,disable-legacy=off,disable-modern=off,scsi=off,\
-bus=pci.2,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
+bus=pci.2,addr=0x5,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci,disable-legacy=off,disable-modern=off,id=fs0,\
 fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \
@@ -39,16 +41,16 @@  fsdev=fsdev-fs0,mount_tag=fs1,bus=pci.2,addr=0x1 \
 -device virtio-net-pci,disable-legacy=off,disable-modern=off,netdev=hostnet0,\
 id=net0,mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
 -device virtio-input-host-pci,disable-legacy=off,disable-modern=off,id=input0,\
-evdev=/dev/input/event1234,bus=pci.2,addr=0x8 \
+evdev=/dev/input/event1234,bus=pci.2,addr=0x9 \
 -device vhost-scsi-pci,disable-legacy=off,disable-modern=off,\
-wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.2,addr=0x5 \
+wwpn=naa.5123456789abcde0,vhostfd=3,id=hostdev0,bus=pci.2,addr=0x6 \
 -device virtio-balloon-pci,disable-legacy=off,disable-modern=off,id=balloon0,\
-bus=pci.2,addr=0x6 \
+bus=pci.2,addr=0x7 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
 -device virtio-rng-pci,disable-legacy=off,disable-modern=off,rng=objrng0,\
-id=rng0,bus=pci.2,addr=0x7 \
+id=rng0,bus=pci.2,addr=0x8 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci,disable-legacy=off,disable-modern=off,id=vsock0,\
-guest-cid=4,vhostfd=6789,bus=pci.2,addr=0x9 \
+guest-cid=4,vhostfd=6789,bus=pci.2,addr=0xa \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
index 6c697eba83..49cfd12b92 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/virtio-transitional.x86_64-latest.args
@@ -27,9 +27,10 @@  file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
 addr=0x1 \
 -device pcie-pci-bridge,id=pci.2,bus=pci.1,addr=0x0 \
 -device pcie-root-port,port=0x9,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x1 \
+-device virtio-scsi-pci-transitional,id=scsi0,bus=pci.2,addr=0x4 \
 -device virtio-serial-pci-transitional,id=virtio-serial0,bus=pci.2,addr=0x3 \
 -drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-virtio-disk0 \
--device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x4,\
+-device virtio-blk-pci-transitional,scsi=off,bus=pci.2,addr=0x5,\
 drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \
 -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \
 -device virtio-9p-pci-transitional,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,\
@@ -38,14 +39,14 @@  bus=pci.2,addr=0x1 \
 -device virtio-net-pci-transitional,netdev=hostnet0,id=net0,\
 mac=00:11:22:33:44:55,bus=pci.2,addr=0x2 \
 -device virtio-input-host-pci-transitional,id=input0,\
-evdev=/dev/input/event1234,bus=pci.2,addr=0x8 \
+evdev=/dev/input/event1234,bus=pci.2,addr=0x9 \
 -device vhost-scsi-pci-transitional,wwpn=naa.5123456789abcde0,vhostfd=3,\
-id=hostdev0,bus=pci.2,addr=0x5 \
--device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x6 \
+id=hostdev0,bus=pci.2,addr=0x6 \
+-device virtio-balloon-pci-transitional,id=balloon0,bus=pci.2,addr=0x7 \
 -object rng-random,id=objrng0,filename=/dev/urandom \
--device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x7 \
+-device virtio-rng-pci-transitional,rng=objrng0,id=rng0,bus=pci.2,addr=0x8 \
 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
 resourcecontrol=deny \
 -device vhost-vsock-pci-transitional,id=vsock0,guest-cid=4,vhostfd=6789,\
-bus=pci.2,addr=0x9 \
+bus=pci.2,addr=0xa \
 -msg timestamp=on
diff --git a/tests/qemuxml2argvdata/virtio-transitional.xml b/tests/qemuxml2argvdata/virtio-transitional.xml
index ffcafedc4a..35613069d9 100644
--- a/tests/qemuxml2argvdata/virtio-transitional.xml
+++ b/tests/qemuxml2argvdata/virtio-transitional.xml
@@ -29,6 +29,7 @@ 
       <source evdev='/dev/input/event1234'/>
     </input>
     <controller type='virtio-serial' model='virtio-transitional'/>
+    <controller type='scsi' model='virtio-transitional'/>
     <controller type='usb' index='0' model='none'/>
     <memballoon model='virtio-transitional'/>
     <vsock model='virtio-transitional'>
diff --git a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
index 7ef2d09c11..4e7d1ee3b1 100644
--- a/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-non-transitional.xml
@@ -18,11 +18,14 @@ 
       <driver name='qemu' type='raw'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
     </disk>
     <controller type='virtio-serial' index='0' model='virtio-non-transitional'>
       <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
     </controller>
+    <controller type='scsi' index='0' model='virtio-non-transitional'>
+      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
+    </controller>
     <controller type='usb' index='0' model='none'/>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
@@ -78,6 +81,11 @@ 
       <target chassis='10' port='0x11'/>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
     </controller>
+    <controller type='pci' index='11' model='pcie-root-port'>
+      <model name='pcie-root-port'/>
+      <target chassis='11' port='0x12'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
+    </controller>
     <filesystem type='mount' accessmode='passthrough' model='virtio-non-transitional'>
       <source dir='/export/fs1'/>
       <target dir='fs1'/>
@@ -90,24 +98,24 @@ 
     </interface>
     <input type='passthrough' bus='virtio' model='virtio-non-transitional'>
       <source evdev='/dev/input/event1234'/>
-      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
     </input>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-non-transitional'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
-      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
     </hostdev>
     <memballoon model='virtio-non-transitional'>
-      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
     </memballoon>
     <rng model='virtio-non-transitional'>
       <backend model='random'>/dev/urandom</backend>
-      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
     </rng>
     <vsock model='virtio-non-transitional'>
       <cid auto='no' address='4'/>
-      <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
     </vsock>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmloutdata/virtio-transitional.xml b/tests/qemuxml2xmloutdata/virtio-transitional.xml
index da4fbbcdc5..2293e5be3e 100644
--- a/tests/qemuxml2xmloutdata/virtio-transitional.xml
+++ b/tests/qemuxml2xmloutdata/virtio-transitional.xml
@@ -18,11 +18,14 @@ 
       <driver name='qemu' type='raw'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='vda' bus='virtio'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
     </disk>
     <controller type='virtio-serial' index='0' model='virtio-transitional'>
       <address type='pci' domain='0x0000' bus='0x02' slot='0x03' function='0x0'/>
     </controller>
+    <controller type='scsi' index='0' model='virtio-transitional'>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
+    </controller>
     <controller type='usb' index='0' model='none'/>
     <controller type='sata' index='0'>
       <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
@@ -54,24 +57,24 @@ 
     </interface>
     <input type='passthrough' bus='virtio' model='virtio-transitional'>
       <source evdev='/dev/input/event1234'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
     </input>
     <input type='mouse' bus='ps2'/>
     <input type='keyboard' bus='ps2'/>
     <hostdev mode='subsystem' type='scsi_host' managed='no' model='virtio-transitional'>
       <source protocol='vhost' wwpn='naa.5123456789abcde0'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x05' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
     </hostdev>
     <memballoon model='virtio-transitional'>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x06' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
     </memballoon>
     <rng model='virtio-transitional'>
       <backend model='random'>/dev/urandom</backend>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x07' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x08' function='0x0'/>
     </rng>
     <vsock model='virtio-transitional'>
       <cid auto='no' address='4'/>
-      <address type='pci' domain='0x0000' bus='0x02' slot='0x09' function='0x0'/>
+      <address type='pci' domain='0x0000' bus='0x02' slot='0x0a' function='0x0'/>
     </vsock>
   </devices>
 </domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 452184d84a..0a441da143 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1260,14 +1260,16 @@  mymain(void)
             QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
             QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
             QEMU_CAPS_DEVICE_VHOST_VSOCK,
-            QEMU_CAPS_VIRTIO_INPUT_HOST);
+            QEMU_CAPS_VIRTIO_INPUT_HOST,
+            QEMU_CAPS_VIRTIO_SCSI);
     DO_TEST("virtio-non-transitional",
             QEMU_CAPS_DEVICE_VIDEO_PRIMARY,
             QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE,
             QEMU_CAPS_DEVICE_PCIE_ROOT_PORT,
             QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY,
             QEMU_CAPS_DEVICE_VHOST_VSOCK,
-            QEMU_CAPS_VIRTIO_INPUT_HOST);
+            QEMU_CAPS_VIRTIO_INPUT_HOST,
+            QEMU_CAPS_VIRTIO_SCSI);
 
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
         virFileDeleteTree(fakerootdir);