From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9cpk-0005o3-Na for qemu-devel@nongnu.org; Fri, 09 Jan 2015 11:54:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9cph-00018p-Dh for qemu-devel@nongnu.org; Fri, 09 Jan 2015 11:54:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9cph-00018j-68 for qemu-devel@nongnu.org; Fri, 09 Jan 2015 11:54:45 -0500 Message-ID: <54B007D0.9050109@redhat.com> Date: Fri, 09 Jan 2015 09:54:40 -0700 From: Eric Blake MIME-Version: 1.0 References: <1417683548-15845-1-git-send-email-fromani@redhat.com> In-Reply-To: <1417683548-15845-1-git-send-email-fromani@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="wklQX5M0Qv6nUPRkSP9XRjb5rO7mfT6l3" Subject: Re: [Qemu-devel] [PATCH v4] block: add event when disk usage exceeds threshold List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Francesco Romani , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mdroth@linux.vnet.ibm.com, stefanha@redhat.com, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --wklQX5M0Qv6nUPRkSP9XRjb5rO7mfT6l3 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/04/2014 01:59 AM, Francesco Romani wrote: > Managing applications, like oVirt (http://www.ovirt.org), make extensiv= e > use of thin-provisioned disk images. > To let the guest run smoothly and be not unnecessarily paused, oVirt se= ts > a disk usage threshold (so called 'high water mark') based on the occup= ation > of the device, and automatically extends the image once the threshold > is reached or exceeded. >=20 > In order to detect the crossing of the threshold, oVirt has no choice b= ut > aggressively polling the QEMU monitor using the query-blockstats comman= d. > This lead to unnecessary system load, and is made even worse under scal= e: > deployments with hundreds of VMs are no longer rare. >=20 > To fix this, this patch adds: > * A new monitor command to set a write threshold for a given block devi= ce. > * A new event to report if a block device usage exceeds the threshold. Please also mention the names of those two things in the commit message, to make it easier to find them when doing 'git log' archaeology. >=20 > This will allow the managing application to use smarter and more > efficient monitoring, greatly reducing the need of polling. >=20 > A followup patch is planned to allow to add the write threshold at > device creation. >=20 > Signed-off-by: Francesco Romani > --- > --- /dev/null > +++ b/block/write-threshold.c > @@ -0,0 +1,125 @@ > +/* > + * QEMU System Emulator block write threshold notification > + * > + * Copyright Red Hat, Inc. 2014 I've been so slow on the review that you may want to add 2015. > +bool bdrv_write_threshold_is_set(const BlockDriverState *bs) > +{ > + return !!(bs->write_threshold_offset > 0); The !! is spurious; use of > already guarantees a bool result. > +++ b/qapi/block-core.json > @@ -239,6 +239,9 @@ > # > # @iops_size: #optional an I/O size in bytes (Since 1.7) > # > +# @write_threshold: configured write threshold for the device. > +# 0 if disabled. (Since 2.3) > +# > # Since: 0.14.0 > # > ## > @@ -253,7 +256,7 @@ > '*bps_max': 'int', '*bps_rd_max': 'int', > '*bps_wr_max': 'int', '*iops_max': 'int', > '*iops_rd_max': 'int', '*iops_wr_max': 'int', > - '*iops_size': 'int' } } > + '*iops_size': 'int', 'write_threshold': 'uint64' } } 'int' works as well as 'uint64'; since this is an output parameter, we aren't gaining any stricter input parsing by using a more-specific type. My findings are minor, so I'm okay if you post a v5 that addresses them and includes: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --wklQX5M0Qv6nUPRkSP9XRjb5rO7mfT6l3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJUsAfQAAoJEKeha0olJ0NqZbQH/2im23Xo6vvCx/FI9H/8M8Kw DLPtudoEcQ9wmJPW0pYCLvHMViifXbvrDIe5Xf3NU66AGQKQII6qnjytHX1Kjx0R SGZMKBYPQprl2bUKc1ict4PLfLYhoFr5B0pnb2lYU5VChNGH7FVOHtfKb0+y6te4 m2/MsqfKPHgcPZkEUkwWC/XR0Ypf/0LSgsH1kgFABptDd5ta1PZGVzdEYjpvJANH pLGbDJrKTPHyRjgXtNHwEJGzsotNsEFGEWdUZNpznas/AuSsYQnSCO4BbnPEfZP3 aNf336wJKJVuqDAElMBoO2VFyDMUMVj8c6gSkPkhFppHSo6RV+Xq0/6WNdkSUn8= =jgN4 -----END PGP SIGNATURE----- --wklQX5M0Qv6nUPRkSP9XRjb5rO7mfT6l3--