On Wed, Jun 12, 2024 at 03:02:24 -0700, wucf@xxxxxxxxxxxxx wrote: > From: Chun Feng Wu <wucf@xxxxxxxxxxxxx> > > * Update "attach_disk" to support new option: throttle-groups to > form filter chain in QEMU for specific disk > > Signed-off-by: Chun Feng Wu <wucf@xxxxxxxxxxxxx> > --- > tools/virsh-completer-domain.c | 64 ++++++++++++++++++++++++++++++++++ > tools/virsh-completer-domain.h | 5 +++ > tools/virsh-domain.c | 25 ++++++++++++- > 3 files changed, 93 insertions(+), 1 deletion(-) Missing corresponding manpage update. > diff --git a/tools/virsh-completer-domain.c b/tools/virsh-completer-domain.c > index 61362224a3..000cf65c99 100644 > --- a/tools/virsh-completer-domain.c > +++ b/tools/virsh-completer-domain.c > @@ -248,6 +248,70 @@ virshDomainMigrateDisksCompleter(vshControl *ctl, > } > > > +static char ** > +virshDomainThrottleGroupCompleter(vshControl *ctl, > + const vshCmd *cmd, > + unsigned int flags) Well, you see that it's possible to complete these. Add this helper beforehand and use it approprately also when adding the helpers in previous patch. > +{ > + virshControl *priv = ctl->privData; > + g_autoptr(xmlDoc) xmldoc = NULL; > + g_autoptr(xmlXPathContext) ctxt = NULL; > + g_autofree xmlNodePtr *groups = NULL; > + int ngroups; > + size_t i; > + g_auto(GStrv) tmp = NULL; > + > + virCheckFlags(0, NULL); > + > + if (!priv->conn || virConnectIsAlive(priv->conn) <= 0) > + return NULL; > + > + if (virshDomainGetXML(ctl, cmd, 0, &xmldoc, &ctxt) < 0) > + return NULL; > + > + ngroups = virXPathNodeSet("./throttlegroups/throttlegroup", ctxt, &groups); > + if (ngroups < 0) > + return NULL; > + > + tmp = g_new0(char *, ngroups + 1); > + > + for (i = 0; i < ngroups; i++) { > + ctxt->node = groups[i]; > + if (!(tmp[i] = virXPathString("string(./group_name)", ctxt))) > + return NULL; Since this also does everything that the 'throttlegrouplist' command does, you can theoretically even reuse this there and use it to fill the table. > + } > + > + return g_steal_pointer(&tmp); > +} [...]