aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/qmp.c b/qmp.c
index a67e0c4539..d0d98e777b 100644
--- a/qmp.c
+++ b/qmp.c
@@ -27,6 +27,7 @@
#include "qapi/qmp/qobject.h"
#include "qapi/qmp-input-visitor.h"
#include "hw/boards.h"
+#include "qom/object_interfaces.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -554,6 +555,17 @@ void object_add(const char *type, const char *id, const QDict *qdict,
}
}
+ if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {
+ error_setg(&local_err, "object '%s' isn't supported by object-add",
+ id);
+ goto out;
+ }
+
+ user_creatable_complete(obj, &local_err);
+ if (local_err) {
+ goto out;
+ }
+
object_property_add_child(container_get(object_get_root(), "/objects"),
id, obj, &local_err);
out: