On Tue, Aug 13, 2019 at 05:40:27PM +0200, Boris Fiuczynski wrote:
Moving the hostdev boot support validation from the command line
generator code into the domain validation code.
Signed-off-by: Boris Fiuczynski <fiuczy(a)linux.ibm.com>
Reviewed-by: Marc Hartmayer <mhartmay(a)linux.ibm.com>
---
src/qemu/qemu_command.c | 13 +------------
src/qemu/qemu_domain.c | 13 +++++++++++++
tests/qemuxml2argvtest.c | 4 ++--
3 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index f096e8f27e..d32ffed5d6 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5625,6 +5625,7 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *def,
return ret;
}
+
Unrelated whitespace change
static int
qemuBuildHostdevCommandLine(virCommandPtr cmd,
const virDomainDef *def,
@@ -5638,18 +5639,6 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
virDomainHostdevSubsysPtr subsys = &hostdev->source.subsys;
char *devstr;
- if (hostdev->info->bootIndex) {
- if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
- (subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
- subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB &&
- subsys->type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("booting from assigned devices is only "
- "supported for PCI, USB and SCSI devices"));
- return -1;
- }
- }
-
/* USB */
if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index b9c5a4e541..ce5334aa67 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -5263,9 +5263,22 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef
*hostdev,
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
+ break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST:
+ if (hostdev->info->bootIndex) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("booting from assigned devices is only "
+ "supported for PCI, USB and SCSI devices"));
+ return -1;
+ }
break;
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+ if (hostdev->info->bootIndex) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("booting from assigned devices is only "
+ "supported for PCI, USB and SCSI devices"));
+ return -1;
+ }
mdevsrc = &hostdev->source.subsys.u.mdev;
return qemuDomainMdevDefValidate(mdevsrc, def, qemuCaps);
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 5f94780f61..e378df097c 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1637,7 +1637,7 @@ mymain(void)
QEMU_CAPS_CCW,
QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
QEMU_CAPS_DEVICE_VFIO_AP);
- DO_TEST_FAILURE("hostdev-subsys-mdev-vfio-ap-boot-fail",
+ DO_TEST_PARSE_ERROR("hostdev-subsys-mdev-vfio-ap-boot-fail",
This will become DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR
QEMU_CAPS_CCW,
QEMU_CAPS_CCW_CSSID_UNRESTRICTED,
QEMU_CAPS_DEVICE_VFIO_AP);
@@ -2444,7 +2444,7 @@ mymain(void)
DO_TEST("hostdev-scsi-vhost-scsi-pci",
QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_DEVICE_VHOST_SCSI);
- DO_TEST_FAILURE("hostdev-scsi-vhost-scsi-pci-boot-fail",
+ DO_TEST_PARSE_ERROR("hostdev-scsi-vhost-scsi-pci-boot-fail",
DO_TEST_CAPS_LATEST_PARSE_ERROR
Jano
QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_DEVICE_VHOST_SCSI);
DO_TEST("hostdev-scsi-vhost-scsi-pcie",
--
2.17.0
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list