Andrey Drobyshev
2023-Mar-16 17:34 UTC
[Libguestfs] [V2V PATCH v4 0/2] convert_windows: add firstboot script to install drivers with pnputil
While messing around this script, I added one more tiny patch making wait-pnp log its output into the common log.txt file, as suggested by Richard here: https://listman.redhat.com/archives/libguestfs/2023-March/031023.html Discussion on v3: https://listman.redhat.com/archives/libguestfs/2023-March/031070.html v3 -> v4: * Remove unneeded line break from the script; * Add another small patch removing separate log file from wait-pnp script. Discussion on v2: https://listman.redhat.com/archives/libguestfs/2023-March/031025.html v2 -> v3: * Prioritize firstboot script with ~prio:2000. That value is chosen to be higher than that of "v2vnetcf.ps1". Discussion on v1: https://listman.redhat.com/archives/libguestfs/2023-March/031001.html v1 -> v2: * Omit redirecting output to a separate log with "%~dpn0.log". Andrey Drobyshev (2): convert_windows: add firstboot script to install drivers with pnputil convert_windows: configure_wait_pnp: do not create a separate log file convert/convert_windows.ml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) -- 2.31.1
Andrey Drobyshev
2023-Mar-16 17:34 UTC
[Libguestfs] [V2V PATCH v4 1/2] convert_windows: add firstboot script to install drivers with pnputil
During conversion we copy the necessary drivers to the directory "%systemroot%\Drivers\Virtio", adding it to the DevicePath registry value. As documented in [1], this should be enough for Windows to find device drivers and successfully install them. However, it doesn't always happen. Commit 73e009c04 ("v2v: windows: Document use of pnputil to install drivers.") describes such issues with Win2k12R2. I'm seeing the same problem with Win2k16 and netkvm.sys driver not being installed. That same commit 73e009c04 suggests adding a firstboot script invoking pnputil at an early stage to install all the drivers we put into the drivers store. So let's add such a script to make sure all the necessary drivers are installed. [1] https://learn.microsoft.com/en-us/windows-hardware/drivers/install/how-windows-selects-a-driver-for-a-device Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com> Acked-by: Laszlo Ersek <lersek at redhat.com> --- convert/convert_windows.ml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index b5dc06ed..a269a50e 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -295,9 +295,11 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips | Virt -> Virt and configure_firstboot () - (* Note that pnp_wait.exe must be the first firstboot script as it - * suppresses PnP for all following scripts. + (* Run the firstboot script with pnputil.exe before the one with + * pnp_wait.exe as the latter suppresses PnP for all following scripts. *) + configure_pnputil_install (); + let tool_path = virt_tools_data_dir () // "pnp_wait.exe" in if Sys.file_exists tool_path then configure_wait_pnp tool_path @@ -345,6 +347,17 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips strkey name value | None -> sprintf "reg delete \"%s\" /v %s /f" strkey name + and configure_pnputil_install () + let fb_script = "@echo off\n\ + \n\ + echo Wait for VirtIO drivers to be installed\n\ + %systemroot%\\Sysnative\\PnPutil -i -a \ + %systemroot%\\Drivers\\Virtio\\*.inf" in + + (* Set priority higher than that of "v2vnetcf.ps1" firstboot script. *) + Firstboot.add_firstboot_script g inspect.i_root ~prio:2000 + "pnputil install drivers" fb_script; + and configure_wait_pnp tool_path (* Prevent destructive interactions of firstboot with PnP. *) -- 2.31.1
Andrey Drobyshev
2023-Mar-16 17:34 UTC
[Libguestfs] [V2V PATCH v4 2/2] convert_windows: configure_wait_pnp: do not create a separate log file
Right now wait-pnp is the only firstboot script which does its logging into a separate log file. Let's align its behaviour with that of the the other scripts so that logs go to the common log file, i.e. "C:\Program Files\Guestfs\Firstboot\log.txt". Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com> --- convert/convert_windows.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index a269a50e..122d9546 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -400,7 +400,7 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips "@echo off\n\ \n\ echo Wait for PnP to complete\n\ - \"%s\" >\"%%~dpn0.log\" 2>&1\n\ + \"%s\"\n\ %s" (String.replace_char pnp_wait_path '/' '\\') reg_restore_str in -- 2.31.1
Laszlo Ersek
2023-Mar-20 05:33 UTC
[Libguestfs] [V2V PATCH v4 0/2] convert_windows: add firstboot script to install drivers with pnputil
On 3/16/23 18:34, Andrey Drobyshev wrote:> While messing around this script, I added one more tiny patch making > wait-pnp log its output into the common log.txt file, as suggested by > Richard here: > https://listman.redhat.com/archives/libguestfs/2023-March/031023.html > > Discussion on v3: > > https://listman.redhat.com/archives/libguestfs/2023-March/031070.html > > v3 -> v4: > > * Remove unneeded line break from the script; > * Add another small patch removing separate log file from wait-pnp > script. > > Discussion on v2: > > https://listman.redhat.com/archives/libguestfs/2023-March/031025.html > > v2 -> v3: > > * Prioritize firstboot script with ~prio:2000. That value is chosen to > be higher than that of "v2vnetcf.ps1". > > Discussion on v1: > > https://listman.redhat.com/archives/libguestfs/2023-March/031001.html > > v1 -> v2: > > * Omit redirecting output to a separate log with "%~dpn0.log". > > Andrey Drobyshev (2): > convert_windows: add firstboot script to install drivers with pnputil > convert_windows: configure_wait_pnp: do not create a separate log file > > convert/convert_windows.ml | 19 ++++++++++++++++--- > 1 file changed, 16 insertions(+), 3 deletions(-) >"make check" passes for me with this series applied. Merged as commit range 94b249b6e58b..b42e44da837c. Thanks Laszlo
Maybe Matching Threads
- [V2V PATCH v2 0/1] convert_windows: add firstboot script to install drivers with pnputil
- [V2V PATCH 1/1] convert_windows: add firstboot script to install drivers with pnputil
- [V2V PATCH v2 1/1] convert_windows: add firstboot script to install drivers with pnputil
- [V2V PATCH 0/1] convert_windows: add firstboot script to install drivers with pnputil
- [V2V PATCH 1/1] convert_windows: add firstboot script to install drivers with pnputil