Retry qemu-guest-agent MSI installer on failure

resolves: RHEL-186301
This commit is contained in:
Richard W.M. Jones 2026-07-08 11:30:42 +01:00
parent 2d284b6337
commit 47edba3dc1
2 changed files with 62 additions and 2 deletions

View File

@ -0,0 +1,57 @@
From daace3c86114e0ca41ce70342a3ed9034da5ae8a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 7 Jul 2026 06:45:35 +0100
Subject: [PATCH] common: update submodule
Richard W.M. Jones (3):
mlcustomize/inject_virtio_win.ml: Rewrite qemu-ga firstboot using {| |}
mlcustomize/inject_virtio_win.ml: Abstract $msi and $logfile
mlcustomize/inject_virtio_win.ml: Retry qemu-ga installation
(cherry picked from commit 24e47c2b92b19d184bb0057f5e978c998c2d78d1)
---
common | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Submodule common 5f2eea09..f865077d:
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
index ce24332f..0e5dcf05 100644
--- a/common/mlcustomize/inject_virtio_win.ml
+++ b/common/mlcustomize/inject_virtio_win.ml
@@ -556,11 +556,31 @@ 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)
+ add (sprintf {|$msi = "%s\%s"|} tempdir_win msi);
+ add {|$logfile = "$msi.log"|};
+ add {|$maxAttempts = 10|};
+ add {|$retryDelay = 60|};
+ add {|for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) {|};
+ add {| Write-Host "Attempt $attempt of $maxAttempts"|};
+ add {| Write-Host "Writing log to $logfile"|};
+ (* [`] is an escape char for double quotes.
+ * [-PassThru] ensures that [Start-Process] returns the cmd object
+ * so we can get the exit code.
+ *)
+ add {| $proc = Start-Process -Wait -PassThru -FilePath "$msi" -ArgumentList "/norestart","/qn","/l+*vx","`"$logfile`""|};
+ add {| $exitCode = $proc.ExitCode|};
+ add {| Write-Host "Exit code: $exitCode"|};
+ add {| if ($exitCode -eq 0) {|};
+ add {| Write-Host "QEMU Guest Agent installed successfully"|};
+ add {| break|};
+ add {| }|};
+ add {| if ($attempt -lt $maxAttempts) {|};
+ add {| Write-Host "Install failed, retrying in $retryDelay seconds..."|};
+ add {| Start-Sleep -Seconds $retryDelay|};
+ add {| } else {|};
+ add {| Write-Host "Install failed after $maxAttempts attempts"|};
+ add {| }|};
+ add {|}|}
) files;
Firstboot.add_firstboot_powershell t.g t.root "install-qemu-ga" !script

View File

@ -45,7 +45,7 @@ ExclusiveArch: x86_64
Name: virt-v2v
Epoch: 1
Version: 2.11.9
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
@ -74,6 +74,7 @@ Patch0006: 0006-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0007: 0007-RHEL-tests-Remove-btrfs-test.patch
Patch0008: 0008-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
Patch0009: 0009-RHEL-output-output.ml-Remove-reduce-memory-pressure-.patch
Patch0010: 0010-common-update-submodule.patch
BuildRequires: autoconf, automake, libtool
BuildRequires: make
@ -379,7 +380,7 @@ done
%changelog
* Fri Jul 03 2026 Richard W.M. Jones <rjones@redhat.com> - 1:2.11.9-1
* Wed Jul 08 2026 Richard W.M. Jones <rjones@redhat.com> - 1:2.11.9-2
- Rebase to virt-v2v 2.11.9
Synchronize spec file with Fedora
resolves: RHEL-153361
@ -409,6 +410,8 @@ done
- Allow conversion with immutable resolv.conf
related: RHEL-178556
- Add note about PowerShell ExecutionPolicy AllSigned (MTV-4424)
- Retry qemu-guest-agent MSI installer on failure
resolves: RHEL-186301
* Fri Apr 03 2026 Richard W.M. Jones <rjones@redhat.com> - 1:2.10.0-9
- Add --no-fstrim option