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> Cc: Luiz Capitulino <lcapitul...@redhat.com> --- hmp-commands.hx | 28 ++++++++++++++++++++++++++++ hmp.c | 20 ++++++++++++++++++++ hmp.h | 2 ++ 3 files changed, 50 insertions(+)
diff --git a/hmp-commands.hx b/hmp-commands.hx index fece64f..bd365bb 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -193,6 +193,34 @@ actions (drive options rerror, werror). ETEXI { + .name = "child_add", + .args_type = "id:B,child:B", + .params = "parent child", + .help = "add a child to a BDS", + .mhandler.cmd = hmp_child_add, + }, + +STEXI +@item child_add @var{parent device} @var{child device} +@findex child_add +Add a child to the block device. +ETEXI + + { + .name = "child_del", + .args_type = "id:B,child:B", + .params = "parent child", + .help = "remove a child from a BDS", + .mhandler.cmd = hmp_child_del, + }, + +STEXI +@item child_del @var{parent device} @var{child device} +@findex child_del +Remove a child from the parent device. +ETEXI + + { .name = "change", .args_type = "device:B,target:F,arg:s?,read-only-mode:s?", .params = "device filename [format [read-only-mode]]", diff --git a/hmp.c b/hmp.c index 6e2bbc8..0d6f6c9 100644 --- a/hmp.c +++ b/hmp.c @@ -2348,3 +2348,23 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict) qapi_free_RockerOfDpaGroupList(list); } + +void hmp_child_add(Monitor *mon, const QDict *qdict) +{ + const char *id = qdict_get_str(qdict, "id"); + const char *child_id = qdict_get_str(qdict, "child"); + Error *local_err = NULL; + + qmp_x_child_add(id, child_id, &local_err); + hmp_handle_error(mon, &local_err); +} + +void hmp_child_del(Monitor *mon, const QDict *qdict) +{ + const char *id = qdict_get_str(qdict, "id"); + const char *child_id = qdict_get_str(qdict, "child"); + Error *local_err = NULL; + + qmp_child_del(id, child_id, &local_err); + hmp_handle_error(mon, &local_err); +} diff --git a/hmp.h b/hmp.h index 81656c3..5bd780c 100644 --- a/hmp.h +++ b/hmp.h @@ -130,5 +130,7 @@ void hmp_rocker(Monitor *mon, const QDict *qdict); void hmp_rocker_ports(Monitor *mon, const QDict *qdict); void hmp_rocker_of_dpa_flows(Monitor *mon, const QDict *qdict); void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict); +void hmp_child_add(Monitor *mon, const QDict *qdict); +void hmp_child_del(Monitor *mon, const QDict *qdict); #endif -- 2.4.3