From nobody Wed Feb 11 11:34:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1487877998524386.01799581792716; Thu, 23 Feb 2017 11:26:38 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NJNC4m047052; Thu, 23 Feb 2017 14:23:12 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1NJLKUm001351 for ; Thu, 23 Feb 2017 14:21:20 -0500 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NJL8uc028635; Thu, 23 Feb 2017 14:21:19 -0500 From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 23 Feb 2017 20:22:02 +0100 Message-Id: <597b878dc9dc5749ffbf68248b8889ca827e729c.1487877253.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [RFC PATCH 09/12] virsh: Implement 'blockthreshold' command to call virDomainSetBlockThreshold X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add a simple wrapper which will allow to set the threshold for delivering the event. --- tools/virsh-domain.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh.pod | 8 +++++++ 2 files changed, 71 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ee702f3c4..f70f61b72 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7097,6 +7097,63 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd) /* + * "blockthreshold" command + */ +static const vshCmdInfo info_blockthreshold[] =3D { + {.name =3D "help", + .data =3D N_("attach/detach vcpu or groups of threads") + }, + {.name =3D "desc", + .data =3D N_("Add or remove vcpus") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_blockthreshold[] =3D { + VIRSH_COMMON_OPT_DOMAIN_FULL, + {.name =3D "dev", + .type =3D VSH_OT_DATA, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("device to set threshold for") + }, + {.name =3D "threshold", + .type =3D VSH_OT_INT, + .flags =3D VSH_OFLAG_REQ, + .help =3D N_("threshold as a scaled number (by default bytes)") + }, + {.name =3D NULL} +}; + +static bool +cmdBlockThreshold(vshControl *ctl, const vshCmd *cmd) +{ + unsigned long long threshold; + const char *dev =3D NULL; + virDomainPtr dom; + bool ret =3D false; + + if (vshCommandOptStringReq(ctl, cmd, "dev", &dev)) + return false; + + if (vshCommandOptScaledInt(ctl, cmd, "threshold", + &threshold, 1, ULLONG_MAX) < 0) + return false; + + if (!(dom =3D virshCommandOptDomain(ctl, cmd, NULL))) + return false; + + if (virDomainSetBlockThreshold(dom, dev, threshold, 0) < 0) + goto cleanup; + + ret =3D true; + + cleanup: + virDomainFree(dom); + return ret; +} + + +/* * "iothreadinfo" command */ static const vshCmdInfo info_iothreadinfo[] =3D { @@ -14060,5 +14117,11 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_setvcpu, .flags =3D 0 }, + {.name =3D "blockthreshold", + .handler =3D cmdBlockThreshold, + .opts =3D opts_blockthreshold, + .info =3D info_blockthreshold, + .flags =3D 0 + }, {.name =3D NULL} }; diff --git a/tools/virsh.pod b/tools/virsh.pod index 6c06ee029..102aefc0c 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1265,6 +1265,14 @@ I<--bytes> with a scaled value allows to use finer g= ranularity. A scaled value used without I<--bytes> will be rounded down to MiB/s. Note that the I<--bytes> may be unsupported by the hypervisor. + +=3Ditem B I I I + +Set the threshold value for delivering the block-threshold event. I +specifies the disk device target or backing chain element of given device = using +the 'target[1]' syntax. I is a scaled value of the offset. If t= he +block device should write beyond that offset the event will be delivered. + =3Ditem B I I I Resize a block device of domain while the domain is running, I --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list