[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] qom: Allow object_property_add_child() to fail
From: |
Auger Eric |
Subject: |
Re: [PATCH] qom: Allow object_property_add_child() to fail |
Date: |
Wed, 24 Jun 2020 10:40:06 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 |
Hi Markus,
On 6/24/20 10:22 AM, Markus Armbruster wrote:
> Eric Auger <eric.auger@redhat.com> writes:
>
>> object_property_add() does not allow object_property_try_add()
>> to gracefully fail as &error_abort is passed as an error handle.
>>
>> However such failure can easily be triggered from the QMP shell when,
>> for instance, one attempts to create an object with an id that already
>> exists:
>>
>> For instance, call twice:
>> object-add qom-type=memory-backend-ram id=mem1 props.size=1073741824
>> and QEMU aborts.
>>
>> This behavior is undesired as a user/management application mistake
>> in reusing a property ID shouldn't result in loss of the VM and live
>> data within.
>>
>> This patch introduces two new functions, object_property_add_err() and
>> object_property_add_child_err() whose prototype features an error handle.
>> object_property_add_child_err() now gets called from user_creatable_add_type.
>> This solution was chosen instead of changing the prototype of existing
>> functions because the number of existing callers is huge.
>>
>> The error now is returned gracefully to the QMP client.
>>
>> (QEMU) object-add qom-type=memory-backend-ram id=mem2 props.size=4294967296
>> {"return": {}}
>> (QEMU) object-add qom-type=memory-backend-ram id=mem2 props.size=4294967296
>> {"error": {"class": "GenericError", "desc": "attempt to add duplicate
>> property
>> 'mem2' to object (type 'container')"}}
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
>
> Recent regression, my fault. Please point that out, and add
>
> Fixes: d2623129a7dec1d3041ad1221dda1ca49c667532
Thanks you for the reference. I will add the tag.
Eric
>
- [PATCH] qom: Allow object_property_add_child() to fail, Eric Auger, 2020/06/23
- Re: [PATCH] qom: Allow object_property_add_child() to fail, Daniel P . Berrangé, 2020/06/23
- Re: [PATCH] qom: Allow object_property_add_child() to fail, Paolo Bonzini, 2020/06/23
- Re: [PATCH] qom: Allow object_property_add_child() to fail, Paolo Bonzini, 2020/06/23
- Re: [PATCH] qom: Allow object_property_add_child() to fail, Paolo Bonzini, 2020/06/23
- Re: [PATCH] qom: Allow object_property_add_child() to fail, Markus Armbruster, 2020/06/24