[libvirt] [PATCH v5 06/16] qemu: Add check for iothread attribute in validate controller

John Ferlan posted 16 patches 7 years, 4 months ago
There is a newer version of this series
[libvirt] [PATCH v5 06/16] qemu: Add check for iothread attribute in validate controller
Posted by John Ferlan 7 years, 4 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 515206261..732c720b0 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 a253d4708..f60c6540e 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3966,6 +3966,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 v5 06/16] qemu: Add check for iothread attribute in validate controller
Posted by Michal Privoznik 7 years, 3 months ago
On 01/06/2018 12:47 AM, 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.
> 
> 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(-)

ACK

Michal

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