From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aipf3-0003E1-Me for qemu-devel@nongnu.org; Wed, 23 Mar 2016 16:45:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aipf2-0000w2-Oa for qemu-devel@nongnu.org; Wed, 23 Mar 2016 16:45:49 -0400 References: <56EB743E.8060500@cn.fujitsu.com> From: Max Reitz Message-ID: <56F30073.6090109@redhat.com> Date: Wed, 23 Mar 2016 21:45:39 +0100 MIME-Version: 1.0 In-Reply-To: <56EB743E.8060500@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5RQRH5U694GJEMd5lsmEpNdCeWheGasBi" Subject: Re: [Qemu-devel] [PATCH] quorum: add child name into filename List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , Alberto Garcia , "Dr. David Alan Gilbert" , Kevin Wolf , qemu-devel Cc: Changlong Xie , Qemu-block , Stefan Hajnoczi This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5RQRH5U694GJEMd5lsmEpNdCeWheGasBi Content-Type: multipart/mixed; boundary="PHKUEii5Qk7HSdoH9LmfwApNFWcfqiDwA" From: Max Reitz To: Wen Congyang , Alberto Garcia , "Dr. David Alan Gilbert" , Kevin Wolf , qemu-devel Cc: Changlong Xie , Stefan Hajnoczi , Qemu-block Message-ID: <56F30073.6090109@redhat.com> Subject: Re: [Qemu-devel] [PATCH] quorum: add child name into filename References: <56EB743E.8060500@cn.fujitsu.com> In-Reply-To: <56EB743E.8060500@cn.fujitsu.com> --PHKUEii5Qk7HSdoH9LmfwApNFWcfqiDwA Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 18.03.2016 04:21, Wen Congyang wrote: > The monitor command 'query-block' or 'info block' will output the filen= ame. > So we can get each children's child-name after this patch. This useful = for > dynamic reconfiguration. >=20 > Signed-off-by: Wen Congyang > --- > block/quorum.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) >=20 > diff --git a/block/quorum.c b/block/quorum.c > index da15465..182766a 100644 > --- a/block/quorum.c > +++ b/block/quorum.c > @@ -1036,9 +1036,13 @@ static void quorum_refresh_filename(BlockDriverS= tate *bs, QDict *options) > =20 > children =3D qlist_new(); > for (i =3D 0; i < s->num_children; i++) { > - QINCREF(s->children[i]->bs->full_open_options); > - qlist_append_obj(children, > - QOBJECT(s->children[i]->bs->full_open_options= )); > + QDict *child_opts; > + const char *child_name =3D s->children[i]->name; > + > + child_opts =3D qdict_clone_shallow(s->children[i]->bs->full_op= en_options); > + qdict_put_obj(child_opts, "child-name", > + QOBJECT(qstring_from_str(child_name))); > + qlist_append_obj(children, QOBJECT(child_opts)); This QDict is supposed to contain options for reconstructing the given BDS tree. The "child-name" option however is not a valid options for any BDS, and giving it will result in an error. One better place for this functionality would be to implement the bdrv_get_specific_info() function and define an ImageInfoQuorum QAPI object (which could contain an array of child information, with each such object in turn containing this child name). However, it appears to me that this is very general graph information and actually not related to quorum. So it probably makes sense to instead introduce a QMP command for querying the BDS graph (or the tree starting at a user-specified node/backend). I think it would be sufficient to just emit the node names (because every BDS has a node name now), like so: (Note: This is just a rough idea, maybe it's actually a horrible idea) { 'execute': 'query-block-node-tree', 'arguments': { 'root': 'drive0' } } { 'return': { 'node-name': 'qcow2-node', 'children': { 'file': { 'node-name': 'quorum-node', 'children': { 'children.0': { 'node-name': 'file-node' }, 'children.1': { 'node-name': 'nbd-node' } } } } } } Maybe we have something that can provide this exact functionality already and I'm just oblivious to it, though. Max > } > =20 > opts =3D qdict_new(); >=20 --PHKUEii5Qk7HSdoH9LmfwApNFWcfqiDwA-- --5RQRH5U694GJEMd5lsmEpNdCeWheGasBi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJW8wBzAAoJEDuxQgLoOKythH0H/RAmZjZ548CH/DLbc2XrS0U1 Er/2Mm2PyRYmc/0ysM0BYYJUemzvq4s3yRtcgmXSLlOaQgEDtCEs7Dim75ljDI8/ uuCXOx9QFFxYVnV16dNhbMulwErKCdZD1W2pzOSW2Upr5z1FOTULhZPMdRrnIFyf enO2yUJeTwODATfNarffJV4gC5HhrHEDpqL8tKMWNeDb3EEBo3l2D6AqQKuU7V7W 2PqgU9rbSuNDXYfb5bDyctYyrwoYVwC/ofRM5zp4kS5ImZctBfa757OqMNwEgcSN szl+QTvjb3E7At5oNuFa4PlPi2n24p1yayc8kbPzr0AOmyYs5Yi4cz50Al3Z3rU= =6+Oc -----END PGP SIGNATURE----- --5RQRH5U694GJEMd5lsmEpNdCeWheGasBi--