Tomáš Golembiovský
2020-Mar-02 11:25 UTC
[Libguestfs] [PATCH 0/1] Delay installation of QEMU-GA
This is a replacement for previously posted patch "Delay firstboot scripts to some later time": https://www.redhat.com/archives/libguestfs/2019-November/msg00134.html Instead of delaying all the firstboot scripts we just delay the QEMU-GA installation that we know is problematic. I will possibly send a similar patch for RHEV-APT installation later. Tom?? Golembiovsk? (1): windows: delay installation of qemu-ga MSI v2v/convert_windows.ml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) -- 2.25.0
Tomáš Golembiovský
2020-Mar-02 11:26 UTC
[Libguestfs] [PATCH 1/1] windows: delay installation of qemu-ga MSI
Instead of running firstboot script during early boot schedule a task
delayed for 1-2 minute.
During the first boot, after virt-v2v conversion, Windows installs the
drivers injected by virit-v2v. When this installation is finished
Windows enforces some kind of internal reboot. This unfortunately
terminates any running firstboot scritps thus killing the installation
of qemu-ga MSI.
Signed-off-by: Tom?? Golembiovsk? <tgolembi at redhat.com>
---
v2v/convert_windows.ml | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index 0fda1d4e..0a146006 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -429,14 +429,10 @@ popd
List.iter (
fun msi_path ->
let fb_script = "\
-echo Installing qemu-ga from " ^ msi_path ^ "
-\"\\" ^ msi_path ^ "\" /norestart /qn /l+*vx
\"%~dpn0.log\"
-set elvl=!errorlevel!
-echo Done installing qemu-ga error_level=!elvl!
-if !elvl! == 0 (
- echo Restarting Windows...
- shutdown /r /f /c \"rebooted by firstboot script\"
-)
+echo Removing any previously scheduled qemu-ga installation
+schtasks.exe /Delete /TN Firstboot-qemu-ga /F
+echo Scheduling delayed installation of qemu-ga from " ^ msi_path ^ "
+powershell.exe -command \"$d = (get-date).AddSeconds(119); schtasks.exe
/Create /SC ONCE /ST $d.ToString('HH:mm') /SD
$d.ToString('MM/dd/yyyy') /RU SYSTEM /TN Firstboot-qemu-ga /TR
\\\"C:\\" ^ msi_path ^ " /forcerestart /qn /l+*vx C:\\" ^
msi_path ^ ".log\\\"\"
" in
Firstboot.add_firstboot_script g inspect.i_root
("install " ^ msi_path) fb_script;
--
2.25.0
Daniel P. Berrangé
2020-Mar-02 11:35 UTC
Re: [Libguestfs] [PATCH 1/1] windows: delay installation of qemu-ga MSI
On Mon, Mar 02, 2020 at 12:26:00PM +0100, Tomáš Golembiovský wrote:> Instead of running firstboot script during early boot schedule a task > delayed for 1-2 minute.IIUC, you picked 119 seconds, so effectively 2 minutes. IOW, s/1-2/2/> During the first boot, after virt-v2v conversion, Windows installs the > drivers injected by virit-v2v. When this installation is finisheds/virit/virt/> Windows enforces some kind of internal reboot. This unfortunately > terminates any running firstboot scritps thus killing the installations/scritpts/scripts/> of qemu-ga MSI.IIUC, the expectation is that the Windows installation of the drivers will be completed *before* this 2 minute delay occurs. Windows will then reboot, and the delayed GA job will be run after this reboot ? The key question is how confident are we that the 2 minute delay is sufficient ? Is there chance of still hitting the problem if doing v2v on slow (ie HDD, not SSD) storage for example ?> > Signed-off-by: Tomáš Golembiovský <tgolembi@redhat.com> > --- > v2v/convert_windows.ml | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > > diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml > index 0fda1d4e..0a146006 100644 > --- a/v2v/convert_windows.ml > +++ b/v2v/convert_windows.ml > @@ -429,14 +429,10 @@ popd > List.iter ( > fun msi_path -> > let fb_script = "\ > -echo Installing qemu-ga from " ^ msi_path ^ " > -\"\\" ^ msi_path ^ "\" /norestart /qn /l+*vx \"%~dpn0.log\" > -set elvl=!errorlevel! > -echo Done installing qemu-ga error_level=!elvl! > -if !elvl! == 0 ( > - echo Restarting Windows... > - shutdown /r /f /c \"rebooted by firstboot script\" > -) > +echo Removing any previously scheduled qemu-ga installation > +schtasks.exe /Delete /TN Firstboot-qemu-ga /F > +echo Scheduling delayed installation of qemu-ga from " ^ msi_path ^ " > +powershell.exe -command \"$d = (get-date).AddSeconds(119); schtasks.exe /Create /SC ONCE /ST $d.ToString('HH:mm') /SD $d.ToString('MM/dd/yyyy') /RU SYSTEM /TN Firstboot-qemu-ga /TR \\\"C:\\" ^ msi_path ^ " /forcerestart /qn /l+*vx C:\\" ^ msi_path ^ ".log\\\"\" > " in > Firstboot.add_firstboot_script g inspect.i_root > ("install " ^ msi_path) fb_script; > -- > 2.25.0 > > > _______________________________________________ > Libguestfs mailing list > Libguestfs@redhat.com > https://www.redhat.com/mailman/listinfo/libguestfsRegards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
Seemingly Similar Threads
- [PATCH 0/1] Delay installation of QEMU-GA
- [PATCH v3] windows: delay installation of qemu-ga MSI
- [PATCH v4] windows: delay installation of qemu-ga MSI
- Re: [PATCH v3] windows: delay installation of qemu-ga MSI
- Re: [PATCH 1/1] windows: delay installation of qemu-ga MSI