Received: from eggs.gnu.org ([2001:4830:134:3::10]:38554) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z2atG-000358-TX for qemu-devel@nongnu.org; Wed, 10 Jun 2015 03:57:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z2atF-0001gj-Ob for qemu-devel@nongnu.org; Wed, 10 Jun 2015 03:57:38 -0400 Date: Wed, 10 Jun 2015 09:57:29 +0200 From: Kevin Wolf Message-ID: <20150610075729.GB4899@noname.str.redhat.com> References: <1433641131-24123-1-git-send-email-eblake@redhat.com> <55776A49.3000705@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H+4ONPRPur6+Ovig" Content-Disposition: inline In-Reply-To: <55776A49.3000705@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: allow write-threshold on device name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: fromani@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org --H+4ONPRPur6+Ovig Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Am 10.06.2015 um 00:35 hat Eric Blake geschrieben: > On 06/06/2015 07:38 PM, Eric Blake wrote: > > Commit e2462113 allowed the ability to fire an event if a BDS > > node exceeds a threshold during a write, but limited the option > > to only work on node names. For convenience, expand this to > > allow a device name as a way to set the threshold on the BDS > > at the active layer of the device. > >=20 > > Signed-off-by: Eric Blake > > --- > > block/write-threshold.c | 5 ++--- > > 1 file changed, 2 insertions(+), 3 deletions(-) > >=20 >=20 > > @@ -110,9 +110,8 @@ void qmp_block_set_write_threshold(const char *node= _name, > > BlockDriverState *bs; > > AioContext *aio_context; > >=20 > > - bs =3D bdrv_find_node(node_name); > > + bs =3D bdrv_lookup_bs(node_name, node_name, errp); >=20 > Hmm, I'm not quite sure this does what I want. If I understand > correctly, when you open a qcow2 image, you get the following > query-block layout (abbreviated): >=20 > "inserted": { > ... > "image": { > ... > "backing-filename-format": "qcow2", > "virtual-size": 12884901888, > "filename": "/dev/sda6", > "cluster-size": 65536, > "format": "qcow2", > "actual-size": 0, > ... > "drv": "qcow2", > "iops": 0, > "bps_wr": 0, > "write_threshold": 0, > ... > "file": "/dev/sda6", >=20 >=20 > That is, the only write_threshold reported is that of the active layer > BDS (write_threshold of other BDS is reported through > query-named-block-nodes, but only if those BDS have a name), but > query-block is not listing any secondary BDS details. >=20 > Meanwhile, here is the corresponding query-blockstats layout: >=20 > "device": "drive-virtio-disk0", > "parent": { > "stats": { > "flush_total_time_ns": 0, > "wr_highest_offset": 72482304, > ... > "stats": { > "flush_total_time_ns": 728455560, > "wr_highest_offset": 9129332224, >=20 > which DOES show the BDS chain; in particular, each qcow2 file has two > BDS (one for the protocol, and the other ('parent') for the actual file). >=20 > The statistic I'm interested in is the allocation of the block device > (the host offset, aka wr_highest_offset 72482304 above), and NOT the > usage pattern of the guest (the qcow2 protocol, wr_highest_offset > 9129332224). But bdrv_lookup_bs() finds the qcow2 protocol layer, > rather than the intended backing file layer; likewise, query-block is > only reporting write_threshold for the protocol layer. >=20 > I'm wondering if, when a device name is given rather than a node name, > it is safe to blindly follow the active layer down to its lowest member > (or error out if there are more than one lower members, as in quorum), > as that is the statistic that libvirt and upper layers really want ("am > I about to exceed the allocation of my underlying storage?"). Likewise, > on reporting, it is more useful to know the threshold of the backing > layer if the qcow2 protocol layer does not have a threshold. I'm > playing with that idea before submitting a v2. That is indeed what you need in your specific use case. However, qemu shouldn't try to guess what management tools really want. It should provide a clean interface that allows management tools to express themselves what they want. The cleanest interface that I can think of is that you access exactly the node whose name you specified. If we do any magic like going down the chain (which chain? What do you do with things like quorum in the path?), we make the interface inconsistent and if anyone really wants to know the highest offset that the guest accessed on its virtual disk, it wouldn't even be possible any more because we said that that's not what a management tool is interested in. Let's stay away from such magic, as much as we can. libvirt can just specify a node-name for the protocol layer and use that. Kevin --H+4ONPRPur6+Ovig Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJVd+3pAAoJEH8JsnLIjy/WqjsP/3tpSC5CITK5oKFWmqy/PW5o JdAA33/FfSetflLbAMOHWdQNoIU5wLkWFyxge1oXrPTTJjyxkAXbr9P2KCreYgB9 uz82dI0mb9QvzYi+/AypczHFNV9wFtHx4dKvh9PWeXoQhgIAOWoe847kh6A7Y46M KQNRZu9uSnj0Q7mHkmt1m8oUq2GXlXUgjmNrEDnwmAjn3N+FzD7OOas8+Wmpt0L8 C6qyHJLVTQTZmbEya1DpS21Lre+osugjH5UGy76g6O3lS2oYCL/wLLgtL8QD5oIW BdL4RzqnDcTa5lIQgsDXY0tD43nvoUwRkRNTUHhVDb7laLMQureb7lTYk8DnEFz6 bLHTdWUYoUvlJWGHrduAIEss9tWzsYofY8edXmXzILLwd5aL1Yj+fP0A47t7N+yL /zEkFt9QjqP1E0joVzKArOlIsPX8Z5r5D3zc1hMjtpgbBcOJx85yguemAt38Fp2T Kcvc/1hp+jODgeF7OWqR1C1e7/lYJtM0wxcLR7mKT1aRvopmtqYSVi5lqZUzQdkm v3daem9FhjDlOFm1r0ZMLHFrpSGwlWC3HcEK2jLB80S4tS+fQUlJv2WZ4ezmInGz vOOj0n23MEfU/Dj8BFgdL5LmJu+aCRVEUday5MDxEy7e3EFxrask12pSo2A2D/eU kfmzP+Hc4U9L6nwQkY8Y =sa5P -----END PGP SIGNATURE----- --H+4ONPRPur6+Ovig--