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? -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature