From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoM9X-00080L-4J for qemu-devel@nongnu.org; Wed, 04 Dec 2013 18:46:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoM9Q-0005AH-NS for qemu-devel@nongnu.org; Wed, 04 Dec 2013 18:46:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:25034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoM9Q-00059z-Ey for qemu-devel@nongnu.org; Wed, 04 Dec 2013 18:46:40 -0500 Message-ID: <529FBEDA.9050409@redhat.com> Date: Wed, 04 Dec 2013 16:46:34 -0700 From: Eric Blake MIME-Version: 1.0 References: <1386077165-19577-1-git-send-email-benoit@irqsave.net> <1386077165-19577-4-git-send-email-benoit@irqsave.net> In-Reply-To: <1386077165-19577-4-git-send-email-benoit@irqsave.net> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hPhFLDBKWV3oAEdQ5Tbu1cvL29jgH63HF" Subject: Re: [Qemu-devel] [RFC V3 3/7] qapi: Add skeletton of command to query a drive bs graph. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?B?QmVub8OudCBDYW5ldA==?= , qemu-devel@nongnu.org Cc: kwolf@redhat.com, jcody@redhat.com, famz@redhat.com, armbru@redhat.com, stefanha@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --hPhFLDBKWV3oAEdQ5Tbu1cvL29jgH63HF Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 12/03/2013 06:26 AM, Beno=C3=AEt Canet wrote: In addition to Fam's review, s/skeletton/skeleton/ in subject > --- > blockdev.c | 8 ++++++++ > qapi-schema.json | 32 ++++++++++++++++++++++++++++++++ > 2 files changed, 40 insertions(+) >=20 > diff --git a/blockdev.c b/blockdev.c > index a474bb5..824e718 100644 > --- a/blockdev.c > +++ b/blockdev.c > @@ -1940,6 +1940,14 @@ void qmp_drive_backup(const char *device, const = char *target, > } > } > =20 > +BlockGraphNode * qmp_query_drive_graph(const char *device, Error **err= p) Style: no space after * > +{ > + /* the implementation of this function would recurse through the > + * BlockDriverState graph to build it's result > + */ > + return NULL; Shouldn't you set errp when returning failure? > +++ b/qapi-schema.json > @@ -2008,6 +2008,38 @@ > { 'command': 'drive-backup', 'data': 'DriveBackup' } > =20 > ## > +# @BlockGraphNode > +# > +# Information about a node of the block driver state graph > +# > +# @node-name: the name of the node in the graph > +# > +# @drv: the name of the block format used by this node as described in= > +# @BlockDeviceInfo. It would be nice if BlockDeviceInfo and BlockGraphNode used an enum rather than an open-coded string for this field. > +# > +# @children: a list of @BlockGraphNode being the children of this node= s/being/that are/ > +## > +# @query-drive-graph > +# > +# Get the block driver states graph for a given drive > +# > +# @device: the name of the device to get the graph from > +# > +# Returns: the root @BlockGraphNode > +# > +# Since 1.8 > +## > +{ 'command': 'query-drive-graph', > + 'data': { 'device': 'str' }, > + 'returns': 'BlockGraphNode' } Am I correct that it will be possible to have named nodes that are not currently associated with any device? If so, how do we learn about those nodes? Would it be better to have a command that returns an array of structs for all known node roots, with an optional member describing which device owns that node root? Something like: # Represent a root of a block graph # @root: a named node forming a root of a node graph # @device: #optional device name that owns this root { 'type': 'BlockGraphRoot', 'data': { 'root': 'BlockGraphNode', '*device': 'str' } } # @query_drive-graphs # Returns an array of all node graph roots { 'command': 'query-drive-graphs', 'returns': [ 'BlockGraphRoot' ] } possibly with 'data':{'*device':'str'} to allow filtering to just a 1-element array based on the device name (although I'm not sure if providing the complexity of filtering is worth it). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --hPhFLDBKWV3oAEdQ5Tbu1cvL29jgH63HF 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.4.15 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJSn77aAAoJEKeha0olJ0Nqi1gH/3MrT4rZoT4N/BvHpH6/gzhn ZkmWQNL4qTWAgGgbK3aRtAjvKIv6RxOfMzO3UOTCmbhelcq+SXpVoMwU4Bx7WpkA vbDm4EZ/Qv4ZpczI9TJysFiR2sgGYxfC4YdH3SsTlSRg1BBjeIvv5IkmQmyiIWka wgPWRpOAmIyn7mb3MoV1hBxB83xb6GqEp3uxt+EfQi3eMx1UNO59VnWZkB2gXGKg a0P8GIHHykrnr7SNRNRdds0CBtIOkwNqBI7GUbcjnB1NvI/6qEHSxg+1K9XZsQOv KynX8ijb7K2Q68BBtX8mPyQHMLm0j7vASdQD8TO67lEN4jjXtBmMQF76tD6ZCCU= =hwpH -----END PGP SIGNATURE----- --hPhFLDBKWV3oAEdQ5Tbu1cvL29jgH63HF--