[Libguestfs] [PATCH 1/2] Allow absolute paths in virt-v2v.conf

Matthew Booth mbooth at redhat.com
Mon Aug 16 13:39:48 UTC 2010


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;
-- 
1.7.2.1




More information about the Libguestfs mailing list