[Libguestfs] [PATCH 1/2] Allow absolute paths in virt-v2v.conf
Richard W.M. Jones
rjones at redhat.com
Mon Aug 16 14:12:47 UTC 2010
On Mon, Aug 16, 2010 at 02:39:48PM +0100, Matthew Booth wrote:
> This patch allows paths in virt-v2v.conf to be either relative or absolute. If
> relative, they are relative to software-root.
>
> This allows virt-v2v.conf to use files provided by packages independent of
> virt-v2v.
> ---
> lib/Sys/VirtV2V/Config.pm | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/lib/Sys/VirtV2V/Config.pm b/lib/Sys/VirtV2V/Config.pm
> index f703152..121e774 100644
> --- a/lib/Sys/VirtV2V/Config.pm
> +++ b/lib/Sys/VirtV2V/Config.pm
> @@ -118,14 +118,16 @@ sub get_transfer_iso
> foreach my $path ($dom->findnodes('/virt-v2v/app/path/text()')) {
> $path = $path->getData();
>
> - # Get the absolute path if iso-root was defined
> my $abs;
> - if (defined($root)) {
> - $abs = File::Spec->catfile($root, $path);
> - } else {
> + if (File::Spec->file_name_is_absolute($path) || !defined($root)) {
> $abs = $path;
> }
>
> + # Make relative paths relative to iso-root if it was defined
> + else {
> + $abs = File::Spec->catfile($root, $path);
> + }
> +
> if (-r $abs) {
> $path_args{"$path=$abs"} = 1;
> $paths{$abs} = 1;
ACK, seems reasonable.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines. Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v
More information about the Libguestfs
mailing list