[Libguestfs] [PATCH 1/4] v2v: -i ova: Use full path for backing file.

Richard W.M. Jones rjones at redhat.com
Mon Mar 13 14:47:42 UTC 2017


Works around a libvirt bug:
https://bugzilla.redhat.com/show_bug.cgi?id=1431652
---
 v2v/input_ova.ml                 | 6 +++++-
 v2v/test-v2v-i-ova-subfolders.sh | 2 +-
 v2v/test-v2v-i-ova-tar.sh        | 2 +-
 v2v/test-v2v-i-ova-two-disks.sh  | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index a0a42a7..fb6b286 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -284,6 +284,10 @@ object
              * tar also works with 512 byte blocks.
              *)
             let size = roundup64 size 512L in
+
+            (* Workaround for libvirt bug RHBZ#1431652. *)
+            let ova_path = absolute_path ova in
+
             let doc = [
                 "file", JSON.Dict [
                             "driver", JSON.String "raw";
@@ -291,7 +295,7 @@ object
                             "size", JSON.Int64 size;
                             "file", JSON.Dict [
                                         "driver", JSON.String "file";
-                                        "filename", JSON.String ova]
+                                        "filename", JSON.String ova_path]
                           ]
               ] in
             let uri =
diff --git a/v2v/test-v2v-i-ova-subfolders.sh b/v2v/test-v2v-i-ova-subfolders.sh
index 12e0e87..be98d2c 100755
--- a/v2v/test-v2v-i-ova-subfolders.sh
+++ b/v2v/test-v2v-i-ova-subfolders.sh
@@ -55,7 +55,7 @@ if grep -sq json: $d/source ; then
     # Normalize the output.
     # Remove directory prefix.
     # Exact offset will vary because of tar.
-    sed -i -e "s,\"$d/,\"," \
+    sed -i -e "s,\"[^\"]*/$d/,\"," \
            -e "s|\"offset\": [0-9]*,|\"offset\": x,|" $d/source
     diff -u test-v2v-i-ova-subfolders.expected2 $d/source
 else
diff --git a/v2v/test-v2v-i-ova-tar.sh b/v2v/test-v2v-i-ova-tar.sh
index 003d5e6..9458691 100755
--- a/v2v/test-v2v-i-ova-tar.sh
+++ b/v2v/test-v2v-i-ova-tar.sh
@@ -54,7 +54,7 @@ if grep -sq json: $d/source ; then
     # Normalize the output.
     # Remove directory prefix.
     # Exact offset will vary because of tar.
-    sed -i -e "s,\"$d/,\"," \
+    sed -i -e "s,\"[^\"]*/$d/,\"," \
            -e "s|\"offset\": [0-9]*,|\"offset\": x,|" $d/source
     diff -u test-v2v-i-ova-tar.expected2 $d/source
 else
diff --git a/v2v/test-v2v-i-ova-two-disks.sh b/v2v/test-v2v-i-ova-two-disks.sh
index 9ecc380..d5cca06 100755
--- a/v2v/test-v2v-i-ova-two-disks.sh
+++ b/v2v/test-v2v-i-ova-two-disks.sh
@@ -59,7 +59,7 @@ if grep -sq json: $d/source ; then
     # Normalize the output.
     # Remove directory prefix.
     # Exact offset will vary because of tar.
-    sed -i -e "s,\"$d/,\"," \
+    sed -i -e "s,\"[^\"]*/$d/,\"," \
            -e "s|\"offset\": [0-9]*,|\"offset\": x,|" $d/source
     diff -u test-v2v-i-ova-two-disks.expected2 $d/source
 else
-- 
2.9.3




More information about the Libguestfs mailing list