Andrey Drobyshev
2023-Mar-10 17:54 UTC
[Libguestfs] [COMMON PATCH v3 4/4] inject_virtio_win: write the proper block controller PCI ID to Win registry
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 | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mlcustomize/inject_virtio_win.ml b/mlcustomize/inject_virtio_win.ml index eca0ad7..2a30b20 100644 --- a/mlcustomize/inject_virtio_win.ml +++ b/mlcustomize/inject_virtio_win.ml @@ -207,10 +207,15 @@ 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 + match driver_name with + | "vioscsi" -> Virtio_SCSI, vioscsi_legacy_pciid, vioscsi_modern_pciid + | _ -> Virtio_blk, viostor_legacy_pciid, viostor_modern_pciid + in 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 -- 2.31.1
Richard W.M. Jones
2023-Mar-10 19:40 UTC
[Libguestfs] [COMMON PATCH v3 4/4] inject_virtio_win: write the proper block controller PCI ID to Win registry
For the full v3 series (common/ and v2v/): Reviewed-by: Richard W.M. Jones <rjones at redhat.com> I'll give these a little while for others to comment before picking them upstream. Thanks, Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
Laszlo Ersek
2023-Mar-13 10:10 UTC
[Libguestfs] [COMMON PATCH v3 4/4] inject_virtio_win: write the proper block controller PCI ID to Win registry
On 3/10/23 18:54, 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 | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/mlcustomize/inject_virtio_win.ml b/mlcustomize/inject_virtio_win.ml > index eca0ad7..2a30b20 100644 > --- a/mlcustomize/inject_virtio_win.ml > +++ b/mlcustomize/inject_virtio_win.ml > @@ -207,10 +207,15 @@ 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 > + match driver_name with > + | "vioscsi" -> Virtio_SCSI, vioscsi_legacy_pciid, vioscsi_modern_pciid > + | _ -> Virtio_blk, viostor_legacy_pciid, viostor_modern_pciid > + in > 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_typeReviewed-by: Laszlo Ersek <lersek at redhat.com>