diff --git a/SOURCES/0027-Update-common-submodule.patch b/SOURCES/0027-Update-common-submodule.patch new file mode 100644 index 0000000..26c87d8 --- /dev/null +++ b/SOURCES/0027-Update-common-submodule.patch @@ -0,0 +1,68 @@ +From 88e4e0213f5dc9e60720f6a84edf36bffbea723e Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 16 May 2024 12:32:00 +0100 +Subject: [PATCH] Update common submodule + +Pulls in these commits, but they are not thought to be relevant to +virt-v2v. + + Ben Brown (1): + Initialise bar->fp as NULL + + Richard W.M. Jones (2): + mlcustomize: Update virt-customize generated files + options: Allow nbd+unix:// URIs + +(cherry picked from commit 6513fcbec9a10652cb8b5690936e7265e9c8851c) +--- + common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Submodule common 0dba002c..93a7f3af: +diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml +index 245d9960..48ee3344 100644 +--- a/common/mlcustomize/customize_cmdline.ml ++++ b/common/mlcustomize/customize_cmdline.ml +@@ -157,7 +157,7 @@ let rec argspec () = + let len = String.length arg in + String.sub arg 0 i, String.sub arg (i+1) (len-(i+1)) + and split_string_triplet option_name arg = +- match String.nsplit ~max:3 "," arg with ++ match String.nsplit ~max:3 ":" arg with + | [a; b; c] -> a, b, c + | _ -> + error (f_"invalid format for '--%s' parameter, see the man page") +diff --git a/common/options/uri.c b/common/options/uri.c +index 84d393c1..9180d6a2 100644 +--- a/common/options/uri.c ++++ b/common/options/uri.c +@@ -99,7 +99,7 @@ is_uri (const char *arg) + return 0; + + for (p--; p >= arg; p--) { +- if (!c_islower (*p)) ++ if (! (c_islower (*p) || *p == '+')) + return 0; + } + +@@ -148,7 +148,10 @@ parse (const char *arg, char **path_ret, char **protocol_ret, + } + */ + +- *protocol_ret = strdup (uri->scheme); ++ if (STREQ (uri->scheme, "nbd+unix")) ++ *protocol_ret = strdup ("nbd"); ++ else ++ *protocol_ret = strdup (uri->scheme); + if (*protocol_ret == NULL) { + perror ("strdup: protocol"); + return -1; +@@ -194,7 +197,7 @@ parse (const char *arg, char **path_ret, char **protocol_ret, + if (path && path[0] == '/' && + (STREQ (uri->scheme, "gluster") || + STREQ (uri->scheme, "iscsi") || +- STREQ (uri->scheme, "nbd") || ++ STRPREFIX (uri->scheme, "nbd") || + STREQ (uri->scheme, "rbd") || + STREQ (uri->scheme, "sheepdog"))) + path++; diff --git a/SOURCES/0028-convert-windows-Install-blnsvr-from-virtio-win.patch b/SOURCES/0028-convert-windows-Install-blnsvr-from-virtio-win.patch new file mode 100644 index 0000000..5e63452 --- /dev/null +++ b/SOURCES/0028-convert-windows-Install-blnsvr-from-virtio-win.patch @@ -0,0 +1,197 @@ +From 0c0055924a4564e15d9a69d468f315f84f30f140 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 16 May 2024 13:27:49 +0100 +Subject: [PATCH] convert: windows: Install blnsvr from virtio-win + +Also update the common module to get these two commits for the +implementation: + +Richard W.M. Jones (2): + mlcustomize: Add virt-customize --inject-blnsvr generated files + mlcustomize: Add Inject_virtio_win.inject_blnsvr implementation + +Fixes: https://issues.redhat.com/browse/RHEL-36591 + +Cherry picked from commit 70eec57765280032e08a1d738402926b14a851bf. +For the RHEL 9.4-z backport, remove blnsvr installation. +--- + common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Submodule common 93a7f3af..830cbdcf: +diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod +index ff93630d..b2ac5752 100644 +--- a/common/mlcustomize/customize-options.pod ++++ b/common/mlcustomize/customize-options.pod +@@ -193,6 +193,18 @@ L. + Set the hostname of the guest to C. You can use a + dotted hostname.domainname (FQDN) if you want. + ++=item B<--inject-blnsvr> METHOD ++ ++Inject the Balloon Server (F) into a Windows guest. ++This operation also injects a firstboot script so that the Balloon ++Server is installed when the guest boots. ++ ++The parameter is the same as used by the I<--inject-virtio-win> operation. ++ ++Note that to do a full conversion of a Windows guest from a ++foreign hypervisor like VMware (which involves many other operations) ++you should use the L tool instead of this. ++ + =item B<--inject-qemu-ga> METHOD + + Inject the QEMU Guest Agent into a Windows guest. The guest +diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod +index bb0ce125..957de8cf 100644 +--- a/common/mlcustomize/customize-synopsis.pod ++++ b/common/mlcustomize/customize-synopsis.pod +@@ -3,16 +3,16 @@ + [--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR] + [--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT] + [--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..] +- [--hostname HOSTNAME] [--inject-qemu-ga METHOD] +- [--inject-virtio-win METHOD] [--install PKG,PKG..] +- [--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST] +- [--password USER:SELECTOR] [--root-password SELECTOR] +- [--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE] +- [--sm-attach SELECTOR] [--sm-register] [--sm-remove] +- [--sm-unregister] [--ssh-inject USER[:SELECTOR]] +- [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE] +- [--truncate FILE] [--truncate-recursive PATH] +- [--uninstall PKG,PKG..] [--update] [--upload FILE:DEST] +- [--write FILE:CONTENT] [--no-logfile] ++ [--hostname HOSTNAME] [--inject-blnsvr METHOD] ++ [--inject-qemu-ga METHOD] [--inject-virtio-win METHOD] ++ [--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR] ++ [--move SOURCE:DEST] [--password USER:SELECTOR] ++ [--root-password SELECTOR] [--run SCRIPT] ++ [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR] ++ [--sm-register] [--sm-remove] [--sm-unregister] ++ [--ssh-inject USER[:SELECTOR]] [--tar-in TARFILE:REMOTEDIR] ++ [--timezone TIMEZONE] [--touch FILE] [--truncate FILE] ++ [--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update] ++ [--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile] + [--password-crypto md5|sha256|sha512] [--no-selinux-relabel] + [--selinux-relabel] [--sm-credentials SELECTOR] +diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml +index 48ee3344..c4d6a77d 100644 +--- a/common/mlcustomize/customize_cmdline.ml ++++ b/common/mlcustomize/customize_cmdline.ml +@@ -61,6 +61,8 @@ and op = [ + (* --firstboot-install PKG,PKG.. *) + | `Hostname of string + (* --hostname HOSTNAME *) ++ | `InjectBalloonServer of string ++ (* --inject-blnsvr METHOD *) + | `InjectQemuGA of string + (* --inject-qemu-ga METHOD *) + | `InjectVirtioWin of string +@@ -286,6 +288,12 @@ let rec argspec () = + s_"Set the hostname" + ), + Some "HOSTNAME", "Set the hostname of the guest to C. You can use a\ndotted hostname.domainname (FQDN) if you want."; ++ ( ++ [ L"inject-blnsvr" ], ++ Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectBalloonServer s) ops), ++ s_"Inject the Balloon Server into a Windows guest" ++ ), ++ Some "METHOD", "Inject the Balloon Server (F) into a Windows guest.\nThis operation also injects a firstboot script so that the Balloon\nServer is installed when the guest boots.\n\nThe parameter is the same as used by the I<--inject-virtio-win> operation.\n\nNote that to do a full conversion of a Windows guest from a\nforeign hypervisor like VMware (which involves many other operations)\nyou should use the L tool instead of this."; + ( + [ L"inject-qemu-ga" ], + Getopt.String (s_"METHOD", fun s -> List.push_front (`InjectQemuGA s) ops), +diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli +index 51a156ea..ee62961a 100644 +--- a/common/mlcustomize/customize_cmdline.mli ++++ b/common/mlcustomize/customize_cmdline.mli +@@ -53,6 +53,8 @@ and op = [ + (* --firstboot-install PKG,PKG.. *) + | `Hostname of string + (* --hostname HOSTNAME *) ++ | `InjectBalloonServer of string ++ (* --inject-blnsvr METHOD *) + | `InjectQemuGA of string + (* --inject-qemu-ga METHOD *) + | `InjectVirtioWin of string +diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml +index 2a30b200..4e0ed0e0 100644 +--- a/common/mlcustomize/inject_virtio_win.ml ++++ b/common/mlcustomize/inject_virtio_win.ml +@@ -24,6 +24,8 @@ open Common_gettext.Gettext + + open Regedit + ++let re_blnsvr = PCRE.compile ~caseless:true "\\bblnsvr\\.exe$" ++ + type t = { + g : Guestfs.guestfs; (** guestfs handle *) + +@@ -267,6 +269,18 @@ and inject_qemu_ga t = + configure_qemu_ga t msi_files; + msi_files <> [] (* return true if we found some qemu-ga MSI files *) + ++and inject_blnsvr t = ++ let files = copy_blnsvr t in ++ match files with ++ | [] -> false (* Didn't find or install anything. *) ++ ++ (* We usually find blnsvr.exe in two locations (drivers/by-os and ++ * drivers/by-driver). Pick the first. ++ *) ++ | blnsvr :: _ -> ++ configure_blnsvr t blnsvr; ++ true ++ + and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid = + let ddb_node = g#hivex_node_get_child root "DriverDatabase" in + +@@ -351,6 +365,11 @@ and copy_qemu_ga t = + (fun () -> + error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) + ++and copy_blnsvr t = ++ copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_blnsvr t) ++ (fun () -> ++ error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) ++ + (* Copy all files from virtio_win directory/ISO located in [srcdir] + * subdirectory and all its subdirectories to the [destdir]. The directory + * hierarchy is not preserved, meaning all files will be directly in [destdir]. +@@ -513,6 +532,10 @@ and virtio_iso_path_matches_qemu_ga t path = + | ("x86_64", "rhev-qga64.msi") -> true + | _ -> false + ++(* Find blnsvr for the current Windows version. *) ++and virtio_iso_path_matches_blnsvr t path = ++ virtio_iso_path_matches_guest_os t path && PCRE.matches re_blnsvr path ++ + (* Look up in libosinfo for the OS, and copy all the locally + * available files specified as drivers for that OS to the [destdir]. + * +@@ -586,3 +609,10 @@ and configure_qemu_ga t files = + Firstboot.add_firstboot_powershell t.g t.root + (sprintf "install-%s.ps1" msi_path) !psh_script; + ) files ++ ++and configure_blnsvr t blnsvr = ++ let cmd = sprintf "\ ++ @echo off\n\ ++ echo Installing %s\n\ ++ c:\\%s -i\n" blnsvr blnsvr in ++ Firstboot.add_firstboot_script t.g t.root (sprintf "install-%s" blnsvr) cmd +diff --git a/common/mlcustomize/inject_virtio_win.mli b/common/mlcustomize/inject_virtio_win.mli +index d14f0497..d273c4dd 100644 +--- a/common/mlcustomize/inject_virtio_win.mli ++++ b/common/mlcustomize/inject_virtio_win.mli +@@ -93,3 +93,11 @@ val inject_qemu_ga : t -> bool + the MSI(s). + + Returns [true] iff we were able to inject qemu-ga. *) ++ ++val inject_blnsvr : t -> bool ++(** Inject the Balloon Server ([blnsvr.exe]) into a Windows guest. ++ ++ A firstboot script is also injected which should install ++ the server by running [blnsvr -i]. ++ ++ Returns [true] iff we were able to inject the Balloon Server. *) diff --git a/SOURCES/0029-Update-common-submodule.patch b/SOURCES/0029-Update-common-submodule.patch new file mode 100644 index 0000000..e0a27ef --- /dev/null +++ b/SOURCES/0029-Update-common-submodule.patch @@ -0,0 +1,109 @@ +From 006bdf2599f4d56e0612192291b846b384675e96 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 25 Jul 2024 09:08:41 +0100 +Subject: [PATCH] Update common submodule + +This pulls in the commits below which simplify the installation of +Qemu Guest Agent on Windows. + +Richard W.M. Jones (4): + mlcustomize: firstboot: Use Linux path for Powershell script path + mlcustomize: firstboot: Use powershell.exe instead of path + mlcustomize: firstboot: Use Powershell -NoProfile flag + mlcustomize: Revert delay installation of qemu-ga MSI + +Fixes: https://issues.redhat.com/browse/RHEL-49761 +(cherry picked from commit 4ba18d2d6d1155db7cd83641a650477c0a13dbec) +--- + common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Submodule common 830cbdcf..5d1f5b84: +diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml +index 5dc01234..4b9b910b 100644 +--- a/common/mlcustomize/firstboot.ml ++++ b/common/mlcustomize/firstboot.ml +@@ -387,16 +387,10 @@ let add_firstboot_powershell g root ?prio name code = + (* Create the temporary directory to put the Powershell file. *) + let tempdir = sprintf "%s/Temp" windows_systemroot in + g#mkdir_p tempdir; ++ let ps_path = sprintf "%s/%s" tempdir name in + let code = String.concat "\r\n" code ^ "\r\n" in +- g#write (sprintf "%s/%s" tempdir name) code; ++ g#write ps_path code; + +- (* Powershell interpreter. Should we check this exists? XXX *) +- let ps_exe = +- windows_systemroot ^ +- "\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" in +- +- (* Windows path to the Powershell script. *) +- let ps_path = windows_systemroot ^ "\\Temp\\" ^ name in +- +- let fb = sprintf "%s -ExecutionPolicy ByPass -file %s" ps_exe ps_path in ++ let fb = sprintf "powershell.exe -ExecutionPolicy ByPass -NoProfile -file %s" ++ ps_path in + add_firstboot_script g root ?prio name fb +diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml +index 4e0ed0e0..eee93669 100644 +--- a/common/mlcustomize/inject_virtio_win.ml ++++ b/common/mlcustomize/inject_virtio_win.ml +@@ -575,40 +575,28 @@ and copy_from_libosinfo { g; i_osinfo; i_arch } destdir = + ) driver.Libosinfo.files + with Not_found -> [] + ++(* Install qemu-ga. [files] is the non-empty list of possible qemu-ga ++ * installers we detected. ++ *) + and configure_qemu_ga t files = ++ let script = ref [] in ++ let add = List.push_back script in ++ ++ add "# Virt-v2v script which installs QEMU Guest Agent"; ++ add ""; ++ add "# Uncomment this line for lots of debug output."; ++ add "# Set-PSDebug -Trace 2"; ++ add ""; ++ add "Write-Host Installing QEMU Guest Agent"; ++ add ""; ++ add "# Run qemu-ga installers"; + List.iter ( + fun msi_path -> +- (* Windows is a trashfire. +- * https://stackoverflow.com/a/18730884 +- * https://bugzilla.redhat.com/show_bug.cgi?id=1895323 +- *) +- let psh_script = ref [] in +- let add = List.push_back psh_script in ++ add (sprintf "C:\\%s /norestart /qn /l+*vx C:\\%s.log" ++ msi_path msi_path) ++ ) files; + +- add "# Uncomment this line for lots of debug output."; +- add "# Set-PSDebug -Trace 2"; +- add ""; +- add "Write-Host Removing any previously scheduled qemu-ga installation"; +- add "schtasks.exe /Delete /TN Firstboot-qemu-ga /F"; +- add ""; +- add (sprintf +- "Write-Host Scheduling delayed installation of qemu-ga from %s" +- msi_path); +- add "$d = (get-date).AddSeconds(120)"; +- add "$dtfinfo = [System.Globalization.DateTimeFormatInfo]::CurrentInfo"; +- add "$sdp = $dtfinfo.ShortDatePattern"; +- add "$sdp = $sdp -replace 'y+', 'yyyy'"; +- add "$sdp = $sdp -replace 'M+', 'MM'"; +- add "$sdp = $sdp -replace 'd+', 'dd'"; +- add "schtasks.exe /Create /SC ONCE `"; +- add " /ST $d.ToString('HH:mm') /SD $d.ToString($sdp) `"; +- add " /RU SYSTEM /TN Firstboot-qemu-ga `"; +- add (sprintf " /TR \"C:\\%s /forcerestart /qn /l+*vx C:\\%s.log\"" +- msi_path msi_path); +- +- Firstboot.add_firstboot_powershell t.g t.root +- (sprintf "install-%s.ps1" msi_path) !psh_script; +- ) files ++ Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga.ps1" !script + + and configure_blnsvr t blnsvr = + let cmd = sprintf "\ diff --git a/SOURCES/0030-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch b/SOURCES/0030-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch new file mode 100644 index 0000000..16081ab --- /dev/null +++ b/SOURCES/0030-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch @@ -0,0 +1,124 @@ +From 22691e516898b0d54ad4100c9f04beb1e70f9dc0 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sun, 28 Jul 2024 14:49:42 +0100 +Subject: [PATCH] v2v: --mac: Allow gw and len fields to be empty + +Even if these appear in the middle of the list, allow them to be +empty. For example this is now permitted whereas previously it was an +error: + + virt-v2v --mac :ip:,,,nameserver + +Reported-by: Arik Hadas +(cherry picked from commit 159fda411d2f75b087106e7293d273ae142c9fbe) +--- + in-place/in_place.ml | 12 +++++++----- + inspector/inspector.ml | 12 +++++++----- + v2v/v2v.ml | 12 +++++++----- + 3 files changed, 21 insertions(+), 15 deletions(-) + +diff --git a/in-place/in_place.ml b/in-place/in_place.ml +index 2049db16..a61d9795 100644 +--- a/in-place/in_place.ml ++++ b/in-place/in_place.ml +@@ -90,10 +90,10 @@ let rec main () = + | "ip" -> + (match String.nsplit "," out with + | [] -> error (f_"invalid --mac ip option") +- | [ip] -> add_static_ip mac ip None None [] +- | [ip; gw] -> add_static_ip mac ip (Some gw) None [] ++ | [ip] -> add_static_ip mac ip "" "" [] ++ | [ip; gw] -> add_static_ip mac ip gw "" [] + | ip :: gw :: len :: nameservers -> +- add_static_ip mac ip (Some gw) (Some len) nameservers ++ add_static_ip mac ip gw len nameservers + ) + | _ -> assert false + and add_static_ip if_mac_addr if_ip_address if_default_gateway +@@ -108,12 +108,14 @@ let rec main () = + an IP address") what addr + in + error_unless_ip_addr "ipaddr" if_ip_address; ++ let if_default_gateway = ++ match if_default_gateway with "" -> None | gw -> Some gw in + Option.iter (error_unless_ip_addr "gw") if_default_gateway; + List.iter (error_unless_ip_addr "nameserver") if_nameservers; + let if_prefix_length = + match if_prefix_length_str with +- | None -> None +- | Some len -> ++ | "" -> None ++ | len -> + let len = + try int_of_string len with + | Failure _ -> error (f_"cannot parse --mac ip prefix length \ +diff --git a/inspector/inspector.ml b/inspector/inspector.ml +index 02d1a0e7..417b31c5 100644 +--- a/inspector/inspector.ml ++++ b/inspector/inspector.ml +@@ -97,10 +97,10 @@ let rec main () = + | "ip" -> + (match String.nsplit "," out with + | [] -> error (f_"invalid --mac ip option") +- | [ip] -> add_static_ip mac ip None None [] +- | [ip; gw] -> add_static_ip mac ip (Some gw) None [] ++ | [ip] -> add_static_ip mac ip "" "" [] ++ | [ip; gw] -> add_static_ip mac ip gw "" [] + | ip :: gw :: len :: nameservers -> +- add_static_ip mac ip (Some gw) (Some len) nameservers ++ add_static_ip mac ip gw len nameservers + ) + | _ -> assert false + and add_static_ip if_mac_addr if_ip_address if_default_gateway +@@ -115,12 +115,14 @@ let rec main () = + is an IP address") what addr + in + error_unless_ip_addr "ipaddr" if_ip_address; ++ let if_default_gateway = ++ match if_default_gateway with "" -> None | gw -> Some gw in + Option.iter (error_unless_ip_addr "gw") if_default_gateway; + List.iter (error_unless_ip_addr "nameserver") if_nameservers; + let if_prefix_length = + match if_prefix_length_str with +- | None -> None +- | Some len -> ++ | "" -> None ++ | len -> + let len = + try int_of_string len with + | Failure _ -> error (f_"cannot parse --mac ip prefix \ +diff --git a/v2v/v2v.ml b/v2v/v2v.ml +index 89c08fc5..6d9e3792 100644 +--- a/v2v/v2v.ml ++++ b/v2v/v2v.ml +@@ -109,10 +109,10 @@ let rec main () = + | "ip" -> + (match String.nsplit "," out with + | [] -> error (f_"invalid --mac ip option") +- | [ip] -> add_static_ip mac ip None None [] +- | [ip; gw] -> add_static_ip mac ip (Some gw) None [] ++ | [ip] -> add_static_ip mac ip "" "" [] ++ | [ip; gw] -> add_static_ip mac ip gw "" [] + | ip :: gw :: len :: nameservers -> +- add_static_ip mac ip (Some gw) (Some len) nameservers ++ add_static_ip mac ip gw len nameservers + ) + | _ -> assert false + and add_static_ip if_mac_addr if_ip_address if_default_gateway +@@ -127,12 +127,14 @@ let rec main () = + is an IP address") what addr + in + error_unless_ip_addr "ipaddr" if_ip_address; ++ let if_default_gateway = ++ match if_default_gateway with "" -> None | gw -> Some gw in + Option.iter (error_unless_ip_addr "gw") if_default_gateway; + List.iter (error_unless_ip_addr "nameserver") if_nameservers; + let if_prefix_length = + match if_prefix_length_str with +- | None -> None +- | Some len -> ++ | "" -> None ++ | len -> + let len = + try int_of_string len with + | Failure _ -> error (f_"cannot parse --mac ip prefix length field \ diff --git a/SOURCES/0031-docs-Note-that-mac-len-field-is-now-optional.patch b/SOURCES/0031-docs-Note-that-mac-len-field-is-now-optional.patch new file mode 100644 index 0000000..1b93935 --- /dev/null +++ b/SOURCES/0031-docs-Note-that-mac-len-field-is-now-optional.patch @@ -0,0 +1,29 @@ +From 48c49139b94b1081c6392ab3b14fbb72c024f18d Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Wed, 31 Jul 2024 10:09:50 +0100 +Subject: [PATCH] docs: Note that --mac len field is now optional + +Reported-by: Ming Xie +Updates: commit 159fda411d2f75b087106e7293d273ae142c9fbe +(cherry picked from commit 7800049c5612e6ffb30be7f8862d147d82976ae8) +--- + docs/virt-v2v.pod | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod +index 021ac897..c173563b 100644 +--- a/docs/virt-v2v.pod ++++ b/docs/virt-v2v.pod +@@ -372,9 +372,9 @@ Force a particular interface (controlled by its MAC address) to have a + static IP address after boot. + + The fields in the parameter are: C is the IP address. C +-is the optional gateway IP address. C is the subnet mask length +-(an integer). The final parameters are zero or more nameserver IP +-addresses. ++is the optional gateway IP address. C is the optional subnet ++mask length (an integer). The final parameters are zero or more ++nameserver IP addresses. + + This option can be supplied zero or more times. + diff --git a/SOURCES/0032-convert-More-robust-qemu-ga-installation-change-path.patch b/SOURCES/0032-convert-More-robust-qemu-ga-installation-change-path.patch new file mode 100644 index 0000000..4ec4d35 --- /dev/null +++ b/SOURCES/0032-convert-More-robust-qemu-ga-installation-change-path.patch @@ -0,0 +1,240 @@ +From bebc18c317a46cc99f50d1f6932c81df4e7da1fb Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 1 Aug 2024 09:01:47 +0100 +Subject: [PATCH] convert: More robust qemu-ga installation, change paths + +Add a commit from the common submodule to attempt to make qemu-ga +installation more robust on Windows. + +Rename network configuration Powershell script from "v2vnetcf" to +"network-configuration". I also dropped the ".ps1" extension as the +modified Firstboot.add_firstboot_powershell function now adds this. + +Update the common submodule to get these changes: + +Richard W.M. Jones (3): + mlcustomize: Use Start-Process -Wait to run qemu-ga installer + mlcustomize: Add Firstboot.firstboot_dir function + mlcustomize: Place powershell scripts into \Temp + +(cherry picked from commit c57ec4fd5d4942d2320aec4a6b01977dabb87f83) +--- + common | 2 +- + convert/convert_windows.ml | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +Submodule common 5d1f5b84..d489469f: +diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml +index 4b9b910b..3bbba714 100644 +--- a/common/mlcustomize/firstboot.ml ++++ b/common/mlcustomize/firstboot.ml +@@ -239,7 +239,22 @@ WantedBy=%s + end + + module Windows = struct +- let rec install_service (g : Guestfs.guestfs) root = ++ (* Create and return the firstboot directory. *) ++ let create_firstboot_dir (g : Guestfs.guestfs) = ++ let rec loop firstboot_dir firstboot_dir_win = function ++ | [] -> firstboot_dir, firstboot_dir_win ++ | dir :: path -> ++ let firstboot_dir = ++ if firstboot_dir = "" then "/" ^ dir else firstboot_dir // dir in ++ let firstboot_dir_win = firstboot_dir_win ^ "\\" ^ dir in ++ let firstboot_dir = g#case_sensitive_path firstboot_dir in ++ g#mkdir_p firstboot_dir; ++ loop firstboot_dir firstboot_dir_win path ++ in ++ loop "" "C:" ["Program Files"; "Guestfs"; "Firstboot"] ++ ++ let rec install_service (g : Guestfs.guestfs) root ++ firstboot_dir firstboot_dir_win = + (* Either rhsrvany.exe or pvvxsvc.exe must exist. + * + * (Check also that it's not a dangling symlink but a real file). +@@ -254,20 +269,7 @@ module Windows = struct + error (f_"One of rhsrvany.exe or pvvxsvc.exe is missing in %s. One of them is required in order to install Windows firstboot scripts. You can get one by building rhsrvany (https://github.com/rwmjones/rhsrvany)") + (virt_tools_data_dir ()) in + +- (* Create a directory for firstboot files in the guest. *) +- let firstboot_dir, firstboot_dir_win = +- let rec loop firstboot_dir firstboot_dir_win = function +- | [] -> firstboot_dir, firstboot_dir_win +- | dir :: path -> +- let firstboot_dir = +- if firstboot_dir = "" then "/" ^ dir else firstboot_dir // dir in +- let firstboot_dir_win = firstboot_dir_win ^ "\\" ^ dir in +- let firstboot_dir = g#case_sensitive_path firstboot_dir in +- g#mkdir_p firstboot_dir; +- loop firstboot_dir firstboot_dir_win path +- in +- loop "" "C:" ["Program Files"; "Guestfs"; "Firstboot"] in +- ++ (* Create a directory for firstboot scripts in the guest. *) + g#mkdir_p (firstboot_dir // "scripts"); + + (* Copy pvvxsvc or rhsrvany to the guest. *) +@@ -339,11 +341,25 @@ echo uninstalling firstboot service + "PWD", REG_SZ firstboot_dir_win ]; + ] in + reg_import reg regedits +- ); +- +- firstboot_dir ++ ) + end + ++let firstboot_dir (g : Guestfs.guestfs) root = ++ let typ = g#inspect_get_type root in ++ ++ match typ with ++ | "linux" -> ++ let dir = Linux.firstboot_dir in ++ g#mkdir_p dir; ++ dir, None ++ ++ | "windows" -> ++ let dir, dir_win = Windows.create_firstboot_dir g in ++ dir, Some dir_win ++ ++ | _ -> ++ error (f_"guest type %s is not supported") typ ++ + let script_count = ref 0 + + let add_firstboot_script (g : Guestfs.guestfs) root ?(prio = 5000) name +@@ -363,7 +379,8 @@ let add_firstboot_script (g : Guestfs.guestfs) root ?(prio = 5000) name + g#chmod 0o755 filename + + | "windows", _ -> +- let firstboot_dir = Windows.install_service g root in ++ let firstboot_dir, firstboot_dir_win = Windows.create_firstboot_dir g in ++ Windows.install_service g root firstboot_dir firstboot_dir_win; + let filename = firstboot_dir // "scripts" // filename ^ ".bat" in + g#write filename (String.unix2dos content) + +@@ -382,15 +399,18 @@ let add_firstboot_powershell g root ?prio name code = + *) + assert (g#inspect_get_type root = "windows"); + +- let windows_systemroot = g#inspect_get_windows_systemroot root in +- +- (* Create the temporary directory to put the Powershell file. *) +- let tempdir = sprintf "%s/Temp" windows_systemroot in ++ (* Place the Powershell script into firstboot_dir/Temp *) ++ let firstboot_dir, firstboot_dir_win = Windows.create_firstboot_dir g in ++ let tempdir = sprintf "%s/Temp" firstboot_dir in + g#mkdir_p tempdir; +- let ps_path = sprintf "%s/%s" tempdir name in ++ ++ let ps_path = sprintf "%s/%s.ps1" tempdir name in ++ let ps_path_win = sprintf "%s\\Temp\\%s.ps1" firstboot_dir_win name in + let code = String.concat "\r\n" code ^ "\r\n" in + g#write ps_path code; + +- let fb = sprintf "powershell.exe -ExecutionPolicy ByPass -NoProfile -file %s" +- ps_path in ++ (* Create a regular firstboot bat that just invokes powershell *) ++ let fb = ++ sprintf "powershell.exe -ExecutionPolicy ByPass -NoProfile -file \"%s\"" ++ ps_path_win in + add_firstboot_script g root ?prio name fb +diff --git a/common/mlcustomize/firstboot.mli b/common/mlcustomize/firstboot.mli +index 8231af65..34ff0690 100644 +--- a/common/mlcustomize/firstboot.mli ++++ b/common/mlcustomize/firstboot.mli +@@ -16,6 +16,23 @@ + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + ++val firstboot_dir : Guestfs.guestfs -> string -> string * string option ++(** [firstboot_dir g root] ++ returns the path of the firstboot directory, creating it in ++ the guest if necessary. ++ ++ This returns the name of the directory as a guestfs path, and ++ optionally the name as a Windows path (only for Windows guests). ++ ++ For Linux this could be [/usr/lib/virt-sysprep, None] ++ ++ For Windows this could be ["/Program Files/Guestfs/Firstboot", ++ Some "C:\Program Files\Guestfs\Firstboot"] ++ ++ Additional files that are used during firstboot can be placed ++ in this directory, but be careful not to conflict with files ++ and scripts added by the firstboot process itself. *) ++ + val add_firstboot_script : Guestfs.guestfs -> string -> ?prio:int -> string -> + string -> unit + (** [add_firstboot_script g root prio name content] adds a firstboot +diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml +index eee93669..b04a3b38 100644 +--- a/common/mlcustomize/inject_virtio_win.ml ++++ b/common/mlcustomize/inject_virtio_win.ml +@@ -592,11 +592,11 @@ and configure_qemu_ga t files = + add "# Run qemu-ga installers"; + List.iter ( + fun msi_path -> +- add (sprintf "C:\\%s /norestart /qn /l+*vx C:\\%s.log" ++ add (sprintf "Start-Process -Wait -FilePath \"C:\\%s\" -ArgumentList \"/norestart\",\"/qn\",\"/l+*vx\",\"C:\\%s.log\"" + msi_path msi_path) + ) files; + +- Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga.ps1" !script ++ Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga" !script + + and configure_blnsvr t blnsvr = + let cmd = sprintf "\ +diff --git a/common/mldrivers/linux_kernels.ml b/common/mldrivers/linux_kernels.ml +index 23ff76a5..e0b6b8a0 100644 +--- a/common/mldrivers/linux_kernels.ml ++++ b/common/mldrivers/linux_kernels.ml +@@ -102,7 +102,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps = + ) apps in + if verbose () then ( + let names = List.map (fun { G.app2_name = name } -> name) kernel_pkgs in +- eprintf "candidate kernel packages in this guest: %s%!\n" ++ eprintf "info: candidate kernel packages in this guest: %s%!\n" + (String.concat " " names) + ); + List.filter_map ( +@@ -306,7 +306,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps = + ) kernel_pkgs in + + if verbose () then ( +- eprintf "installed kernel packages in this guest:\n"; ++ eprintf "info: installed kernel packages in this guest:\n"; + List.iter (print_kernel_info stderr "\t") installed_kernels; + flush stderr + ); +@@ -343,7 +343,7 @@ let detect_kernels (g : G.guestfs) root bootloader apps = + ) vmlinuzes in + + if verbose () then ( +- eprintf "kernels offered by the bootloader in this guest (first in list is default):\n"; ++ eprintf "info: kernels offered by the bootloader in this guest (first in list is default):\n"; + List.iter (print_kernel_info stderr "\t") bootloader_kernels; + flush stderr + ); +diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml +index 34cf341b..2ff60bad 100644 +--- a/convert/convert_windows.ml ++++ b/convert/convert_windows.ml +@@ -391,7 +391,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = + %systemroot%\\Sysnative\\PnPutil -i -a \ + %systemroot%\\Drivers\\Virtio\\*.inf" in + +- (* Set priority higher than that of "v2vnetcf.ps1" firstboot script. *) ++ (* Set priority higher than that of "network-configure" firstboot script. *) + Firstboot.add_firstboot_script g inspect.i_root ~prio:2000 + "pnputil install drivers" fb_script; + +@@ -668,7 +668,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = + * Powershell script which runs at boot. + *) + if static_ips <> [] then ( +- let psh_filename = "v2vnetcf.ps1" in ++ let psh_filename = "network-configure" in + let psh = ref [] in + let add = List.push_back psh in + diff --git a/SOURCES/0033-common-mlcustomize-Inject-qemu-ga-blnsvr-into-firstb.patch b/SOURCES/0033-common-mlcustomize-Inject-qemu-ga-blnsvr-into-firstb.patch new file mode 100644 index 0000000..c352d1b --- /dev/null +++ b/SOURCES/0033-common-mlcustomize-Inject-qemu-ga-blnsvr-into-firstb.patch @@ -0,0 +1,118 @@ +From 692354df0bf2915955d8c66705685f66f5f44844 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 1 Aug 2024 10:36:52 +0100 +Subject: [PATCH] common: mlcustomize: Inject qemu-ga & blnsvr into + /Temp + +Update common submodule to pick up this further change which should +mean that for all Windows conversions, everything is confined to +C:\Program Files\Guestfs\Firstboot (except the virtio drivers +themselves). + +Richard W.M. Jones (1): + mlcustomize: Inject qemu-ga & blnsvr into /Temp + +(cherry picked from commit 168eacf977ca49e96bc63ddc4109c27515ac0277) +--- + common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Submodule common d489469f..04116678: +diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml +index b04a3b38..2981bff5 100644 +--- a/common/mlcustomize/inject_virtio_win.ml ++++ b/common/mlcustomize/inject_virtio_win.ml +@@ -263,14 +263,28 @@ let rec inject_virtio_win_drivers ({ g } as t) reg = + } + ) + +-and inject_qemu_ga t = +- let msi_files = copy_qemu_ga t in ++and inject_qemu_ga ({ g; root } as t) = ++ (* Copy the qemu-ga MSI(s) to the guest. *) ++ let dir, dir_win = Firstboot.firstboot_dir g root in ++ let dir_win = Option.value dir_win ~default:dir in ++ let tempdir = sprintf "%s/Temp" dir in ++ let tempdir_win = sprintf "%s\\Temp" dir_win in ++ g#mkdir_p tempdir; ++ ++ let msi_files = copy_qemu_ga t tempdir in + if msi_files <> [] then +- configure_qemu_ga t msi_files; ++ configure_qemu_ga t tempdir_win msi_files; + msi_files <> [] (* return true if we found some qemu-ga MSI files *) + +-and inject_blnsvr t = +- let files = copy_blnsvr t in ++and inject_blnsvr ({ g; root } as t) = ++ (* Copy the files to the guest. *) ++ let dir, dir_win = Firstboot.firstboot_dir g root in ++ let dir_win = Option.value dir_win ~default:dir in ++ let tempdir = sprintf "%s/Temp" dir in ++ let tempdir_win = sprintf "%s\\Temp" dir_win in ++ g#mkdir_p tempdir; ++ ++ let files = copy_blnsvr t tempdir in + match files with + | [] -> false (* Didn't find or install anything. *) + +@@ -278,7 +292,7 @@ and inject_blnsvr t = + * drivers/by-driver). Pick the first. + *) + | blnsvr :: _ -> +- configure_blnsvr t blnsvr; ++ configure_blnsvr t tempdir_win blnsvr; + true + + and add_guestor_to_registry t ((g, root) as reg) drv_name drv_pciid = +@@ -360,13 +374,13 @@ and copy_drivers t driverdir = + (fun () -> + error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) + +-and copy_qemu_ga t = +- copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_qemu_ga t) ++and copy_qemu_ga t tempdir = ++ copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_qemu_ga t) + (fun () -> + error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) + +-and copy_blnsvr t = +- copy_from_virtio_win t "/" "/" (virtio_iso_path_matches_blnsvr t) ++and copy_blnsvr t tempdir = ++ copy_from_virtio_win t "/" tempdir (virtio_iso_path_matches_blnsvr t) + (fun () -> + error (f_"root directory ‘/’ is missing from the virtio-win directory or ISO.\n\nThis should not happen and may indicate that virtio-win or virt-v2v is broken in some way. Please report this as a bug with a full debug log.")) + +@@ -578,7 +592,7 @@ and copy_from_libosinfo { g; i_osinfo; i_arch } destdir = + (* Install qemu-ga. [files] is the non-empty list of possible qemu-ga + * installers we detected. + *) +-and configure_qemu_ga t files = ++and configure_qemu_ga t tempdir_win files = + let script = ref [] in + let add = List.push_back script in + +@@ -591,16 +605,17 @@ and configure_qemu_ga t files = + add ""; + add "# Run qemu-ga installers"; + List.iter ( +- fun msi_path -> +- add (sprintf "Start-Process -Wait -FilePath \"C:\\%s\" -ArgumentList \"/norestart\",\"/qn\",\"/l+*vx\",\"C:\\%s.log\"" +- msi_path msi_path) ++ fun msi -> ++ (* [`] is an escape char for quotes *) ++ add (sprintf "Start-Process -Wait -FilePath \"%s\\%s\" -ArgumentList \"/norestart\",\"/qn\",\"/l+*vx\",\"`\"%s\\%s.log`\"\"" ++ tempdir_win msi tempdir_win msi) + ) files; + + Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga" !script + +-and configure_blnsvr t blnsvr = ++and configure_blnsvr t tempdir_win blnsvr = + let cmd = sprintf "\ + @echo off\n\ + echo Installing %s\n\ +- c:\\%s -i\n" blnsvr blnsvr in +- Firstboot.add_firstboot_script t.g t.root (sprintf "install-%s" blnsvr) cmd ++ \"%s\\%s\" -i\n" blnsvr tempdir_win blnsvr in ++ Firstboot.add_firstboot_script t.g t.root "install-blnsvr" cmd diff --git a/SOURCES/0034-docs-Add-a-note-about-removal-of-VMware-Tools-on-Win.patch b/SOURCES/0034-docs-Add-a-note-about-removal-of-VMware-Tools-on-Win.patch new file mode 100644 index 0000000..37c4720 --- /dev/null +++ b/SOURCES/0034-docs-Add-a-note-about-removal-of-VMware-Tools-on-Win.patch @@ -0,0 +1,46 @@ +From 696060ba5e89da4d60a7ee1187c8cfd298d50031 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 5 Aug 2024 10:08:34 +0100 +Subject: [PATCH] docs: Add a note about removal of VMware Tools on Windows + +We use VMware's recommended method for removal, but we know from +experience that this rarely works. The alternate method being +proposed involves making very invasive changes to the Registry and +filesystem, which are inappropriate for virt-v2v to do and highly +risky. Therefore simply document this, with notes for the virt-v2v +user if they want to try the risky method. + +Fixes: https://issues.redhat.com/browse/RHEL-51169 +Thanks: Yan Vugenfirer +Reported-by: Ming Xie +(cherry picked from commit c952f310c902e438a8b0b5240a4b486b698bede8) +--- + docs/virt-v2v.pod | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod +index c173563b..6df9d88b 100644 +--- a/docs/virt-v2v.pod ++++ b/docs/virt-v2v.pod +@@ -1248,6 +1248,21 @@ B Take care not to interrupt the automatic driver installation + process when logging in to the guest for the first time, as this may + prevent the guest from subsequently booting correctly. + ++=head3 Removing VMware Tools from Windows guests ++ ++Virt-v2v attempts to remove VMware Tools. For Windows guests this is ++supposed to happen during the first boot after conversion. ++ ++We use VMware's recommended uninstallation method as that is the ++safest choice. However our experience has shown that this method ++usually fails. If so, VMware Tools must be removed by some other ++method. ++ ++One possible method is described here: ++L ++You should carefully check this script since it makes very invasive ++changes to the Windows Registry and filesystem. ++ + =head2 Free space for conversion + + =head3 Free space in the guest diff --git a/SOURCES/0035-Update-common-submodule.patch b/SOURCES/0035-Update-common-submodule.patch new file mode 100644 index 0000000..028c239 --- /dev/null +++ b/SOURCES/0035-Update-common-submodule.patch @@ -0,0 +1,27 @@ +From 03249203b25d946358e73d0e418805f293bb43bb Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Mon, 5 Aug 2024 10:18:31 +0100 +Subject: [PATCH] Update common submodule + +Richard W.M. Jones (1): + mlcustomize: Write qemu-ga log file name to log.txt + +(cherry picked from commit 7bc9b115baba6df2969451cd6907e2d7543ef22d) +--- + common | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +Submodule common 04116678..7b84a370: +diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml +index 2981bff5..afec1e45 100644 +--- a/common/mlcustomize/inject_virtio_win.ml ++++ b/common/mlcustomize/inject_virtio_win.ml +@@ -606,6 +606,8 @@ and configure_qemu_ga t tempdir_win files = + add "# Run qemu-ga installers"; + List.iter ( + fun msi -> ++ add (sprintf "Write-Host \"Writing log to %s\\%s.log\"" ++ tempdir_win msi); + (* [`] is an escape char for quotes *) + add (sprintf "Start-Process -Wait -FilePath \"%s\\%s\" -ArgumentList \"/norestart\",\"/qn\",\"/l+*vx\",\"`\"%s\\%s.log`\"\"" + tempdir_win msi tempdir_win msi) diff --git a/SOURCES/0036-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch b/SOURCES/0036-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch new file mode 100644 index 0000000..a16bf96 --- /dev/null +++ b/SOURCES/0036-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch @@ -0,0 +1,80 @@ +From a6b8794cd8b90b7f100964ff8534eb24a1b32d4b Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 8 Aug 2024 10:40:24 +0100 +Subject: [PATCH] Pull in a fix to make Windows firstboot more reliable. + +Update the common submodule to get: + +Richard W.M. Jones (2): + mlcustomize: Add some comments to firstboot batch file + mlcustomize: Reboot Windows between each firstboot script + +Document that Windows may now reboot several times after conversion. + +(cherry picked from commit 50f005f8b7034916588855c15b10a0195bf54b23) +--- + common | 2 +- + docs/virt-v2v.pod | 9 ++++++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +Submodule common 7b84a370..a7883967: +diff --git a/common/mlcustomize/firstboot.ml b/common/mlcustomize/firstboot.ml +index 3bbba714..52e76401 100644 +--- a/common/mlcustomize/firstboot.ml ++++ b/common/mlcustomize/firstboot.ml +@@ -278,6 +278,9 @@ module Windows = struct + (* Write a firstboot.bat control script which just runs the other + * scripts in the directory. Note we need to use CRLF line endings + * in this script. ++ * ++ * XXX It would be better to use powershell here. For some ideas see ++ * https://github.com/HCK-CI/HLK-Setup-Scripts/ + *) + let firstboot_script = sprintf "\ + @echo off +@@ -299,6 +302,7 @@ if not exist \"%%scripts_done%%\" ( + mkdir \"%%scripts_done%%\" + ) + ++:: Pick the next script to run. + for %%%%f in (\"%%scripts%%\"\\*.bat) do ( + echo running \"%%%%f\" + move \"%%%%f\" \"%%scripts_done%%\" +@@ -307,8 +311,17 @@ for %%%%f in (\"%%scripts%%\"\\*.bat) do ( + set elvl=!errorlevel! + echo .... exit code !elvl! + popd ++ ++ :: Reboot the computer. This is necessary to free any locked ++ :: files which may prevent later scripts from running. ++ shutdown /r /t 0 /y ++ ++ :: Exit the script (in case shutdown returns before rebooting). ++ :: On next boot, the whole firstboot service will be called again. ++ exit /b + ) + ++:: Fallthrough here if there are no scripts. + echo uninstalling firstboot service + \"%%firstboot%%\\%s\" -s firstboot uninstall + " firstboot_dir_win srvany in +diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod +index 6df9d88b..7912c6b1 100644 +--- a/docs/virt-v2v.pod ++++ b/docs/virt-v2v.pod +@@ -1244,9 +1244,12 @@ The guest will be bootable after the offline conversion stage, but + will not yet have all necessary drivers installed to work correctly. + These will be installed automatically the first time the guest boots. + +-B Take care not to interrupt the automatic driver installation +-process when logging in to the guest for the first time, as this may +-prevent the guest from subsequently booting correctly. ++B Windows may reboot 4 or more times the first time after ++conversion. This is required to install the required drivers, guest ++agents, remove VMware Tools, and configure the network. Take care not ++to interrupt the automatic driver installation process when logging in ++to the guest for the first time, as this may prevent the guest from ++subsequently booting correctly. + + =head3 Removing VMware Tools from Windows guests + diff --git a/SOURCES/0037-docs-Restate-position-on-removal-of-VMware-Tools.patch b/SOURCES/0037-docs-Restate-position-on-removal-of-VMware-Tools.patch new file mode 100644 index 0000000..3330bd9 --- /dev/null +++ b/SOURCES/0037-docs-Restate-position-on-removal-of-VMware-Tools.patch @@ -0,0 +1,31 @@ +From 8bcdddcaa612feb05c4ae5033bf9440b046ef63e Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 8 Aug 2024 10:56:16 +0100 +Subject: [PATCH] docs: Restate position on removal of VMware Tools + +With the "reboot after every step" change made in the previous commit, +it seems removal of VMware Tools is now more reliable. Update the +notes about this. + +Updates: commit c952f310c902e438a8b0b5240a4b486b698bede8 +(cherry picked from commit e9c0d63b22bcb4c31cfaac00fc1271713c8bd3b3) +--- + docs/virt-v2v.pod | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod +index 7912c6b1..50285cad 100644 +--- a/docs/virt-v2v.pod ++++ b/docs/virt-v2v.pod +@@ -1257,9 +1257,8 @@ Virt-v2v attempts to remove VMware Tools. For Windows guests this is + supposed to happen during the first boot after conversion. + + We use VMware's recommended uninstallation method as that is the +-safest choice. However our experience has shown that this method +-usually fails. If so, VMware Tools must be removed by some other +-method. ++safest choice. If this fails, VMware Tools must be manually removed ++by some other method. + + One possible method is described here: + L diff --git a/SOURCES/1001-replaced-upstream-references.patch b/SOURCES/1001-replaced-upstream-references.patch new file mode 100644 index 0000000..8acd59d --- /dev/null +++ b/SOURCES/1001-replaced-upstream-references.patch @@ -0,0 +1,304 @@ +From a0b0015b884015b20a86cbc896ba55448f05e855 Mon Sep 17 00:00:00 2001 +From: Craig Guiller +Date: Fri, 5 Apr 2024 12:34:09 +0100 +Subject: [PATCH] replaced upstream references +Signed-off-by: Craig Guiller +--- + po/Makefile.am | 2 +- + po/cs.po | 3 +-- + po/de.po | 3 +-- + po/es.po | 3 +-- + po/fr.po | 3 +-- + po/gu.po | 3 +-- + po/hi.po | 3 +-- + po/ja.po | 3 +-- + po/kn.po | 3 +-- + po/ml.po | 3 +-- + po/mr.po | 3 +-- + po/nl.po | 3 +-- + po/or.po | 3 +-- + po/pa.po | 3 +-- + po/pl.po | 3 +-- + po/uk.po | 3 +-- + po/virt-v2v.pot | 3 +-- + podwrapper.pl.in | 4 ++-- + website/index.html.in | 6 +++--- + 19 files changed, 22 insertions(+), 38 deletions(-) + +diff --git a/po/Makefile.am b/po/Makefile.am +index f1509d6..db4a502 100644 +--- a/po/Makefile.am ++++ b/po/Makefile.am +@@ -19,7 +19,7 @@ include $(top_srcdir)/subdir-rules.mk + + DOMAIN = $(PACKAGE_NAME) + COPYRIGHT_HOLDER = Red Hat Inc. +-MSGID_BUGS_ADDRESS = https://bugzilla.redhat.com/enter_bug.cgi?component=libguestfs&product=Virtualization+Tools ++MSGID_BUGS_ADDRESS = https://github.com/oracle/oracle-linux + + # Languages. + # Don't use LINGUAS (uppercase) as Gentoo defines it (RHBZ#804464). +diff --git a/po/cs.po b/po/cs.po +index 415a9b9..bf996ff 100644 +--- a/po/cs.po ++++ b/po/cs.po +@@ -2,8 +2,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2023-04-08 18:20+0000\n" + "Last-Translator: Pavel Borecki \n" +diff --git a/po/de.po b/po/de.po +index 19a5513..7b64f55 100644 +--- a/po/de.po ++++ b/po/de.po +@@ -9,8 +9,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:48+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/es.po b/po/es.po +index 065cd2b..051af40 100644 +--- a/po/es.po ++++ b/po/es.po +@@ -10,8 +10,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-03-16 07:04+0000\n" + "Last-Translator: Alex Puchades \n" +diff --git a/po/fr.po b/po/fr.po +index 7b0864b..41b9db7 100644 +--- a/po/fr.po ++++ b/po/fr.po +@@ -10,8 +10,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2023-03-21 09:20+0000\n" + "Last-Translator: grimst \n" +diff --git a/po/gu.po b/po/gu.po +index 02643ec..d53329c 100644 +--- a/po/gu.po ++++ b/po/gu.po +@@ -8,8 +8,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:49+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/hi.po b/po/hi.po +index 11f334c..303063d 100644 +--- a/po/hi.po ++++ b/po/hi.po +@@ -8,8 +8,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:49+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/ja.po b/po/ja.po +index 7c806c1..227b17e 100644 +--- a/po/ja.po ++++ b/po/ja.po +@@ -9,8 +9,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2017-02-24 07:33+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/kn.po b/po/kn.po +index 430af05..66b794b 100644 +--- a/po/kn.po ++++ b/po/kn.po +@@ -7,8 +7,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:50+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/ml.po b/po/ml.po +index 172994f..0195197 100644 +--- a/po/ml.po ++++ b/po/ml.po +@@ -7,8 +7,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:50+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/mr.po b/po/mr.po +index cfa072d..49e5e6d 100644 +--- a/po/mr.po ++++ b/po/mr.po +@@ -8,8 +8,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:51+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/nl.po b/po/nl.po +index 7757ba3..c91e1b0 100644 +--- a/po/nl.po ++++ b/po/nl.po +@@ -9,8 +9,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:51+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/or.po b/po/or.po +index cb0b6f9..11ee73f 100644 +--- a/po/or.po ++++ b/po/or.po +@@ -7,8 +7,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:51+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/pa.po b/po/pa.po +index 9b4e9bc..c34e00d 100644 +--- a/po/pa.po ++++ b/po/pa.po +@@ -8,8 +8,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2015-02-21 10:52+0000\n" + "Last-Translator: Copied by Zanata \n" +diff --git a/po/pl.po b/po/pl.po +index d46571c..01f5206 100644 +--- a/po/pl.po ++++ b/po/pl.po +@@ -11,8 +11,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: libguestfs 1.39.12\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: 2024-01-15 13:36+0000\n" + "Last-Translator: Weblate Translation Memory \n" +diff --git a/po/virt-v2v.pot b/po/virt-v2v.pot +index 4c6334e..3a1f075 100644 +--- a/po/virt-v2v.pot ++++ b/po/virt-v2v.pot +@@ -7,8 +7,7 @@ + msgid "" + msgstr "" + "Project-Id-Version: virt-v2v 2.4.0\n" +-"Report-Msgid-Bugs-To: https://bugzilla.redhat.com/enter_bug.cgi?" +-"component=libguestfs&product=Virtualization+Tools\n" ++"Report-Msgid-Bugs-To: https://github.com/oracle/oracle-linux\n" + "POT-Creation-Date: 2024-01-04 17:06+0000\n" + "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" + "Last-Translator: FULL NAME \n" +diff --git a/podwrapper.pl.in b/podwrapper.pl.in +index c99563c..14198cf 100755 +--- a/podwrapper.pl.in ++++ b/podwrapper.pl.in +@@ -432,10 +432,10 @@ my $reporting_bugs = + "=head1 BUGS + + To get a list of bugs against libguestfs, use this link: +-L ++L + + To report a new bug against libguestfs, use this link: +-L ++L + + When reporting a bug, please supply: + +diff --git a/website/index.html.in b/website/index.html.in +index f578523..e1e1592 100644 +--- a/website/index.html.in ++++ b/website/index.html.in +@@ -160,12 +160,12 @@ For testers: +

Bug reports

+ +

+-List of bugs in libguestfs and +-in Fedora packaging of libguestfs ++List of bugs in libguestfs and ++in Community packaging of libguestfs +

+ +

+-Enter a new bug report ++Enter a new bug report +

+ + +-- +2.39.3 + diff --git a/SOURCES/copy-patches.sh b/SOURCES/copy-patches.sh old mode 100755 new mode 100644 diff --git a/SPECS/virt-v2v.spec b/SPECS/virt-v2v.spec index 93fad56..26ea44b 100644 --- a/SPECS/virt-v2v.spec +++ b/SPECS/virt-v2v.spec @@ -16,7 +16,7 @@ Name: virt-v2v Epoch: 1 Version: 2.4.0 -Release: 2%{?dist} +Release: 3.0.1%{?dist} Summary: Convert a virtual machine to run on KVM License: GPL-2.0-or-later AND LGPL-2.0-or-later @@ -62,6 +62,20 @@ Patch0023: 0023-RHEL-Remove-the-in-place-option.patch Patch0024: 0024-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch Patch0025: 0025-RHEL-9-tests-Remove-btrfs-test.patch Patch0026: 0026-RHEL-9-Remove-block-driver-option.patch +Patch0027: 0027-Update-common-submodule.patch +Patch0028: 0028-convert-windows-Install-blnsvr-from-virtio-win.patch +Patch0029: 0029-Update-common-submodule.patch +Patch0030: 0030-v2v-mac-Allow-gw-and-len-fields-to-be-empty.patch +Patch0031: 0031-docs-Note-that-mac-len-field-is-now-optional.patch +Patch0032: 0032-convert-More-robust-qemu-ga-installation-change-path.patch +Patch0033: 0033-common-mlcustomize-Inject-qemu-ga-blnsvr-into-firstb.patch +Patch0034: 0034-docs-Add-a-note-about-removal-of-VMware-Tools-on-Win.patch +Patch0035: 0035-Update-common-submodule.patch +Patch0036: 0036-Pull-in-a-fix-to-make-Windows-firstboot-more-reliabl.patch +Patch0037: 0037-docs-Restate-position-on-removal-of-VMware-Tools.patch + +# Oracle patch +Patch1001: 1001-replaced-upstream-references.patch %if !0%{?rhel} # libguestfs hasn't been built on i686 for a while since there is no @@ -366,6 +380,17 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check %changelog +* Thu Aug 15 2024 EL Errata - 2.4.0-3.0.1 +- Replaced bugzilla.oracle.com references [Orabug: 34202300] +- replaced upstream references [Orabug:34089586] + +* Tue Aug 13 2024 Richard W.M. Jones - 1:2.4.0-3 +- Fixes to improve installation of QEMU Guest Agent and removal + of VMware Tools + resolves: RHEL-54150, RHEL-54151 +- Allow --mac gw and len fields to be optional + resolves: RHEL-54152 + * Mon Jan 22 2024 Richard W.M. Jones - 1:2.4.0-2 - Rebase to virt-v2v 2.4.0 - -it ssh: Double quote ssh command which tests remote file exists