aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-02-01 23:32:23 +0000
committerPeter Maydell <peter.maydell@linaro.org>2014-02-01 23:32:31 +0000
commit2f61120c10da9128357510debc8e66880cd2bfdc (patch)
tree93a4c76654a011b7fcd93f1b35f00db9ae236145 /vl.c
parentb4a8c9ae9758efb6873097f415e9972127ccf418 (diff)
parent056f49ff2cf645dc484956b00b65a3aa18a1a9a3 (diff)
downloadqemu-2f61120c10da9128357510debc8e66880cd2bfdc.zip
qemu-2f61120c10da9128357510debc8e66880cd2bfdc.tar.gz
qemu-2f61120c10da9128357510debc8e66880cd2bfdc.tar.bz2
Merge remote-tracking branch 'qmp-unstable/queue/qmp' into staging
* qmp-unstable/queue/qmp: monitor: Cleanup mon->outbuf on write error virtio_rng: replace custom backend API with UserCreatable.complete() callback add optional 2nd stage initialization to -object/object-add commands vl.c: -object: don't ignore duplicate 'id' object_add: consolidate error handling Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index c73462e..383be1b 100644
--- a/vl.c
+++ b/vl.c
@@ -170,6 +170,7 @@ int main(int argc, char **argv)
#include "ui/qemu-spice.h"
#include "qapi/string-input-visitor.h"
+#include "qom/object_interfaces.h"
//#define DEBUG_NET
//#define DEBUG_SLIRP
@@ -2800,6 +2801,7 @@ static int object_create(QemuOpts *opts, void *opaque)
{
const char *type = qemu_opt_get(opts, "qom-type");
const char *id = qemu_opts_id(opts);
+ Error *local_err = NULL;
Object *obj;
g_assert(type != NULL);
@@ -2815,9 +2817,27 @@ static int object_create(QemuOpts *opts, void *opaque)
return -1;
}
+ if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {
+ error_setg(&local_err, "object '%s' isn't supported by -object",
+ 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, NULL);
+ id, obj, &local_err);
+
+out:
object_unref(obj);
+ if (local_err) {
+ qerror_report_err(local_err);
+ error_free(local_err);
+ return -1;
+ }
return 0;
}