On Tue, Jun 07, 2022 at 17:06:50 +0200, Peter Krempa wrote:
On Tue, Jun 07, 2022 at 14:52:55 +0200, Michal Privoznik wrote:
> Introduced in previous commit, QEMU driver needs to be taught how
> to set VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN and
> VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX parameters on given IOThread.
> Fortunately, this is fairly trivial to do and since these two
> parameters are exposed in domain XML too the update of inactive
> XML can be wired up too.
>
> Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
> ---
> src/qemu/qemu_driver.c | 62 +++++++++++++++++++++++++++++++++---
> src/qemu/qemu_monitor.h | 4 +++
> src/qemu/qemu_monitor_json.c | 2 ++
> 3 files changed, 63 insertions(+), 5 deletions(-)
>
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 0c6645ed89..1770a1882b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
[...]
> diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
> index dc05dfd047..e8fe1eceae 100644
> --- a/src/qemu/qemu_monitor_json.c
> +++ b/src/qemu/qemu_monitor_json.c
> @@ -7431,6 +7431,8 @@ qemuMonitorJSONSetIOThread(qemuMonitor *mon,
> VIR_IOTHREAD_SET_PROP("poll-max-ns", poll_max_ns);
> VIR_IOTHREAD_SET_PROP("poll-grow", poll_grow);
> VIR_IOTHREAD_SET_PROP("poll-shrink", poll_shrink);
> + VIR_IOTHREAD_SET_PROP("thread-pool-min", thread_pool_min);
> + VIR_IOTHREAD_SET_PROP("thread-pool-max", thread_pool_max);
+/**
+ * VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN:
+ *
+ * Sets the lower bound for thread pool size. A value of -1 disables this bound
+ * leaving hypervisor use its default value. Accepted type is
+ * VIR_TYPED_PARAM_INT.
+ *
+ * Since: 8.5.0
+ */
+# define VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN "thread_pool_min"
I've tried following:
$ virsh iothreadset cd --id 3 --thread-pool-min 123
error: internal error: unable to execute QEMU command 'qom-set': bad
thread-pool-min/thread-pool-max values
$ virsh iothreadset cd --id 3 --thread-pool-max 123
$ virsh iothreadset cd --id 3 --thread-pool-min 2
$ virsh iothreadset cd --id 3 --thread-pool-min -1
error: internal error: unable to execute QEMU command 'qom-set': thread-pool-min
value must be in range [0, 9223372036854775807]
There are two conclusions:
- '-1' value simply doesn't work as documented
- we'll need to document that when live-setting 'max' needs to be
set first
So the second happens only if you pick a minimum which is greater than
the maximum auto-picked by qemu.
Also since VIR_IOTHREAD_SET_PROP is a discrete command the following
compound operation doesn't work properly:
virsh iothreadset cd --id 3 --thread-pool-max 1234 --thread-pool-min 123
error: internal error: unable to execute QEMU command 'qom-set': bad
thread-pool-min/thread-pool-max values
As it would IMO be a bit too overkill to try to order them properly when
changing the size I suggest you ask users to do it sequentially in the
docs.