diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-02-01 23:32:23 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-02-01 23:32:31 +0000 |
commit | 2f61120c10da9128357510debc8e66880cd2bfdc (patch) | |
tree | 93a4c76654a011b7fcd93f1b35f00db9ae236145 /vl.c | |
parent | b4a8c9ae9758efb6873097f415e9972127ccf418 (diff) | |
parent | 056f49ff2cf645dc484956b00b65a3aa18a1a9a3 (diff) | |
download | qemu-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.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -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; } |