[libvirt] [PATCH v6 04/14] qemu: Add check for iothread attribute in validate controller

John Ferlan jferlan at redhat.com
Thu Feb 1 02:57:43 UTC 2018


Let's make sure that non SCSI virtio-scsi isn't used for any type
other than a virtio-scsi controller.

This includes removing the check from qemuCheckSCSIControllerIOThreads
which is a very suble difference because although def->model was used
in the original comparison and just @model is used in the new comparison,
the comparison is the same.

This is because qemuDomainSetSCSIControllerModel doesn't change the
def->model, thus we know that the resultant @model would result in
either the same as input or if not set, whatever the default model is
when def->model == -1. In this second case, virtio-scsi is the last
default chosen.

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/qemu/qemu_command.c | 8 --------
 src/qemu/qemu_domain.c  | 5 +++++
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d9fa3742a..007d689ec 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2598,14 +2598,6 @@ qemuCheckSCSIControllerIOThreads(const virDomainDef *domainDef,
     if (!def->iothread)
         return true;
 
-    if (def->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI) {
-        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("IOThreads only supported for virtio-scsi "
-                         "controllers model is '%s'"),
-                       virDomainControllerModelSCSITypeToString(def->model));
-        return false;
-    }
-
     if (def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI &&
         def->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) {
        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 152718c0d..0a9f92031 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3947,6 +3947,11 @@ qemuDomainDeviceDefValidateControllerAttributes(const virDomainControllerDef *co
                            _("'ioeventfd' is only supported by virtio-scsi controller"));
             return -1;
         }
+        if (controller->iothread) {
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                           _("'iothread' is only supported for virtio-scsi controller"));
+            return -1;
+        }
     }
 
     return 0;
-- 
2.13.6




More information about the libvir-list mailing list