Now that all the stuff related to Windows virtio drivers has been moved
into a dedicated module, it makes sense to move the definition of
virtio_win there, too, and stop passing it around as a parameter.
Signed-off-by: Roman Kagan <rkagan(a)virtuozzo.com>
---
v2v/convert_windows.ml | 9 +--------
v2v/windows_virtio.ml | 13 ++++++++++---
v2v/windows_virtio.mli | 2 +-
3 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index 38fa300..f6f0911 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -43,13 +43,6 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source =
try Sys.getenv "VIRT_TOOLS_DATA_DIR"
with Not_found -> Guestfs_config.datadir // "virt-tools" in
- let virtio_win =
- try Sys.getenv "VIRTIO_WIN"
- with Not_found ->
- try Sys.getenv "VIRTIO_WIN_DIR" (* old name for VIRTIO_WIN *)
- with Not_found ->
- Guestfs_config.datadir // "virtio-win" in
-
(* Check if RHEV-APT exists. This is optional. *)
let rhev_apt_exe = virt_tools_data_dir // "rhev-apt.exe" in
let rhev_apt_exe =
@@ -289,7 +282,7 @@ if errorlevel 3010 exit /b 0
disable_services root current_cs;
disable_autoreboot root current_cs;
- Windows_virtio.install_drivers g inspect systemroot virtio_win
+ Windows_virtio.install_drivers g inspect systemroot
root current_cs
and disable_services root current_cs =
diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
index 7441169..bdce038 100644
--- a/v2v/windows_virtio.ml
+++ b/v2v/windows_virtio.ml
@@ -26,12 +26,19 @@ open Regedit
open Types
open Utils
-let rec install_drivers g inspect systemroot virtio_win root current_cs =
+let virtio_win =
+ try Sys.getenv "VIRTIO_WIN"
+ with Not_found ->
+ try Sys.getenv "VIRTIO_WIN_DIR" (* old name for VIRTIO_WIN *)
+ with Not_found ->
+ Guestfs_config.datadir // "virtio-win"
+
+let rec install_drivers g inspect systemroot root current_cs =
(* Copy the virtio drivers to the guest. *)
let driverdir = sprintf "%s/Drivers/VirtIO" systemroot in
g#mkdir_p driverdir;
- if not (copy_drivers g inspect virtio_win driverdir) then (
+ if not (copy_drivers g inspect driverdir) then (
warning (f_"there are no virtio drivers available for this version of Windows
(%d.%d %s %s). virt-v2v looks for drivers in %s\n\nThe guest will be configured to use
slower emulated devices.")
inspect.i_major_version inspect.i_minor_version inspect.i_arch
inspect.i_product_variant virtio_win;
@@ -349,7 +356,7 @@ and add_viostor_to_driver_database g root arch current_cs =
(* Copy the matching drivers to the driverdir; return true if any have
* been copied.
*)
-and copy_drivers g inspect virtio_win driverdir =
+and copy_drivers g inspect driverdir =
let ret = ref false in
if is_directory virtio_win then (
let cmd = sprintf "cd %s && find -type f" (quote virtio_win) in
diff --git a/v2v/windows_virtio.mli b/v2v/windows_virtio.mli
index 9edf4ec..eb7a57a 100644
--- a/v2v/windows_virtio.mli
+++ b/v2v/windows_virtio.mli
@@ -19,7 +19,7 @@
(** Functions for installing Windows virtio drivers. *)
val install_drivers
- : Guestfs.guestfs -> Types.inspect -> string -> string -> int64 ->
string ->
+ : Guestfs.guestfs -> Types.inspect -> string -> int64 -> string ->
Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type
(** [install_drivers g inspect systemroot virtio_win root current_cs]
installs virtio drivers from the driver directory or driver
--
2.5.0