On Fri, Mar 24, 2017 at 09:03:28 -0500, Eric Blake wrote:
On 03/15/2017 11:37 AM, Peter Krempa wrote:
> Detect the node names when setting block threshold and when reconnecting
> or when they are cleared when a block job finishes. This operation will
> become a no-op once we fully support node names.
> ---
> src/qemu/qemu_block.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++
> src/qemu/qemu_block.h | 4 ++
> src/qemu/qemu_blockjob.c | 2 +
> src/qemu/qemu_driver.c | 5 +++
> src/qemu/qemu_process.c | 4 ++
> 5 files changed, 113 insertions(+)
>
> +
> +static int
> +qemuBlockDiskDetectNodes(virDomainDiskDefPtr disk,
> + const char *parentnode,
> + virHashTablePtr table)
> +{
> + qemuBlockNodeNameBackingChainDataPtr entry = NULL;
> + virStorageSourcePtr src = disk->src;
> +
> + /* don't attempt the detection if the top level already has node names */
> + if (!parentnode || src->nodeformat || src->nodebacking)
Should that be
if (!parentnode && (src->nodeformat || src->nodebacking))
to match the comment? As written, it looks like it short-circuits every
node that already has a node name, not just the parent node.
It's probably slightly misworded. If parentnode is NULL at this point we
did not find the nodename of the top level, so detection doesn't make
sense.
The comment is relevant for the other two conditions which stop the
detection if the parent of the disk already has a node name
assigned/detected, so the logic should be good as is.