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 a511004..6c5fe82 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -193,6 +193,34 @@ actions (drive options rerror, werror). ETEXI { + .name = "blockdev_child_add", + .args_type = "id:B,child:B", + .params = "parent child", + .help = "add a child to a BDS", + .mhandler.cmd = hmp_blockdev_child_add, + }, + +STEXI +@item blockdev_child_add @var{parent device} @var{child device} +@findex blockdev_child_add +Add a child to the block device. +ETEXI + + { + .name = "blockdev_child_del", + .args_type = "id:B,child:B", + .params = "parent child", + .help = "remove a child from a BDS", + .mhandler.cmd = hmp_blockdev_child_del, + }, + +STEXI +@item blockdev_child_del @var{parent device} @var{child device} +@findex blockdev_child_del +Remove a child from the parent device. +ETEXI + + { .name = "change", .args_type = "device:B,target:F,arg:s?", .params = "device filename [format]", diff --git a/hmp.c b/hmp.c index 3f807b7..1dc1bed 100644 --- a/hmp.c +++ b/hmp.c @@ -2325,3 +2325,23 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict) qapi_free_RockerOfDpaGroupList(list); } + +void hmp_blockdev_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_blockdev_child_add(id, child_id, &local_err); + hmp_handle_error(mon, &local_err); +} + +void hmp_blockdev_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_x_blockdev_child_del(id, child_id, &local_err); + hmp_handle_error(mon, &local_err); +} diff --git a/hmp.h b/hmp.h index 81656c3..3033648 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_blockdev_child_add(Monitor *mon, const QDict *qdict); +void hmp_blockdev_child_del(Monitor *mon, const QDict *qdict); #endif -- 2.4.3