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