From: Mike Perez <thingee(a)gmail.com>
This patch adds the necessary definitions to support vhost-scsi-pci and
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI in QEMU >= v1.5.x code.
This includes:
- Add QEMU_CAPS_VHOST_SCSI
- Add virDomainControllerDef->wwpn pointer for the vhost-scsi wwpn.
- Setting the new model type in qemuSetSCSIControllerModel()
- Invoking virDomainPCIAddressReserveAddr() for vhost-scsi-pci in
qemuAssignDevicePCISlots()
- Add the 'wwpn=' device parameter in qemuBuildControllerDevStr()
- Add vhost-scsi-pci to >= v1.5.x qemucapabilitiesdata
- Add xml2argv and xml2xml tests for cmd_per_lun + max_sectors +
num_queues + wwpn.
Signed-off-by: Mike Perez <thingee(a)gmail.com>
Signed-off-by: Nicholas Bellinger <nab(a)linux-iscsi.org>
---
Makefile.am | 2 +-
docs/formatdomain.html.in | 20 +++----
docs/schemas/domaincommon.rng | 5 ++
src/conf/domain_conf.c | 20 ++++++-
src/conf/domain_conf.h | 2 +
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 59 ++++++++++++++++++--
src/vmx/vmx.c | 1 +
tests/qemucapabilitiesdata/caps_1.5.3-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.0-1.caps | 1 +
tests/qemucapabilitiesdata/caps_1.6.50-1.caps | 1 +
.../qemuxml2argv-disk-vhost-scsi-cmd_per_lun.args | 9 +++
.../qemuxml2argv-disk-vhost-scsi-cmd_per_lun.xml | 29 ++++++++++
.../qemuxml2argv-disk-vhost-scsi-max_sectors.args | 9 +++
.../qemuxml2argv-disk-vhost-scsi-max_sectors.xml | 29 ++++++++++
.../qemuxml2argv-disk-vhost-scsi-num_queues.args | 9 +++
.../qemuxml2argv-disk-vhost-scsi-num_queues.xml | 29 ++++++++++
.../qemuxml2argv-disk-vhost-scsi-wwpn.args | 9 +++
.../qemuxml2argv-disk-vhost-scsi-wwpn.xml | 29 ++++++++++
tests/qemuxml2argvtest.c | 12 ++++
tests/qemuxml2xmltest.c | 4 ++
22 files changed, 266 insertions(+), 17 deletions(-)
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.xml
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.args
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.xml
diff --git a/Makefile.am b/Makefile.am
index a374e1a..cb8d606 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,7 +19,7 @@
LCOV = lcov
GENHTML = genhtml
-SUBDIRS = . gnulib/lib include src daemon tools docs gnulib/tests \
+SUBDIRS = . gnulib/lib include src daemon tools gnulib/tests \
tests po examples/object-events examples/hellolibvirt \
examples/dominfo examples/domsuspend examples/apparmor \
examples/xml/nwfilter examples/openauth examples/systemtap \
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index b69da4c..32b1864 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -2550,16 +2550,16 @@
control how many devices can be connected through the
controller. A "scsi" controller has an optional
attribute <code>model</code>, which is one of "auto",
"buslogic",
- "ibmvscsi", "lsilogic", "lsisas1068",
"lsisas1078", "virtio-scsi" or
- "vmpvscsi". A "usb" controller has an optional attribute
- <code>model</code>, which is one of "piix3-uhci",
"piix4-uhci", "ehci",
- "ich9-ehci1", "ich9-uhci1", "ich9-uhci2",
"ich9-uhci3", "vt82c686b-uhci",
- "pci-ohci" or "nec-xhci". Additionally,
- <span class="since">since 0.10.0</span>, if the USB bus needs
to be
- explicitly disabled for the guest, <code>model='none'</code>
may be
- used. <span class="since">Since 1.0.5</span>, no default USB
controller
- will be built on s390. The PowerPC64 "spapr-vio" addresses do not have
an
- associated controller.
+ "ibmvscsi", "lsilogic", "lsisas1068",
"lsisas1078", "virtio-scsi",
+ "vhost-scsi", or "vmpvscsi". A "usb" controller has
an optional
+ attribute <code>model</code>, which is one of "piix3-uhci",
"piix4-uhci",
+ "ehci", "ich9-ehci1", "ich9-uhci1",
"ich9-uhci2", "ich9-uhci3",
+ "vt82c686b-uhci", "pci-ohci" or "nec-xhci".
Additionally, <span
+ class="since">since 0.10.0</span>, if the USB bus needs to be
explicitly
+ disabled for the guest, <code>model='none'</code> may be used.
<span
+ class="since">Since 1.0.5</span>, no default USB controller will
be built
+ on s390. The PowerPC64 "spapr-vio" addresses do not have an associated
+ controller.
</p>
<p>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7be028d..7f2622e 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -1650,6 +1650,7 @@
<value>vmpvscsi</value>
<value>ibmvscsi</value>
<value>virtio-scsi</value>
+ <value>vhost-scsi</value>
<value>lsisas1078</value>
</choice>
</attribute>
@@ -1745,6 +1746,10 @@
<ref name="unsignedInt"/>
</attribute>
</optional>
+ <optional>
+ <attribute name="wwpn">
+ </attribute>
+ </optional>
</element>
</optional>
</interleave>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fa76eb4..edb0d9d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -306,6 +306,7 @@ VIR_ENUM_IMPL(virDomainControllerModelSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAS
"vmpvscsi",
"ibmvscsi",
"virtio-scsi",
+ "vhost-scsi",
"lsisas1078");
VIR_ENUM_IMPL(virDomainControllerModelUSB, VIR_DOMAIN_CONTROLLER_MODEL_USB_LAST,
@@ -6049,6 +6050,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
char *queues = NULL;
char *cmd_per_lun = NULL;
char *max_sectors = NULL;
+ char *wwpn = NULL;
xmlNodePtr saved = ctxt->node;
int rc;
@@ -6094,6 +6096,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
queues = virXMLPropString(cur, "queues");
cmd_per_lun = virXMLPropString(cur, "cmd_per_lun");
max_sectors = virXMLPropString(cur, "max_sectors");
+ wwpn = virXMLPropString(cur, "wwpn");
}
cur = cur->next;
}
@@ -6115,6 +6118,17 @@ virDomainControllerDefParseXML(xmlNodePtr node,
_("Malformed 'max_sectors' value %s'"),
max_sectors);
}
+ if (wwpn) {
+ if (VIR_ALLOC(def->wwpn) < 0)
+ return NULL;
+ if (!STRPREFIX(wwpn, "naa") ||
+ (virStrcpy(def->wwpn, wwpn, strlen(wwpn) + 1) == NULL)) {
+ virReportError(VIR_ERR_XML_ERROR, _("Malformed 'wwpn' value
"
+ "'%s'"), def->wwpn);
+ goto error;
+ }
+ }
+
if (virDomainDeviceInfoParseXML(node, NULL, &def->info, flags) < 0)
goto error;
@@ -6224,6 +6238,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
VIR_FREE(queues);
VIR_FREE(cmd_per_lun);
VIR_FREE(max_sectors);
+ VIR_FREE(wwpn);
return def;
@@ -15327,7 +15342,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
break;
}
- if (def->queues || def->cmd_per_lun || def->max_sectors ||
+ if (def->queues || def->cmd_per_lun || def->max_sectors || def->wwpn ||
virDomainDeviceInfoIsSet(&def->info, flags) || pcihole64) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
@@ -15340,6 +15355,9 @@ virDomainControllerDefFormat(virBufferPtr buf,
if (def->max_sectors)
virBufferAsprintf(buf, "<driver
max_sectors='%u'/>\n", def->max_sectors);
+ if (def->wwpn)
+ virBufferAsprintf(buf, "<driver wwpn='%s'/>\n",
def->wwpn);
+
if (virDomainDeviceInfoIsSet(&def->info, flags) &&
virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
return -1;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 32674e0..28ad6c7 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -676,6 +676,7 @@ typedef enum {
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI,
+ VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1078,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
@@ -719,6 +720,7 @@ struct _virDomainControllerDef {
unsigned int queues;
unsigned int cmd_per_lun;
unsigned int max_sectors;
+ char *wwpn;
union {
virDomainVirtioSerialOpts vioserial;
virDomainPCIControllerOpts pciopts;
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c665e2b..d9f23ec 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -259,6 +259,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
"msg-timestamp",
"active-commit",
"change-backing-file",
+ "vhost-scsi-pci",
);
@@ -1475,6 +1476,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
{ "ich9-intel-hda", QEMU_CAPS_DEVICE_ICH9_INTEL_HDA },
{ "pvpanic", QEMU_CAPS_DEVICE_PANIC },
{ "usb-kbd", QEMU_CAPS_DEVICE_USB_KBD },
+ { "vhost-scsi-pci", QEMU_CAPS_VHOST_SCSI },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBlk[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 99cf9ed..d90fa04 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -209,6 +209,7 @@ typedef enum {
QEMU_CAPS_MSG_TIMESTAMP = 167, /* -msg timestamp */
QEMU_CAPS_ACTIVE_COMMIT = 168, /* block-commit works without 'top' */
QEMU_CAPS_CHANGE_BACKING_FILE = 169, /* change name of backing file in metadata */
+ QEMU_CAPS_VHOST_SCSI = 170,
QEMU_CAPS_LAST, /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2185ef4..43c0e1c 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -712,6 +712,15 @@ qemuSetSCSIControllerModel(virDomainDefPtr def,
return -1;
}
break;
+ case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI:
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_SCSI)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("This QEMU doesn't support "
+ "vhost scsi controller"));
+ return -1;
+ }
+ break;
+
default:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unsupported controller model: %s"),
@@ -724,6 +733,8 @@ qemuSetSCSIControllerModel(virDomainDefPtr def,
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
+ } else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VHOST_SCSI)) {
+ *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI;
} else if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI)) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI;
} else {
@@ -2172,10 +2183,28 @@ qemuAssignDevicePCISlots(virDomainDefPtr def,
def->controllers[i]->info.type = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
def->controllers[i]->info.addr.pci = addr;
} else {
+ if (def->controllers[i]->model ==
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI) {
+ virDevicePCIAddress addr = { 0, 0, 0, 0, false };
+ memset(&tmp_addr, 0, sizeof(tmp_addr));
+ if (virDomainPCIAddressGetNextSlot(addrs, &tmp_addr, flags) < 0)
+ goto error;
+
+ addr.bus = tmp_addr.bus;
+ addr.slot = tmp_addr.slot;
+
+ addrs->lastaddr = addr;
+ addrs->lastaddr.function = 0;
+ addrs->lastaddr.multi = 0;
+
+ if (virDomainPCIAddressReserveAddr(addrs, &addr, flags,
+ false, false) < 0)
+ goto error;
+ } else {
if (virDomainPCIAddressReserveNextSlot(addrs,
&def->controllers[i]->info,
flags) < 0)
- goto error;
+ goto error;
+ }
}
}
@@ -4130,20 +4159,34 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
int model;
if (!(def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
- def->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI)) {
+ (def->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI ||
+ def->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI))) {
if (def->queues) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("'queues' is only supported by virtio-scsi
controller"));
+ _("'queues' is only supported by virtio-scsi and
"
+ "vhost-scsi controller"));
return NULL;
}
if (def->cmd_per_lun) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("'cmd_per_lun' is only supported by virtio-scsi
controller"));
+ _("'cmd_per_lun' is only supported by virtio-scsi
"
+ "and vhost-scsi controller"));
return NULL;
}
if (def->max_sectors) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("'max_sectors' is only supported by virtio-scsi
controller"));
+ _("'max_sectors' is only supported by virtio-scsi
"
+ "and vhost-scsi controller"));
+ return NULL;
+ }
+ }
+
+ if (!(def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI &&
+ def->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI)) {
+ if (def->wwpn) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("'wwpn' is only supported by vhost-scsi "
+ "controller"));
return NULL;
}
}
@@ -4167,6 +4210,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
else
virBufferAddLit(&buf, "virtio-scsi-pci");
break;
+ case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VHOST_SCSI:
+ virBufferAddLit(&buf, "vhost-scsi-pci");
+ break;
case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
virBufferAddLit(&buf, "lsi");
break;
@@ -4279,6 +4325,9 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
if (def->max_sectors)
virBufferAsprintf(&buf, ",max_sectors=%u", def->max_sectors);
+ if (def->wwpn)
+ virBufferAsprintf(&buf, ",wwpn=%s", def->wwpn);
+
if (qemuBuildDeviceAddressStr(&buf, domainDef, &def->info, qemuCaps) <
0)
goto error;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index cd6c51e..903f0da 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -517,6 +517,7 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"pvscsi",
"UNUSED ibmvscsi",
"UNUSED virtio-scsi",
+ "UNUSED vhost-scsi",
"UNUSED lsisas1078");
diff --git a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
index 36758c8..7d53e6e 100644
--- a/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.5.3-1.caps
@@ -137,4 +137,5 @@
<flag name='spiceport'/>
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
+ <flag name='vhost-scsi-pci'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
index ca2c236..a67c212 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.0-1.caps
@@ -144,4 +144,5 @@
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
<flag name='msg-timestamp'/>
+ <flag name='vhost-scsi-pci'/>
</qemuCaps>
diff --git a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
index 32bccdb..9b527cc 100644
--- a/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
+++ b/tests/qemucapabilitiesdata/caps_1.6.50-1.caps
@@ -142,4 +142,5 @@
<flag name='usb-kbd'/>
<flag name='host-pci-multidomain'/>
<flag name='msg-timestamp'/>
+ <flag name='vhost-scsi-pci'/>
</qemuCaps>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.args
new file mode 100644
index 0000000..33f74fe
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device vhost-scsi-pci,id=scsi0,cmd_per_lun=50 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.xml
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.xml
new file mode 100644
index 0000000..70be0cc
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-cmd_per_lun.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='vhost-scsi'>
+ <driver cmd_per_lun='50'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.args
new file mode 100644
index 0000000..c46bc58
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device vhost-scsi-pci,id=scsi0,max_sectors=512 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.xml
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.xml
new file mode 100644
index 0000000..41e51d5
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-max_sectors.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='vhost-scsi'>
+ <driver max_sectors='512'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.args
new file mode 100644
index 0000000..fa6ed85
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device vhost-scsi-pci,id=scsi0,num_queues=8 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.xml
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.xml
new file mode 100644
index 0000000..9e24b47
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-num_queues.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='vhost-scsi'>
+ <driver queues='8'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.args
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.args
new file mode 100644
index 0000000..8815487
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.args
@@ -0,0 +1,9 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
+/usr/bin/qemu -S -M pc -m 214 -smp 8 -nographic -nodefconfig -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-device vhost-scsi-pci,id=scsi0,wwpn=naa.60014050a13df4f2 \
+-usb \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-scsi0-0-0-0 \
+-device scsi-disk,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+drive=drive-scsi0-0-0-0,id=scsi0-0-0-0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.xml
b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.xml
new file mode 100644
index 0000000..b89410a
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-vhost-scsi-wwpn.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sdb' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0' model='vhost-scsi'>
+ <driver wwpn='naa.60014050a13df4f2'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index bbc0fb7..397cca7 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -815,6 +815,18 @@ mymain(void)
DO_TEST("disk-virtio-scsi-max_sectors",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_VIRTIO_SCSI);
+ DO_TEST("disk-vhost-scsi-num_queues",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VHOST_SCSI);
+ DO_TEST("disk-vhost-scsi-cmd_per_lun",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VHOST_SCSI);
+ DO_TEST("disk-vhost-scsi-max_sectors",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VHOST_SCSI);
+ DO_TEST("disk-vhost-scsi-wwpn",
+ QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
+ QEMU_CAPS_VHOST_SCSI);
DO_TEST("disk-scsi-megasas",
QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,
QEMU_CAPS_SCSI_MEGASAS);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 26e3cad..fffb254 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -225,6 +225,10 @@ mymain(void)
DO_TEST("disk-virtio-scsi-num_queues");
DO_TEST("disk-virtio-scsi-cmd_per_lun");
DO_TEST("disk-virtio-scsi-max_sectors");
+ DO_TEST("disk-vhost-scsi-num_queues");
+ DO_TEST("disk-vhost-scsi-cmd_per_lun");
+ DO_TEST("disk-vhost-scsi-max_sectors");
+ DO_TEST("disk-vhost-scsi-wwpn");
DO_TEST("disk-scsi-megasas");
DO_TEST_DIFFERENT("disk-mirror-old");
DO_TEST_FULL("disk-mirror", false, WHEN_ACTIVE);
--
1.7.9.5