From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWT4C-0003yv-8T for qemu-devel@nongnu.org; Mon, 31 Aug 2015 13:40:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWT4B-0001uk-6t for qemu-devel@nongnu.org; Mon, 31 Aug 2015 13:40:24 -0400 References: <1439279489-13338-1-git-send-email-wency@cn.fujitsu.com> <1439279489-13338-4-git-send-email-wency@cn.fujitsu.com> From: Eric Blake Message-ID: <55E4917A.9010703@redhat.com> Date: Mon, 31 Aug 2015 11:40:10 -0600 MIME-Version: 1.0 In-Reply-To: <1439279489-13338-4-git-send-email-wency@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="R4V0n74fdBUdvh80mbUNNN9aCrdsWbCSK" Subject: Re: [Qemu-devel] [Patch for-2.5 v2 3/6] Add new block driver interface to add/delete a BDS's 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) --R4V0n74fdBUdvh80mbUNNN9aCrdsWbCSK Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/11/2015 01:51 AM, Wen Congyang wrote: > In some cases, we want to take a quorum child offline, and take > another child online. >=20 > Signed-off-by: Wen Congyang > Signed-off-by: zhanghailiang > Signed-off-by: Gonglei > Reviewed-by: Alberto Garcia > --- > block.c | 43 +++++++++++++++++++++++++++++++++++++++= ++++ > include/block/block.h | 4 ++++ > include/block/block_int.h | 5 +++++ > 3 files changed, 52 insertions(+) >=20 > + * Hot add/remove a BDS's child. So the user can take a child offline = when > + * it is broken and take a new child online > + */ > +void bdrv_add_child(BlockDriverState *bs, QDict *options, Error **errp= ) > +{ > + > + if (!bs->drv || !bs->drv->bdrv_add_child) { > + error_setg(errp, "The BDS %s doesn't support adding a child", > + bdrv_get_device_or_node_name(bs)); > + return; > + } > + > + bs->drv->bdrv_add_child(bs, options, errp); Should this also check that bs is not already a child of something? Or a bit looser, we may want to allow a BDS to be a child of multiple trees (a common shared backing file), but we still definitely don't want to allow nonsensical loops such as trying to make a BDS be hot-added as its own child. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --R4V0n74fdBUdvh80mbUNNN9aCrdsWbCSK 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/ iQEcBAEBCAAGBQJV5JF6AAoJEKeha0olJ0NqbZQH/A7Dd5zXF4+1NgM5pYXTwqvg 0JaQYeTX8OSlVKiuuGbUVJigq+/vGa6sBUINgBqP+pyAw3onsJoOa+hRX4o9LZ7X M4XG134E2IsdQGcv+Br70Gci7XU7v3iBTUEhgXKHzpYATVyg8vGjK1eApluB284j OLzMaCA3DdqA0Z8VmFZ0eK41N6g16hCvOnO2T5Ymj98qh4pjKOhJZxUDUK0kpEu/ 67PXVJ2uyArGWl5+LNRGcSGGuAPHQHcv2rDqWtjXsaTk5+yVb0IlNHIC2A+4/is1 XH0wQ9azu+OUr3Jj0G32HYV6iCYzmORJPl96Apg9NIAHzSyYGYaEnv33N/mdxbQ= =fNWl -----END PGP SIGNATURE----- --R4V0n74fdBUdvh80mbUNNN9aCrdsWbCSK--