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