|
|
46b2f6 |
From 34a8b1a7115aeb95812ae8ee182055de757f3892 Mon Sep 17 00:00:00 2001
|
|
|
46b2f6 |
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Golembiovsk=C3=BD?= <tgolembi@redhat.com>
|
|
|
46b2f6 |
Date: Thu, 5 Mar 2020 15:37:13 +0100
|
|
|
46b2f6 |
Subject: [PATCH] windows: delay installation of qemu-ga MSI
|
|
|
46b2f6 |
MIME-Version: 1.0
|
|
|
46b2f6 |
Content-Type: text/plain; charset=UTF-8
|
|
|
46b2f6 |
Content-Transfer-Encoding: 8bit
|
|
|
46b2f6 |
|
|
|
46b2f6 |
Instead of running firstboot script during early boot schedule a task
|
|
|
46b2f6 |
delayed for 2 minutes.
|
|
|
46b2f6 |
|
|
|
46b2f6 |
During the first boot, after virt-v2v conversion, Windows installs the
|
|
|
46b2f6 |
drivers injected by virt-v2v. When this installation is finished
|
|
|
46b2f6 |
Windows enforces some kind of internal reboot. This unfortunately
|
|
|
46b2f6 |
terminates any running firstboot scripts thus killing the installation
|
|
|
46b2f6 |
of qemu-ga MSI.
|
|
|
46b2f6 |
|
|
|
46b2f6 |
This is just a best-effort mitigation. It can still happen (e.g. with
|
|
|
46b2f6 |
slow disk drives) that the drivers are not yet installed when the
|
|
|
46b2f6 |
delayed installation starts. On the other hand we cannot delay it too
|
|
|
46b2f6 |
much otherwise we risk that the users logs in and will be doing some
|
|
|
46b2f6 |
work when the MSI installation starts. After MSI installation finishes
|
|
|
46b2f6 |
the VM needs to be rebooted which would be annoying if that would happen
|
|
|
46b2f6 |
under users hands. Although this is not a best fix (that may come later
|
|
|
46b2f6 |
as it is more complex, e.g. introducing waiting mechanism), the delay as
|
|
|
46b2f6 |
it is defined works in most cases. And it dramaticaly improves the
|
|
|
46b2f6 |
situations -- originaly I experienced more than 90% failure rate.
|
|
|
46b2f6 |
|
|
|
46b2f6 |
Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com>
|
|
|
46b2f6 |
|
|
|
46b2f6 |
(cherry picked from commit dc66e78fa37db33e3c7358b7f7c7fa809cf62f9d
|
|
|
46b2f6 |
in virt-v2v)
|
|
|
46b2f6 |
---
|
|
|
46b2f6 |
v2v/convert_windows.ml | 17 +++++++----------
|
|
|
46b2f6 |
1 file changed, 7 insertions(+), 10 deletions(-)
|
|
|
46b2f6 |
|
|
|
46b2f6 |
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
|
|
|
46b2f6 |
index 43c1f85de..088cd33d9 100644
|
|
|
46b2f6 |
--- a/v2v/convert_windows.ml
|
|
|
46b2f6 |
+++ b/v2v/convert_windows.ml
|
|
|
46b2f6 |
@@ -428,16 +428,13 @@ popd
|
|
|
46b2f6 |
and configure_qemu_ga files =
|
|
|
46b2f6 |
List.iter (
|
|
|
46b2f6 |
fun msi_path ->
|
|
|
46b2f6 |
- let fb_script = "\
|
|
|
46b2f6 |
-echo Installing qemu-ga from " ^ msi_path ^ "
|
|
|
46b2f6 |
-\"\\" ^ msi_path ^ "\" /norestart /qn /l+*vx \"%~dpn0.log\"
|
|
|
46b2f6 |
-set elvl=!errorlevel!
|
|
|
46b2f6 |
-echo Done installing qemu-ga error_level=!elvl!
|
|
|
46b2f6 |
-if !elvl! == 0 (
|
|
|
46b2f6 |
- echo Restarting Windows...
|
|
|
46b2f6 |
- shutdown /r /f /c \"rebooted by firstboot script\"
|
|
|
46b2f6 |
-)
|
|
|
46b2f6 |
-" in
|
|
|
46b2f6 |
+ let fb_script = sprintf "\
|
|
|
46b2f6 |
+echo Removing any previously scheduled qemu-ga installation
|
|
|
46b2f6 |
+schtasks.exe /Delete /TN Firstboot-qemu-ga /F
|
|
|
46b2f6 |
+echo Scheduling delayed installation of qemu-ga from %s
|
|
|
46b2f6 |
+powershell.exe -command \"$d = (get-date).AddSeconds(120); schtasks.exe /Create /SC ONCE /ST $d.ToString('HH:mm') /SD $d.ToString('MM/dd/yyyy') /RU SYSTEM /TN Firstboot-qemu-ga /TR \\\"C:\\%s /forcerestart /qn /l+*vx C:\\%s.log\\\"\"
|
|
|
46b2f6 |
+ "
|
|
|
46b2f6 |
+ msi_path msi_path msi_path in
|
|
|
46b2f6 |
Firstboot.add_firstboot_script g inspect.i_root
|
|
|
46b2f6 |
("install " ^ msi_path) fb_script;
|
|
|
46b2f6 |
) files
|
|
|
46b2f6 |
--
|
|
|
46b2f6 |
2.24.1
|
|
|
46b2f6 |
|