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

John Ferlan jferlan at redhat.com
Tue Dec 12 15:06:59 UTC 2017


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 d3a993fb1..bdac01414 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -2601,14 +2601,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 120c013bd..144439218 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3918,6 +3918,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