[Libguestfs] [V2V PATCH v3 4/6] convert_windows: set block driver priority according to block_driver option

Andrey Drobyshev andrey.drobyshev at virtuozzo.com
Fri Mar 10 17:54:31 UTC 2023


From: "Richard W.M. Jones" <rjones at redhat.com>

If "block_driver" option is set to Virtio_SCSI, prepend the block drivers
priority list with "vioscsi" so that we first search for "vioscsi.sys" during
the drivers injection phase.

Originally-by: Richard W.M. Jones <rjones at redhat.com>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com>
---
 convert/convert_windows.ml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 6c66869e..b5dc06ed 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -47,6 +47,14 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
    *)
   let virtio_win =
     Inject_virtio_win.from_environment g inspect.i_root Config.datadir in
+  (match block_driver with
+   | Virtio_blk -> () (* the default, no need to do anything *)
+   | Virtio_SCSI ->
+      let drivers = Inject_virtio_win.get_block_driver_priority virtio_win in
+      let drivers = "vioscsi" :: drivers in
+      Inject_virtio_win.set_block_driver_priority virtio_win drivers
+   | IDE -> assert false (* not possible - but maybe ...? *)
+  );
 
   (* If the Windows guest appears to be using group policy.
    *
-- 
2.31.1



More information about the Libguestfs mailing list