virt-v2v/SOURCES/0011-RHEL-Fixes-for-libguestfs-winsupport.patch

137 lines
4.4 KiB
Diff
Raw Normal View History

2024-10-04 12:42:19 +00:00
From 2039580744223840a09b8aab7ff2fbf94a563a6c Mon Sep 17 00:00:00 2001
2021-11-03 22:31:07 +00:00
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sun, 30 Aug 2015 03:21:57 -0400
2022-02-01 18:03:03 +00:00
Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport.
2021-11-03 22:31:07 +00:00
2022-02-01 18:03:03 +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.
2023-09-21 20:39:07 +00:00
For RHEL 9.3 and above, see this comment:
https://bugzilla.redhat.com/show_bug.cgi?id=2187961#c1
2021-11-03 22:31:07 +00:00
---
2022-02-01 18:03:03 +00:00
convert/convert.ml | 1 +
2021-11-03 22:31:07 +00:00
test-data/phony-guests/make-windows-img.sh | 1 +
2023-09-21 20:39:07 +00:00
tests/test-v2v-block-driver.sh | 6 +++++-
2024-10-04 12:42:19 +00:00
tests/test-v2v-in-place.sh | 8 +++++++-
2021-11-03 22:31:07 +00:00
tests/test-v2v-virtio-win-iso.sh | 8 +++++++-
tests/test-v2v-windows-conversion.sh | 8 +++++++-
2024-10-04 12:42:19 +00:00
6 files changed, 28 insertions(+), 4 deletions(-)
2021-11-03 22:31:07 +00:00
2022-02-01 18:03:03 +00:00
diff --git a/convert/convert.ml b/convert/convert.ml
2024-10-04 12:42:19 +00:00
index 344c5858..ecc48ad4 100644
2022-02-01 18:03:03 +00:00
--- a/convert/convert.ml
+++ b/convert/convert.ml
2023-09-21 20:39:07 +00:00
@@ -52,6 +52,7 @@ let rec convert dir options source =
2022-02-01 18:03:03 +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.
2021-11-03 22:31:07 +00:00
diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh
index 30908a91..73cf5144 100755
--- 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
2023-09-21 20:39:07 +00:00
diff --git a/tests/test-v2v-block-driver.sh b/tests/test-v2v-block-driver.sh
index db59a2cf..a0e56bed 100755
--- a/tests/test-v2v-block-driver.sh
+++ b/tests/test-v2v-block-driver.sh
@@ -100,7 +100,11 @@ check_driver_presence ()
local virtio_dir="/Windows/Drivers/VirtIO"
- guestfish --ro -a "$img" -i >$response <<-EOM
+ guestfish >$response <<-EOM
+ add-ro $img
+ set-program virt-testing
+ run
+ mount-ro /dev/sda2 /
is-dir $virtio_dir
is-file $virtio_dir/$drv.cat
is-file $virtio_dir/$drv.inf
2024-10-04 12:42:19 +00:00
diff --git a/tests/test-v2v-in-place.sh b/tests/test-v2v-in-place.sh
index 4373f140..2b31b0bb 100755
--- a/tests/test-v2v-in-place.sh
+++ b/tests/test-v2v-in-place.sh
@@ -89,6 +89,12 @@ mktest ()
:> "$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
@@ -101,7 +107,7 @@ for drv in netkvm vioscsi viostor; do
done
done
-guestfish --ro -a "$img" -i < "$script" > "$response"
+guestfish --ro -a "$img" < "$script" > "$response"
diff -u "$expected" "$response"
# Test the base image remained untouched
2021-11-03 22:31:07 +00:00
diff --git a/tests/test-v2v-virtio-win-iso.sh b/tests/test-v2v-virtio-win-iso.sh
index 69f6f414..b9b806fb 100755
--- a/tests/test-v2v-virtio-win-iso.sh
+++ b/tests/test-v2v-virtio-win-iso.sh
@@ -82,6 +82,12 @@ mktest ()
:> "$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
@@ -94,5 +100,5 @@ for drv in netkvm vioscsi viostor; do
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
2022-02-01 18:03:03 +00:00
index a4cf191d..1ff41f6a 100755
2021-11-03 22:31:07 +00:00
--- a/tests/test-v2v-windows-conversion.sh
+++ b/tests/test-v2v-windows-conversion.sh
@@ -76,6 +76,12 @@ mktest ()
:> "$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
2022-02-01 18:03:03 +00:00
@@ -88,7 +94,7 @@ for drv in netkvm vioscsi viostor; do
2021-11-03 22:31:07 +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