[libvirt] [PATCH 23/23] qemu: block: Add code to detect node names when necessary

Peter Krempa pkrempa at redhat.com
Fri Mar 24 14:49:21 UTC 2017


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170324/6c959a56/attachment-0001.sig>


More information about the libvir-list mailing list