From nobody Wed Feb 11 10:15:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1489596018670802.7996786959343; Wed, 15 Mar 2017 09:40:18 -0700 (PDT) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGaw3W005917; Wed, 15 Mar 2017 12:36:58 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2FGauHj024967 for ; Wed, 15 Mar 2017 12:36:56 -0400 Received: from angien.brq.redhat.com (dhcp129-47.brq.redhat.com [10.34.129.47]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2FGafIP000870; Wed, 15 Mar 2017 12:36:55 -0400 From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 15 Mar 2017 17:37:23 +0100 Message-Id: <45cf7ae72cda7eea7a1a30893bc63c70584ee61f.1489595335.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 11/23] virsh: Implement 'domblkthreshold' 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 | 64 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh.pod | 8 +++++++ 2 files changed, 72 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ee702f3c4..36629523b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -7097,6 +7097,64 @@ cmdSetvcpu(vshControl *ctl, const vshCmd *cmd) /* + * "domblkthreshold" command + */ +static const vshCmdInfo info_domblkthreshold[] =3D { + {.name =3D "help", + .data =3D N_("set the threshold for block-threshold event for a given= block " + "device or it's backing chain element") + }, + {.name =3D "desc", + .data =3D N_("set threshold for ") + }, + {.name =3D NULL} +}; + +static const vshCmdOptDef opts_domblkthreshold[] =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 +cmdDomblkthreshold(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 +14118,11 @@ const vshCmdDef domManagementCmds[] =3D { .info =3D info_setvcpu, .flags =3D 0 }, + {.name =3D "domblkthreshold", + .handler =3D cmdDomblkthreshold, + .opts =3D opts_domblkthreshold, + .info =3D info_domblkthreshold, + .flags =3D 0 + }, {.name =3D NULL} }; diff --git a/tools/virsh.pod b/tools/virsh.pod index ee7904611..48be19234 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -1274,6 +1274,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.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list