[Libguestfs] [COMMON PATCH v2 4/4] inject_virtio_win: write the proper block controller PCI ID to Win registry

Laszlo Ersek lersek at redhat.com
Mon Mar 13 08:07:03 UTC 2023


On 3/7/23 20:40, Andrey Drobyshev wrote:
> In case when we are injecting virtio-scsi device driver into the guest
> (rather than the default virtio-blk), make sure we write the right PCI ID
> value into the Windows guest registry.  This is essential for the guest
> to be bootable afterwards.
> 
> Originally-by: Roman Kagan <rkagan at virtuozzo.com>
> Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com>
> ---
>  mlcustomize/inject_virtio_win.ml | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/mlcustomize/inject_virtio_win.ml b/mlcustomize/inject_virtio_win.ml
> index 345fe32..922c1ab 100644
> --- a/mlcustomize/inject_virtio_win.ml
> +++ b/mlcustomize/inject_virtio_win.ml
> @@ -207,10 +207,16 @@ let rec inject_virtio_win_drivers ({ g } as t) reg =
>          let target = sprintf "%s/system32/drivers/%s.sys"
>                               t.i_windows_systemroot driver_name in
>          let target = g#case_sensitive_path target in
> +        let installed_block_type, legacy_pciid, modern_pciid = (
> +          if driver_name = "vioscsi" then
> +            Virtio_SCSI, vioscsi_legacy_pciid, vioscsi_modern_pciid
> +          else
> +            Virtio_blk, viostor_legacy_pciid, viostor_modern_pciid
> +        ) in

I *think* Rich prefers not adding parens in such cases. (I think they
are indeed not required, but I understand how they can be perceived as
helping with indentation.)

FWIW

Reviewed-by: Laszlo Ersek <lersek at redhat.com>


>          g#cp source target;
> -        add_guestor_to_registry t reg driver_name viostor_legacy_pciid;
> -        add_guestor_to_registry t reg driver_name viostor_modern_pciid;
> -        Virtio_blk in
> +        add_guestor_to_registry t reg driver_name legacy_pciid;
> +        add_guestor_to_registry t reg driver_name modern_pciid;
> +        installed_block_type in
>  
>      (* Can we install the virtio-net driver? *)
>      let net : net_type =




More information about the Libguestfs mailing list