[libvirt] [PATCHv2 4/6] Use virGetUninstalledDir() in src/storage/storage_backend_disk.c

Daniel P. Berrange berrange at redhat.com
Thu Apr 24 13:51:37 UTC 2014


On Tue, Mar 25, 2014 at 01:53:14PM +0530, Nehal J Wani wrote:
> src/storage/storage_backend_disk.c:
>    *Check if libvirtd is running uninstalled from a build tree and change
>     parthelper_path accordingly
> 
> ---
>  src/storage/storage_backend_disk.c |   28 ++++++++++++++++++++++++++--
>  1 files changed, 26 insertions(+), 2 deletions(-)
> 
> diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
> index 81201fd..bb29d39 100644
> --- a/src/storage/storage_backend_disk.c
> +++ b/src/storage/storage_backend_disk.c
> @@ -261,7 +261,18 @@ virStorageBackendDiskReadPartitions(virStoragePoolObjPtr pool,
>       * -              normal   metadata 100027630080 100030242304      2612736
>       *
>       */
> -    virCommandPtr cmd = virCommandNewArgList(PARTHELPER,
> +
> +    char *uninstalledDir = virGetUninstalledDir();
> +    char *parthelper_path = NULL;
> +
> +    if (uninstalledDir && virAsprintf(&parthelper_path,
> +                                      "%s/../../src/libvirt_parthelper",
> +                                      uninstalledDir) < 0)
> +        return -1;
> +    else if (virAsprintf(&parthelper_path, PARTHELPER) < 0)
> +        return -1;
> +
> +    virCommandPtr cmd = virCommandNewArgList(parthelper_path,

Hmm, it getting rather ugly & tedious to repeat this logic every
place we need it.

I think we need another helper API really

   virFileFindBinary(const char *srcdir,
                     const char *bindir,
                     const char *binaryname);

which we'd call thus

    path = virFileFindBinary("../../src", LIBEXECDIR, "libvirt_parthelper")

I think I will re-write this series todo that and re-post

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list