From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41023) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWUNh-0000M1-1D for qemu-devel@nongnu.org; Mon, 31 Aug 2015 15:04:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWUNf-0008KY-J2 for qemu-devel@nongnu.org; Mon, 31 Aug 2015 15:04:36 -0400 References: <1439279489-13338-1-git-send-email-wency@cn.fujitsu.com> <1439279489-13338-6-git-send-email-wency@cn.fujitsu.com> From: Eric Blake Message-ID: <55E4A536.6040905@redhat.com> Date: Mon, 31 Aug 2015 13:04:22 -0600 MIME-Version: 1.0 In-Reply-To: <1439279489-13338-6-git-send-email-wency@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="vsiXDbSpQDl8BDHsWOpBDjnR0b2BCj8mH" Subject: Re: [Qemu-devel] [Patch for-2.5 v2 5/6] qmp: add monitor command to add/remove a child List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , qemu devel , Markus Armbruster , Alberto Garcia , Stefan Hajnoczi Cc: Kevin Wolf , zhanghailiang , qemu block , Jiang Yunhong , Dong Eddie , "Dr. David Alan Gilbert" , Gonglei , Yang Hongyang This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vsiXDbSpQDl8BDHsWOpBDjnR0b2BCj8mH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/11/2015 01:51 AM, Wen Congyang wrote: > Signed-off-by: Wen Congyang > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > --- > blockdev.c | 79 ++++++++++++++++++++++++++++++++++++++++++++= ++++++++ > qapi/block-core.json | 40 ++++++++++++++++++++++++++ > qmp-commands.hx | 67 ++++++++++++++++++++++++++++++++++++++++++++= > 3 files changed, 186 insertions(+) >=20 > +void qmp_child_add(const char *device, BlockdevOptionsChild *options, > + Error **errp) > +{ > + QmpOutputVisitor *ov =3D qmp_output_visitor_new(); > + QObject *obj; > + QDict *qdict; > + Error *local_err =3D NULL; > + > + if (options->child->has_id || options->child->has_discard || > + options->child->has_cache || options->child->has_aio || > + options->child->has_rerror || options->child->has_werror || > + options->child->has_read_only || options->child->has_detect_ze= roes) { > + error_setg(errp, "id, discard, cache, aio, rerror, werror, rea= donly" > + " and detect_zeroes cann't be used for child-add");= s/cann't/can't/ If they can't be used, then why not write the qapi so that they can't even be provided? On the other hand, why can't they be used? Can't you specify some of these options separately for different quorum children when first creating a quorum, in which case you'd want to be able to do likewise when adding a new member to the quorum? > +++ b/qapi/block-core.json > @@ -2122,3 +2122,43 @@ > ## > { 'command': 'block-set-write-threshold', > 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } } > + > +## > +# @BlockdevOptionsChild > +# > +# Driver specific block device options for child block device. > +# > +# Since: 2.5 > +## > +{ 'struct': 'BlockdevOptionsChild', > + 'data': { 'child': 'BlockdevOptions' } } Do you need this struct? It causes extra nesting on the wire... > + > +## > +# @child-add > +# > +# Add a new child to the parent BDS. Currently only the Quorum driver > +# implements this feature. This is useful to fix a broken quorum child= =2E > +# > +# @device: graph node name or id which the child will be added to. > +# > +# @options: the options to create child BDS. > +# > +# Since: 2.5 > +## > +{ 'command': 'child-add', > + 'data' : { 'device': 'str', 'options': 'BlockdevOptionsChild' } } =2E..Consider if you just did: { 'command': 'child-add', 'data': { 'device', 'str', 'child': 'BlockdevOptions' } } >=20 > + > +## > +# @child-del > +# > +# Remove a child from the parent BDS. Currently only the Quorum driver= > +# implements this feature. This is useful to fix a broken quorum child= =2E Might also be worth mentioning that you can't remove a child if it would bring the quorum below its threshold. > +++ b/qmp-commands.hx > +Add a child to a quorum node. > + > +This command is still a work in progress. It doesn't support all > +block drivers. Stay away from it unless you want it to help with > +its development. Maybe we should name it 'x-child-add' for now, so that we aren't baking ourselves into a corner. > + > +Arguments: > + > +- "device": the quorum's id or node name > +- "options": the new child options > + > +Example: > + > +-> { "execute": "child-add", > + "arguments": { > + "device": "disk1", > + "options" : { > + "child": { =2E..the simper command idea above would reduce one layer of {} nesting h= ere. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --vsiXDbSpQDl8BDHsWOpBDjnR0b2BCj8mH 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 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV5KU2AAoJEKeha0olJ0NqANAIAKD8qlh4LGr7Qg/lmqfiLsfr FxLP3gls61+B3Oe4SbeFXxG7YHmmuvMLv+AI27yZxXwAb0TvUBGfFtt8NFPu+7s/ CRxV84UZ4xjOivkyDqIjqdKqivPCvG0OE0+B9MnvmFz/Chh3IHNRga4iNVc4RKtz H2ieh/9top9mn91KhbePn9KEtfb3YEzgN4C8M0SWrAiiOXJQMFDAM+dHNhD+y5Vz obIWdBwrtsPR5q/hZbL+28zwzKmSGRyRuzYC/Gt9aRNCr9oG8VUk1RPYK4eQTaMe k7DziMlKpab0aPLqZgtG2kXk2Al95toy+G4zvnlFi+Ew+xj92NzFr/qao+U7ZNk= =rIWs -----END PGP SIGNATURE----- --vsiXDbSpQDl8BDHsWOpBDjnR0b2BCj8mH--