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

John Ferlan posted 14 patches 7 years, 3 months ago
[libvirt] [PATCH v6 04/14] qemu: Add check for iothread attribute in validate controller
Posted by John Ferlan 7 years, 3 months ago
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@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

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v6 04/14] qemu: Add check for iothread attribute in validate controller
Posted by Ján Tomko 7 years, 3 months ago
On Wed, Jan 31, 2018 at 09:57:43PM -0500, John Ferlan wrote:
>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.
>

Both of these paragraphs can be deleted now

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list