@@ -4,6 +4,7 @@
#include "qemu/module.h"
#include "qapi-visit.h"
#include "qapi/opts-visitor.h"
+#include "qemu/config-file.h"
void user_creatable_complete(Object *obj, Error **errp)
{
@@ -181,6 +182,14 @@ void user_creatable_del(const char *id, Error **errp)
error_setg(errp, "object '%s' is in use, can not be deleted", id);
return;
}
+
+ /*
+ * if object was defined on the command-line, remove its corresponding
+ * option group entry
+ */
+ qemu_opts_del(qemu_opts_find(qemu_find_opts_err("object", &error_abort),
+ id));
+
object_unparent(obj);
}
@@ -437,9 +437,9 @@ static void test_dummy_createcmdl(void)
* check for this in user_creatable_del() and remove the QemuOpts if
* it is present.
*
- * FIXME: add an assert to verify that the QemuOpts is cleaned up
- * once the corresponding cleanup code is added.
+ * The below check ensures this works as expected.
*/
+ g_assert_null(qemu_opts_find(&qemu_object_opts, "dev0"));
}
static void test_dummy_badenum(void)