@@ -1069,6 +1069,26 @@ static int do_plug_create(Monitor *mon, const QDict *qdict, QObject **ret_data)
return 0;
}
+static int do_plug_destroy(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ const char *id = qdict_get_str(qdict, "id");
+ TypeInstance *inst;
+ Plug *plug;
+
+ inst = type_find_by_id(id);
+ if (inst == NULL) {
+ return -1;
+ }
+
+ plug = PLUG(inst);
+
+ global_plug_list = g_slist_remove(global_plug_list, plug);
+
+ type_delete(inst);
+
+ return 0;
+}
+
static int do_plug_list(Monitor *mon, const QDict *qdict, QObject **ret_data)
{
QList *qlist = qlist_new();
@@ -112,6 +112,15 @@ Notes:
EQMP
{
+ .name = "plug_destroy",
+ .args_type = "type:s",
+ .params = "type=value",
+ .help = "destroy a plug",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_plug_destroy,
+ },
+
+ {
.name = "plug_list",
.args_type = "type:s?",
.params = "",
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> --- monitor.c | 20 ++++++++++++++++++++ qmp-commands.hx | 9 +++++++++ 2 files changed, 29 insertions(+), 0 deletions(-)