qemu_command.c: move QEMU_CAPS_DEVICE_VHOST_SCSI check to qemu_validate.c

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
Daniel Henrique Barboza 2020-10-09 14:02:34 -03:00
parent 03e4e4b21e
commit 66f15d17e2
2 changed files with 8 additions and 6 deletions

View File

@ -4461,12 +4461,6 @@ qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def,
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
virDomainHostdevSubsysSCSIVHostPtr hostsrc = &dev->source.subsys.u.scsi_host; 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, if (qemuBuildVirtioDevStr(&buf, "vhost-scsi", qemuCaps,
VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) { VIR_DOMAIN_DEVICE_HOSTDEV, dev) < 0) {
return NULL; return NULL;

View File

@ -1895,6 +1895,14 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHostdevDef *hostdev,
"supported by vhost SCSI devices")); "supported by vhost SCSI devices"));
return -1; 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; break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
return qemuValidateDomainMdevDef(hostdev, def, qemuCaps); return qemuValidateDomainMdevDef(hostdev, def, qemuCaps);