[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Patch for-2.5 v2 3/6] Add new block driver interface t
From: |
Wen Congyang |
Subject: |
Re: [Qemu-block] [Patch for-2.5 v2 3/6] Add new block driver interface to add/delete a BDS's child |
Date: |
Tue, 1 Sep 2015 11:06:15 +0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 09/01/2015 01:40 AM, Eric Blake wrote:
> 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.
>>
>> Signed-off-by: Wen Congyang <address@hidden>
>> Signed-off-by: zhanghailiang <address@hidden>
>> Signed-off-by: Gonglei <address@hidden>
>> Reviewed-by: Alberto Garcia <address@hidden>
>> ---
>> block.c | 43 +++++++++++++++++++++++++++++++++++++++++++
>> include/block/block.h | 4 ++++
>> include/block/block_int.h | 5 +++++
>> 3 files changed, 52 insertions(+)
>>
>
>> + * 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.
>
bs is parent, and the child is options, and will be opened by the parent.
So there is no need to check it.
Thanks
Wen Congyang
- [Qemu-block] [Patch for-2.5 v2 0/6] qapi: child add/delete support, Wen Congyang, 2015/08/11
- [Qemu-block] [Patch for-2.5 v2 2/6] support nbd driver in blockdev-add, Wen Congyang, 2015/08/11
- [Qemu-block] [Patch for-2.5 v2 3/6] Add new block driver interface to add/delete a BDS's child, Wen Congyang, 2015/08/11
- [Qemu-block] [Patch for-2.5 v2 6/6] hmp: add monitor command to add/remove a child, Wen Congyang, 2015/08/11
- [Qemu-block] [Patch for-2.5 v2 5/6] qmp: add monitor command to add/remove a child, Wen Congyang, 2015/08/11
- [Qemu-block] [Patch for-2.5 v2 1/6] QAPI: move InetSocketAddress to qapi/common.json, Wen Congyang, 2015/08/11
- [Qemu-block] [Patch for-2.5 v2 4/6] quorum: implement bdrv_add_child() and bdrv_del_child(), Wen Congyang, 2015/08/11