qom: Fix regression with 'qom-type'
PATCH 1/1 qom: Fix regression with 'qom-type'
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().
--- qom/object_interfaces.c | 2 ++ 1 file changed, 2 insertions(+)
qom/object_interfaces.c +2 -0
@@ -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 ; }
@@ -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;
Signature · 1 line
2.9.3
Quoted 30 lines · Eric Blake
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 missingFix 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 <[email protected]>Signed-off-by Eric Blake <[email protected]>--- qom/object_interfaces.c | 2 ++ 1 file changed, 2 insertions(+)qom/object_interfaces.c +1
-0@@ -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 ; }
qom/object_interfaces.c Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) · line 141
Quoted 7 lines
qom/object_interfaces.c +1
-0@@ -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;
Thanks Eric. Yes, this fixes the problem I observed before with libguestfs.
Rich.
Signature · 5 lines
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Quoted 7 lines · Eric Blake
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
Shows that our test coverage is still inadequate. Also shows that I should do more manual testing myself. Sorry for the inconvenience!
Quoted 22 lines
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 <[email protected]>Signed-off-by Eric Blake <[email protected]>--- qom/object_interfaces.c | 2 ++ 1 file changed, 2 insertions(+)qom/object_interfaces.c +1
-0@@ -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 ; }
qom/object_interfaces.c Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) · line 141
Quoted 7 lines
qom/object_interfaces.c +1
-0@@ -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;
The awkwardness increases a bit more, but I don't have better ideas.
Peter, can you apply this as a build fix?
Quoted 45 lines · Markus Armbruster
Quoted 7 lines · Eric Blake
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 missingShows that our test coverage is still inadequate. Also shows that I should do more manual testing myself. Sorry for the inconvenience!
Quoted 22 lines
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 <[email protected]>Signed-off-by Eric Blake <[email protected]>--- qom/object_interfaces.c | 2 ++ 1 file changed, 2 insertions(+)qom/object_interfaces.c +1
-0@@ -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 ; }qom/object_interfaces.c Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) · line 141
Quoted 7 lines
qom/object_interfaces.c +1
-0@@ -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;The awkwardness increases a bit more, but I don't have better ideas.
Quoted 3 lines
Reviewed-by Markus Armbruster <[email protected]>Peter, can you apply this as a build fix?
Sure; applied to master.
-- PMM
Quoted 31 lines · Eric Blake
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 missingFix 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 <[email protected]>Signed-off-by Eric Blake <[email protected]>--- qom/object_interfaces.c | 2 ++ 1 file changed, 2 insertions(+)qom/object_interfaces.c +1
-0@@ -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 ; }
qom/object_interfaces.c Object *user_creatable_add_opts(QemuOpts *opts, Error **errp) · line 141
Quoted 7 lines
qom/object_interfaces.c +1
-0@@ -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;