Skip to content

Commit

Permalink
qom: Fix regression with 'qom-type'
Browse files Browse the repository at this point in the history
Commit 9a6d1ac assumed that 'qom-type' could be removed from QemuOpts
with no ill effects.  However, this command line proves otherwise:

$ ./x86_64-softmmu/qemu-system-x86_64 -nodefaults -nographic -qmp stdio \
  -object rng-random,filename=/dev/urandom,id=rng0 \
  -device virtio-rng-pci,rng=rng0
qemu-system-x86_64: -object rng-random,filename=/dev/urandom,id=rng0: Parameter 'qom-type' is missing

Fix the regression by restoring qom-type in opts after its temporary
removal that was needed for the duration of user_creatable_add_opts().

Reported-by: Richard W. M. Jones <rjones@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Richard W.M. Jones <rjones@redhat.com>
Message-id: 20170323160315.19696-1-eblake@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
ebblake authored and pm215 committed Mar 23, 2017
1 parent c50126a commit 0832970
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions qom/object_interfaces.c
Expand Up @@ -122,6 +122,7 @@ Object *user_creatable_add_opts(QemuOpts *opts, Error **errp)
}
if (!id) {
error_setg(errp, QERR_MISSING_PARAMETER, "id");
qemu_opt_set(opts, "qom-type", type, &error_abort);
g_free(type);
return NULL;
}
Expand All @@ -134,6 +135,7 @@ Object *user_creatable_add_opts(QemuOpts *opts, Error **errp)
visit_free(v);

qemu_opts_set_id(opts, (char *) id);
qemu_opt_set(opts, "qom-type", type, &error_abort);
g_free(type);
QDECREF(pdict);
return obj;
Expand Down

0 comments on commit 0832970

Please sign in to comment.