File 182659d8-qemu-move-hostdev-boot-validation.patch of Package libvirt.16761

commit 182659d8bd6a6265d7c85d1893c5e6493ac7dbf5
Author: Boris Fiuczynski <fiuczy@linux.ibm.com>
Date:   Tue Aug 27 16:19:20 2019 +0200

    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: Marc Hartmayer <mhartmay@linux.ibm.com>
    Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com>
    Signed-off-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
    Reviewed-by: Ján Tomko <jtomko@redhat.com>
    Signed-off-by: Ján Tomko <jtomko@redhat.com>

Index: libvirt-5.1.0/src/qemu/qemu_command.c
===================================================================
--- libvirt-5.1.0.orig/src/qemu/qemu_command.c
+++ libvirt-5.1.0/src/qemu/qemu_command.c
@@ -5542,18 +5542,6 @@ qemuBuildHostdevCommandLine(virCommandPt
         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) {
Index: libvirt-5.1.0/src/qemu/qemu_domain.c
===================================================================
--- libvirt-5.1.0.orig/src/qemu/qemu_domain.c
+++ libvirt-5.1.0/src/qemu/qemu_domain.c
@@ -4818,9 +4818,22 @@ qemuDomainDeviceDefValidateHostdev(const
         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:
Index: libvirt-5.1.0/tests/qemuxml2argvtest.c
===================================================================
--- libvirt-5.1.0.orig/tests/qemuxml2argvtest.c
+++ libvirt-5.1.0/tests/qemuxml2argvtest.c
@@ -2447,7 +2447,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,
openSUSE Build Service is sponsored by