Fix installation of QEMU Guest Agent

resolves: RHEL-50563
This commit is contained in:
Richard W.M. Jones 2024-07-25 12:09:11 +01:00
parent b9f8a1595b
commit 32c889ac2d
5 changed files with 222 additions and 8 deletions

View File

@ -1,4 +1,4 @@
From e22fef42bd60cfe68320dcebc8c6520cff401e17 Mon Sep 17 00:00:00 2001
From 16f4c800bf86c8e527daa69c5ff715ec88fdd763 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 8 Jul 2024 09:56:54 +0100
Subject: [PATCH] RHEL: Remove -o rhv, -o rhv-upload and -o vdsm modes
@ -40,8 +40,8 @@ Fixes: https://issues.redhat.com/browse/RHEL-36712
tests/test-v2v-o-vdsm-oo-query.sh | 41 --
tests/test-v2v-o-vdsm-options.ovf.expected | 113 ----
tests/test-v2v-o-vdsm-options.sh | 96 ----
v2v/v2v.ml | 10 +-
36 files changed, 4 insertions(+), 4206 deletions(-)
v2v/v2v.ml | 31 +-
36 files changed, 5 insertions(+), 4226 deletions(-)
delete mode 100644 docs/virt-v2v-output-rhv.pod
delete mode 100644 output/output_rhv.ml
delete mode 100644 output/output_rhv.mli
@ -4635,7 +4635,7 @@ index e8f8c538..00000000
-diff -u "$srcdir/test-v2v-o-vdsm-options.ovf.expected" \
- "$OVF"
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index fb1ee64d..447bc598 100644
index fb1ee64d..cfe3ac5d 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -199,11 +199,7 @@ let rec main () =
@ -4650,7 +4650,63 @@ index fb1ee64d..447bc598 100644
| s ->
error (f_"unknown -o option: %s") s
in
@@ -471,10 +467,7 @@ read the man page virt-v2v(1).
@@ -243,7 +239,7 @@ let rec main () =
s_"Map network in to out";
[ L"no-trim" ], Getopt.String ("-", no_trim_warning),
s_"Ignored for backwards compatibility";
- [ S 'o' ], Getopt.String ("kubevirt|libvirt|local|null|openstack|qemu|rhv|rhv-upload|vdsm", set_output_mode),
+ [ S 'o' ], Getopt.String ("kubevirt|libvirt|local|null|openstack|qemu", set_output_mode),
s_"Set output mode (default: libvirt)";
[ M"oa" ], Getopt.String ("sparse|preallocated", set_output_alloc),
s_"Set output allocation mode";
@@ -281,18 +277,6 @@ let rec main () =
s_"Same as -io vddk-thumbprint=thumbprint";
[ L"vddk-transports" ], Getopt.String ("transports", set_input_option_compat "vddk-transports"),
s_"Same as -io vddk-transports=transports";
- [ L"vdsm-compat" ], Getopt.String ("0.10|1.1", set_output_option_compat "vdsm-compat"),
- s_"Same as -oo vdsm-compat=0.10|1.1";
- [ L"vdsm-image-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-image-uuid"),
- s_"Same as -oo vdsm-image-uuid=uuid";
- [ L"vdsm-vol-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vol-uuid"),
- s_"Same as -oo vdsm-vol-uuid=uuid";
- [ L"vdsm-vm-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vm-uuid"),
- s_"Same as -oo vdsm-vm-uuid=uuid";
- [ L"vdsm-ovf-output" ], Getopt.String ("dir", set_output_option_compat "vdsm-ovf-output"),
- s_"Same as -oo vdsm-ovf-output=dir";
- [ L"vdsm-ovf-flavour" ], Getopt.String ("ovirt|rhvexp", set_output_option_compat "vdsm-ovf-flavour"),
- s_"Same as -oo vdsm-ovf-flavour=flavour";
[ L"vmtype" ], Getopt.String ("-", vmtype_warning),
s_"Ignored for backwards compatibility";
] in
@@ -304,9 +288,6 @@ let rec main () =
virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi -os imported esx_guest
-virt-v2v -ic vpx://vcenter.example.com/Datacenter/esxi esx_guest \
- -o rhv -os rhv.nfs:/export_domain --network ovirtmgmt
-
virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp
virt-v2v -i disk disk.img -o local -os /var/tmp
@@ -368,7 +349,6 @@ read the man page virt-v2v(1).
pr "vcenter-https\n";
pr "vddk\n";
pr "colours-option\n";
- pr "vdsm-compat-option\n";
pr "io/oo\n";
pr "mac-option\n";
pr "bandwidth-option\n";
@@ -384,9 +364,6 @@ read the man page virt-v2v(1).
pr "output:null\n";
pr "output:openstack\n";
pr "output:qemu\n";
- pr "output:rhv\n";
- pr "output:rhv-upload\n";
- pr "output:vdsm\n";
pr "convert:linux\n";
pr "convert:windows\n";
List.iter (pr "ovf:%s\n") Create_ovf.ovf_flavours;
@@ -471,10 +448,7 @@ read the man page virt-v2v(1).
| `Null -> (module Output_null.Null)
| `QEmu -> (module Output_qemu.QEMU)
| `Kubevirt -> (module Output_kubevirt.Kubevirt)
@ -4662,7 +4718,7 @@ index fb1ee64d..447bc598 100644
let output_options = {
Output.output_alloc = output_alloc;
@@ -499,7 +492,6 @@ read the man page virt-v2v(1).
@@ -499,7 +473,6 @@ read the man page virt-v2v(1).
*)
let remove_serial_console =
match output_mode with

View File

@ -1,4 +1,4 @@
From cd4d2308d40894a160a82214338b37fb8b4ff6cf Mon Sep 17 00:00:00 2001
From c76552605d636820e01d0ccfe7250539f65bd26e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 9 Jul 2024 11:30:09 +0100
Subject: [PATCH] RHEL: Add warning about virt-v2v-in-place not being supported

View File

@ -0,0 +1,43 @@
From de867ec1e519a621664cba25ad5e778da3dfec1e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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)

View File

@ -0,0 +1,109 @@
From 04a435eb547e8eb25e6666ea398948bec40c3a86 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
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 "\

View File

@ -7,7 +7,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
@ -40,6 +40,8 @@ Patch0010: 0010-RHEL-tests-Remove-btrfs-test.patch
Patch0011: 0011-RHEL-Remove-block-driver-option.patch
Patch0012: 0012-RHEL-Remove-o-rhv-o-rhv-upload-and-o-vdsm-modes.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
@ -327,6 +329,10 @@ done
%changelog
* Thu Jul 25 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.5-2
- Fix installation of QEMU Guest Agent
resolves: RHEL-50563
* Thu Jul 11 2024 Richard W.M. Jones <rjones@redhat.com> - 1:2.5.5-1
- New upstream development version 2.5.5
resolves: RHEL-46869