]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virsh: Wire up new virDomainSetIOThreadParams parameters
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 11 May 2022 11:32:36 +0000 (13:32 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 10 Jun 2022 12:00:59 +0000 (14:00 +0200)
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>
docs/manpages/virsh.rst
tools/virsh-domain.c

index faac996536e8b2fbd6b7fbdf07c03c9a7f0d072a..580245adb13a906533d8e70190fa3fb66bd42937 100644 (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
index cfdaac194201c180e8437ea4127bdf0f1f28c34e..06ed6ba9cf08dd838dae1b19502def8886365f68 100644 (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;