On 18.07.2016 18:13, Eric Blake wrote:
> On 07/18/2016 07:38 AM, Max Reitz wrote:
>> On 14.07.2016 15:28, Kevin Wolf wrote:
>>> In order to remove the necessity to use BlockBackend names in the
>>> external API, we want to allow node-names everywhere. This converts
>>> block-commit to accept a node-name without lifting the restriction that
>>> we're operating at a root node.
>>>
>>> As libvirt makes use of the DeviceNotFound error class, we must add
>>> explicit code to retain this behaviour because qmp_get_root_bs() only
>>> returns GenericErrors.
>>>
> 
>>> @@ -3113,22 +3112,22 @@ void qmp_block_commit(bool has_job_id, const char 
>>> *job_id, const char *device,
>>>       *  live commit feature versions; for this to work, we must make sure 
>>> to
>>>       *  perform the device lookup before any generic errors that may occur 
>>> in a
>>>       *  scenario in which all optional arguments are omitted. */
> 
> Isn't this the [tail end of the] comment...
> 
>>> -    blk = blk_by_name(device);
>>> -    if (!blk) {
>>> -        error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
>>> -                  "Device '%s' not found", device);
>>> +    bs = qmp_get_root_bs(device, &local_err);
>>> +    if (!bs) {
>>> +        bs = bdrv_lookup_bs(device, device, NULL);
>>> +        if (!bs) {
>>> +            error_free(local_err);
>>> +            error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
>>> +                      "Device '%s' not found", device);
>>> +        } else {
>>> +            error_propagate(errp, local_err);
>>> +        }
>>
>> I would have liked a comment here why this code exists; including an
>> explanation what libvirt uses DeviceNotFound for (i.e. for probing
>> whether qemu supports active commit).
> 
> ...you are wanting?

Hm! Indeed it is. No complaints left for this patch, then.

Max

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to