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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]