Blame SOURCES/0004-RHEL-Fixes-for-libguestfs-winsupport.patch

fda521
From f7ed42f475271291d126084cb92157974ea274c6 Mon Sep 17 00:00:00 2001
c232e6
From: "Richard W.M. Jones" <rjones@redhat.com>
c232e6
Date: Sun, 30 Aug 2015 03:21:57 -0400
3156cb
Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport.
c232e6
3156cb
In tests we cannot use guestfish for arbitrary Windows edits.
3156cb
In virt-v2v helpers we must set the program name to virt-v2v.
c232e6
---
3156cb
 convert/convert.ml                         | 1 +
3156cb
 convert/windows_virtio.ml                  | 1 +
c232e6
 test-data/phony-guests/make-windows-img.sh | 1 +
c232e6
 tests/test-v2v-virtio-win-iso.sh           | 8 +++++++-
c232e6
 tests/test-v2v-windows-conversion.sh       | 8 +++++++-
3156cb
 5 files changed, 17 insertions(+), 2 deletions(-)
c232e6
3156cb
diff --git a/convert/convert.ml b/convert/convert.ml
fda521
index 87fca725..5e0e6c2b 100644
3156cb
--- a/convert/convert.ml
3156cb
+++ b/convert/convert.ml
fda521
@@ -51,6 +51,7 @@ let rec convert dir options source =
3156cb
 
3156cb
   message (f_"Opening the source");
3156cb
   let g = open_guestfs ~identifier:"v2v" () in
3156cb
+  g#set_program "virt-v2v";
3156cb
   g#set_memsize (g#get_memsize () * 2);
3156cb
   (* Setting the number of vCPUs allows parallel mkinitrd, but make
3156cb
    * sure this is not too large because each vCPU consumes guest RAM.
3156cb
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
fda521
index 5254322c..301f7544 100644
3156cb
--- a/convert/windows_virtio.ml
3156cb
+++ b/convert/windows_virtio.ml
3156cb
@@ -283,6 +283,7 @@ and copy_from_virtio_win g inspect srcdir destdir filter missing =
3156cb
     let g2 =
3156cb
       try
3156cb
         let g2 = open_guestfs ~identifier:"virtio_win" () in
3156cb
+        g#set_program "virt-v2v";
3156cb
         g2#add_drive_opts virtio_win ~readonly:true;
3156cb
         g2#launch ();
3156cb
         g2
c232e6
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
c232e6
index 30908a91..73cf5144 100755
c232e6
--- a/test-data/phony-guests/make-windows-img.sh
c232e6
+++ b/test-data/phony-guests/make-windows-img.sh
c232e6
@@ -37,6 +37,7 @@ fi
c232e6
 
c232e6
 # Create a disk image.
c232e6
 guestfish <
c232e6
+set-program virt-testing
c232e6
 sparse windows.img-t 512M
c232e6
 run
c232e6
 
c232e6
diff --git a/tests/test-v2v-virtio-win-iso.sh b/tests/test-v2v-virtio-win-iso.sh
c232e6
index 69f6f414..b9b806fb 100755
c232e6
--- a/tests/test-v2v-virtio-win-iso.sh
c232e6
+++ b/tests/test-v2v-virtio-win-iso.sh
c232e6
@@ -82,6 +82,12 @@ mktest ()
c232e6
 :> "$script"
c232e6
 :> "$expected"
c232e6
 
c232e6
+cat >> "$script" <
c232e6
+  set-program virt-testing
c232e6
+  run
c232e6
+  mount /dev/sda2 /
c232e6
+EOF
c232e6
+
c232e6
 firstboot_dir="/Program Files/Guestfs/Firstboot"
c232e6
 mktest "is-dir \"$firstboot_dir\"" true
c232e6
 mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
c232e6
@@ -94,5 +100,5 @@ for drv in netkvm vioscsi viostor; do
c232e6
     done
c232e6
 done
c232e6
 
c232e6
-guestfish --ro -a "$d/windows-sda" -i < "$script" > "$response"
c232e6
+guestfish --ro -a "$d/windows-sda" < "$script" > "$response"
c232e6
 diff -u "$expected" "$response"
c232e6
diff --git a/tests/test-v2v-windows-conversion.sh b/tests/test-v2v-windows-conversion.sh
3156cb
index a4cf191d..1ff41f6a 100755
c232e6
--- a/tests/test-v2v-windows-conversion.sh
c232e6
+++ b/tests/test-v2v-windows-conversion.sh
c232e6
@@ -76,6 +76,12 @@ mktest ()
c232e6
 :> "$script"
c232e6
 :> "$expected"
c232e6
 
c232e6
+cat >> "$script" <
c232e6
+  set-program virt-testing
c232e6
+  run
c232e6
+  mount /dev/sda2 /
c232e6
+EOF
c232e6
+
c232e6
 firstboot_dir="/Program Files/Guestfs/Firstboot"
c232e6
 mktest "is-dir \"$firstboot_dir\"" true
c232e6
 mktest "is-file \"$firstboot_dir/firstboot.bat\"" true
3156cb
@@ -88,7 +94,7 @@ for drv in netkvm vioscsi viostor; do
c232e6
     done
c232e6
 done
c232e6
 
c232e6
-guestfish --ro -a "$d/windows-sda" -i < "$script" > "$response"
c232e6
+guestfish --ro -a "$d/windows-sda" < "$script" > "$response"
c232e6
 diff -u "$expected" "$response"
c232e6
 
c232e6
 # We also update the Registry several times, for firstboot, and (ONLY
c232e6
-- 
c232e6
2.31.1
c232e6