[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH for-2.9] qom: Fix regression with 'qom-type'
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH for-2.9] qom: Fix regression with 'qom-type' |
Date: |
Thu, 23 Mar 2017 18:49:59 +0000 |
On 23 March 2017 at 16:24, Markus Armbruster <address@hidden> wrote:
> Eric Blake <address@hidden> writes:
>
>> 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!
>
>> 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 <address@hidden>
>> Signed-off-by: Eric Blake <address@hidden>
>> ---
>> qom/object_interfaces.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
>> index 9c271ad..d4253a8 100644
>> --- a/qom/object_interfaces.c
>> +++ b/qom/object_interfaces.c
>> @@ -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;
>
> The awkwardness increases a bit more, but I don't have better ideas.
>
> Reviewed-by: Markus Armbruster <address@hidden>
>
> Peter, can you apply this as a build fix?
Sure; applied to master.
-- PMM