[PATCH v2 14/15] qemu_validate: Check if QEMU's capable of setting main loop pool size

Michal Privoznik posted 15 patches 3 years, 8 months ago
There is a newer version of this series
[PATCH v2 14/15] qemu_validate: Check if QEMU's capable of setting main loop pool size
Posted by Michal Privoznik 3 years, 8 months ago
Since the main-loop and iothread classes are derived from the
same class (EventLoopBaseClass) we don't need new capability and
can use QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX directly to check
whether QEMU's capable of setting worker pool size.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_validate.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 7d11ae2c92..c2495fb6b8 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -401,6 +401,15 @@ qemuValidateDomainDefIOThreads(const virDomainDef *def,
         }
     }
 
+    if (def->defaultIOThread &&
+        ((def->defaultIOThread->thread_pool_min >= 0 ||
+          def->defaultIOThread->thread_pool_max >= 0) &&
+         !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX))) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                       _("pool_min and pool_max is not supported by this QEMU binary"));
+        return -1;
+    }
+
     return 0;
 }
 
-- 
2.35.1
Re: [PATCH v2 14/15] qemu_validate: Check if QEMU's capable of setting main loop pool size
Posted by Peter Krempa 3 years, 8 months ago
On Tue, Jun 07, 2022 at 14:52:58 +0200, Michal Privoznik wrote:
> Since the main-loop and iothread classes are derived from the
> same class (EventLoopBaseClass) we don't need new capability and
> can use QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX directly to check
> whether QEMU's capable of setting worker pool size.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_validate.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
> index 7d11ae2c92..c2495fb6b8 100644
> --- a/src/qemu/qemu_validate.c
> +++ b/src/qemu/qemu_validate.c
> @@ -401,6 +401,15 @@ qemuValidateDomainDefIOThreads(const virDomainDef *def,
>          }
>      }
>  
> +    if (def->defaultIOThread &&
> +        ((def->defaultIOThread->thread_pool_min >= 0 ||
> +          def->defaultIOThread->thread_pool_max >= 0) &&
> +         !virQEMUCapsGet(qemuCaps, QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX))) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
> +                       _("pool_min and pool_max is not supported by this QEMU binary"));

Old field names in the error message. Also same problem as with regular
iothread pool sizes in regards to max being less than min.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>