[libvirt] [PATCH 08/15] util: Reduce complexity of virVHBAGetParent

Pavel Hrdina phrdina at redhat.com
Fri Feb 17 16:44:55 UTC 2017


On Wed, Jan 25, 2017 at 03:27:34PM -0500, John Ferlan wrote:
> Rather that getting the XML, parsing it, and grabbing the parent name
> field, just call the virNodeDeviceGetParent which is far more efficient.

ACK, this is unrelated to this series so you can push it as a fix for the
code in src/conf/storage_conf.c.

> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/util/virvhba.c | 8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/util/virvhba.c b/src/util/virvhba.c
> index 8c4da3a..2ad3520 100644
> --- a/src/util/virvhba.c
> +++ b/src/util/virvhba.c
> @@ -577,16 +577,10 @@ virVHBAGetParent(virConnectPtr conn,
>          goto cleanup;
>      }
>  
> -    if (!(xml = virNodeDeviceGetXMLDesc(device, 0)))
> -        goto cleanup;
> -
> -    if (!(def = virNodeDeviceDefParseString(xml, EXISTING_DEVICE, NULL)))
> -        goto cleanup;
> -
>      /* The caller checks whether the returned value is NULL or not
>       * before continuing
>       */
> -    ignore_value(VIR_STRDUP(vhba_parent, def->parent));
> +    ignore_value(VIR_STRDUP(vhba_parent, virNodeDeviceGetParent(device)));
>  
>   cleanup:
>      VIR_FREE(nodedev_name);
> -- 
> 2.7.4
> 
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170217/8a101375/attachment-0001.sig>


More information about the libvir-list mailing list