diff --git a/0014-i-ova-Ignore-dot-underscore-files-in-OVA-files.patch b/0014-i-ova-Ignore-dot-underscore-files-in-OVA-files.patch new file mode 100644 index 0000000..bfe775c --- /dev/null +++ b/0014-i-ova-Ignore-dot-underscore-files-in-OVA-files.patch @@ -0,0 +1,43 @@ +From af17b542c5b1a427c80f8eed7b6b5b48dc64ed0d Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 25 Jul 2024 08:53:46 +0100 +Subject: [PATCH] -i ova: Ignore dot-underscore-files in OVA files + +I received an OVA created by a mac which contained various files +prefixed by "._" that contain some sort of extra information. Ignore +those files when decoding OVAs: + +$ tar tvf win22ktest.tar 2>/dev/null +drwxr-xr-x markd/staff 0 2024-07-23 18:23 win22test/ +-rw-r--r-- markd/staff 619 2024-07-23 15:16 win22test/._win22test.mf +-rw-r--r-- markd/staff 271 2024-07-23 15:16 win22test/win22test.mf +-rw-r--r-- markd/staff 623 2024-07-23 15:16 win22test/._win22test-1.vmdk +-rw-r--r-- markd/staff 8348649984 2024-07-23 15:16 win22test/win22test-1.vmdk +-rw-r--r-- markd/staff 624 2024-07-23 15:00 win22test/._win22test-2.nvram +-rw-r--r-- markd/staff 270840 2024-07-23 15:00 win22test/win22test-2.nvram +-rw-r--r-- markd/staff 620 2024-07-23 15:00 win22test/._win22test.ovf +-rw-r--r-- markd/staff 12052 2024-07-23 15:00 win22test/win22test.ovf + +(cherry picked from commit 3d26e48af39b26f3c8a368ce320555b995bdf20b) +--- + input/OVA.ml | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/input/OVA.ml b/input/OVA.ml +index 8d4606ef..1db337a7 100644 +--- a/input/OVA.ml ++++ b/input/OVA.ml +@@ -253,8 +253,13 @@ and find_files dir ext = + | [] -> [] + | dir :: rest -> + let files = Array.to_list (Sys.readdir dir) in ++ (* Ignore dot-underscore-files, added when using 'tar' on some Macs. *) ++ let files = ++ List.filter (fun x -> not (String.is_prefix x "._")) files in ++ (* Prefix with the directory to form a path. *) + let files = List.map (Filename.concat dir) files in + let dirs, files = List.partition Sys.is_directory files in ++ (* Only files with the given extension. *) + let files = + List.filter (fun x -> Filename.check_suffix x ext) files in + files @ loop (rest @ dirs) diff --git a/0015-Update-common-submodule.patch b/0015-Update-common-submodule.patch new file mode 100644 index 0000000..b4b054c --- /dev/null +++ b/0015-Update-common-submodule.patch @@ -0,0 +1,109 @@ +From 8f8cd939ec7cbddad48cb03e522a21525b2a7706 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/virt-v2v.spec b/virt-v2v.spec index 6f638cd..d7cc181 100644 --- a/virt-v2v.spec +++ b/virt-v2v.spec @@ -8,7 +8,7 @@ Name: virt-v2v Epoch: 1 Version: 2.5.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Convert a virtual machine to run on KVM License: GPL-2.0-or-later AND LGPL-2.0-or-later @@ -41,6 +41,8 @@ Patch0010: 0010-RHEL-9-oo-compressed-Remove-nbdcopy-version-check-an.patch Patch0011: 0011-RHEL-9-tests-Remove-btrfs-test.patch Patch0012: 0012-RHEL-9-Remove-block-driver-option.patch Patch0013: 0013-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch +Patch0014: 0014-i-ova-Ignore-dot-underscore-files-in-OVA-files.patch +Patch0015: 0015-Update-common-submodule.patch %if !0%{?rhel} # libguestfs hasn't been built on i686 for a while since there is no @@ -344,6 +346,10 @@ make -C tests TESTS=test-v2v-fedora-luks-on-lvm-conversion.sh check %changelog +* Thu Jul 25 2024 Richard W.M. Jones - 1:2.5.5-2 +- Fix installation of QEMU Guest Agent + resolves: RHEL-49761 + * Thu Jul 11 2024 Richard W.M. Jones - 1:2.5.5-1 - Rebase to virt-v2v 2.5.5 - Enhance -o kubevirt output