[Libguestfs] [PATCH] sparsify, v2v: use Common_utils.absolute_path
Richard W.M. Jones
rjones at redhat.com
Mon Aug 8 15:49:27 UTC 2016
On Mon, Aug 08, 2016 at 05:35:38PM +0200, Pino Toscano wrote:
> Use the common function for ensuring a path is absolute; it should not
> change the behaviour at all.
> ---
> sparsify/cmdline.ml | 6 +-----
> v2v/input_disk.ml | 4 +---
> v2v/input_ova.ml | 4 +---
> 3 files changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/sparsify/cmdline.ml b/sparsify/cmdline.ml
> index 3eb0d5b..523d612 100644
> --- a/sparsify/cmdline.ml
> +++ b/sparsify/cmdline.ml
> @@ -142,11 +142,7 @@ read the man page virt-sparsify(1).
> (* The input disk must be an absolute path, so we can store the name
> * in the overlay disk.
> *)
> - let indisk =
> - if not (Filename.is_relative indisk) then
> - indisk
> - else
> - Sys.getcwd () // indisk in
> + let indisk = absolute_path indisk in
>
> (* Check the output is not a char special (RHBZ#1056290). *)
> if is_char_device outdisk then
> diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml
> index d56c476..3926602 100644
> --- a/v2v/input_disk.ml
> +++ b/v2v/input_disk.ml
> @@ -63,9 +63,7 @@ class input_disk input_format disk = object
> error (f_"-i disk: invalid input filename (%s)") disk;
>
> (* Get the absolute path to the disk file. *)
> - let disk_absolute =
> - if not (Filename.is_relative disk) then disk
> - else Sys.getcwd () // disk in
> + let disk_absolute = absolute_path disk in
>
> (* The rest of virt-v2v doesn't actually work unless we detect
> * the format of the input, so:
> diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
> index 13c18b2..d86c637 100644
> --- a/v2v/input_ova.ml
> +++ b/v2v/input_ova.ml
> @@ -100,9 +100,7 @@ object
> ) in
>
> (* Exploded path must be absolute (RHBZ#1155121). *)
> - let exploded =
> - if not (Filename.is_relative exploded) then exploded
> - else Sys.getcwd () // exploded in
> + let exploded = absolute_path exploded in
>
> (* Find files in [dir] ending with [ext]. *)
> let find_files dir ext =
ACK.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
More information about the Libguestfs
mailing list