提交 182659d8 编写于 作者: B Boris Fiuczynski 提交者: Ján Tomko

qemu: move hostdev boot validation into domain validation

Moving the hostdev boot support validation from the command line
generator code into the domain validation code.
Reviewed-by: NMarc Hartmayer <mhartmay@linux.ibm.com>
Signed-off-by: NBjoern Walk <bwalk@linux.ibm.com>
Signed-off-by: NBoris Fiuczynski <fiuczy@linux.ibm.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Signed-off-by: NJán Tomko <jtomko@redhat.com>
上级 927d0c3e
......@@ -5422,18 +5422,6 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd,
virDomainHostdevSubsysPtr subsys = &hostdev->source.subsys;
VIR_AUTOFREE(char *) devstr = NULL;
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) {
......
......@@ -5295,9 +5295,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:
......
......@@ -1639,7 +1639,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("hostdev-subsys-mdev-vfio-ap",
"s390x");
DO_TEST_CAPS_ARCH_LATEST_FAILURE("hostdev-subsys-mdev-vfio-ap-boot-fail",
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("hostdev-subsys-mdev-vfio-ap-boot-fail",
"s390x");
DO_TEST_FULL("restore-v2",
......@@ -2444,7 +2444,7 @@ mymain(void)
DO_TEST("hostdev-scsi-vhost-scsi-pci",
QEMU_CAPS_VIRTIO_SCSI,
QEMU_CAPS_DEVICE_VHOST_SCSI);
DO_TEST_CAPS_LATEST_FAILURE("hostdev-scsi-vhost-scsi-pci-boot-fail");
DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-scsi-vhost-scsi-pci-boot-fail");
DO_TEST("hostdev-scsi-vhost-scsi-pcie",
QEMU_CAPS_KVM,
QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册