virsh: Wire up new virDomainSetIOThreadParams parameters

Since virsh implements a wrapper over virDomainSetIOThreadParams()
(command iothreadset) let's wire up new typed parameters there too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Michal Privoznik 2022-05-11 13:32:36 +02:00
parent f078db9dab
commit 7162cee68a
2 changed files with 35 additions and 2 deletions

View File

@ -2999,7 +2999,8 @@ iothreadset
::
iothreadset domain iothread_id [[--poll-max-ns ns] [--poll-grow factor]
[--poll-shrink divisor]]
[--poll-shrink divisor] [--thread-pool-min value]
[--thread-pool-max value]]
[[--config] [--live] | [--current]]
Modifies an existing iothread of the domain using the specified
@ -3016,6 +3017,16 @@ for a running guest. Saving, destroying, stopping, etc. the guest will
result in the polling values returning to hypervisor defaults at the
next start, restore, etc.
The *--thread-pool-min* and *--thread-pool-max* options then set lower and
upper bound, respectively of number of threads in worker pool of given
iothread. For changes to an inactive configuration -1 can be specified to
remove corresponding boundary from the domain configuration. For changes to a
running guest it's recommended to set the upper boundary first
(*--thread-pool-max*) and only after that set the lower boundary
(*--thread-pool-min*). It is allowed for the lower boundary to be the same as
the upper boundary, however it's not allowed for the upper boundary to be value
of zero.
If *--live* is specified, affect a running guest. If the guest is not
running an error is returned.
If *--current* is specified or *--live* is not specified, then handle

View File

@ -7796,7 +7796,15 @@ static const vshCmdOptDef opts_iothreadset[] = {
},
{.name = "poll-shrink",
.type = VSH_OT_INT,
.help = N_("set the value for reduction of the IOThread polling time ")
.help = N_("set the value for reduction of the IOThread polling time")
},
{.name = "thread-pool-min",
.type = VSH_OT_INT,
.help = N_("lower boundary for worker thread pool")
},
{.name = "thread-pool-max",
.type = VSH_OT_INT,
.help = N_("upper boundary for worker thread pool")
},
VIRSH_COMMON_OPT_DOMAIN_LIVE,
VIRSH_COMMON_OPT_DOMAIN_CURRENT,
@ -7816,6 +7824,7 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd)
int maxparams = 0;
unsigned long long poll_max;
unsigned int poll_val;
int thread_val;
int rc;
if (live)
@ -7853,6 +7862,19 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd)
#undef VSH_IOTHREAD_SET_UINT_PARAMS
#define VSH_IOTHREAD_SET_INT_PARAMS(opt, param) \
thread_val = -1; \
if ((rc = vshCommandOptInt(ctl, cmd, opt, &thread_val)) < 0) \
goto cleanup; \
if (rc > 0 && \
virTypedParamsAddInt(&params, &nparams, &maxparams, \
param, thread_val) < 0) \
goto save_error;
VSH_IOTHREAD_SET_INT_PARAMS("thread-pool-min", VIR_DOMAIN_IOTHREAD_THREAD_POOL_MIN)
VSH_IOTHREAD_SET_INT_PARAMS("thread-pool-max", VIR_DOMAIN_IOTHREAD_THREAD_POOL_MAX)
#undef VSH_IOTHREAD_SET_INT_PARAMS
if (nparams == 0) {
vshError(ctl, _("Not enough arguments passed, nothing to set"));
goto cleanup;