From 66f15d17e29139abedcffd1aa4fa9f4be8c3fc2f Mon Sep 17 00:00:00 2001 From: Daniel Henrique Barboza Date: Fri, 9 Oct 2020 14:02:34 -0300 Subject: [PATCH] qemu_command.c: move QEMU_CAPS_DEVICE_VHOST_SCSI check to qemu_validate.c Reviewed-by: Michal Privoznik Signed-off-by: Daniel Henrique Barboza --- src/qemu/qemu_command.c | 6 ------ src/qemu/qemu_validate.c | 8 ++++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index f9387a65e0..29bfa665c4 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4461,12 +4461,6 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; virDomainHostdevSubsysSCSIVHostPtr hostsrc = &dev->source.subsys.u.scsi_host; - if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_SCSI)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("This QEMU doesn't support vhost-scsi devices")); - return NULL; - } - if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", qemuCaps, VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) { return NULL; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index d6538806ec..6a6b981e16 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -1895,6 +1895,14 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev, "supported by vhost SCSI devices")); return -1; } + + if (hostdev->source.subsys.u.scsi_host.protocol == + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST && + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_SCSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support vhost-scsi devices")); + return -1; + } break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: return qemuValidateDomainMdevDef(hostdev, def, qemuCaps);