monitor: add object-del (QMP) and object_del (HMP) command

These two commands invoke the "unparent" method of Object.

Signed-off-by: Paolo Bonzini <[email protected]>
Reviewed-by: Igor Mammedov <[email protected]>
Tested-by: Igor Mammedov <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 929550d..4d5e2b5 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1243,6 +1243,20 @@
 Remove host network device.
 ETEXI
 
+    {
+        .name       = "object_del",
+        .args_type  = "id:s",
+        .params     = "id",
+        .help       = "destroy QOM object",
+        .mhandler.cmd = hmp_object_del,
+    },
+
+STEXI
+@item object_del
+@findex object_del
+Destroy QOM object.
+ETEXI
+
 #ifdef CONFIG_SLIRP
     {
         .name       = "hostfwd_add",