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 <we...@cn.fujitsu.com>
>> Signed-off-by: zhanghailiang <zhang.zhanghaili...@huawei.com>
>> Signed-off-by: Gonglei <arei.gong...@huawei.com>
>> Reviewed-by: Alberto Garcia <be...@igalia.com>
>> ---
>>  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.
> 

hot-added BDS is a new BDS, but it is OK to check it here. I will update it
in the next version.

Thanks
Wen Congyang

Reply via email to