v2v: move virtio_win to windows_virtio

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@virtuozzo.com>
This commit is contained in:
Roman Kagan
2016-02-09 17:42:00 +03:00
committed by Richard W.M. Jones
parent 511280c076
commit 92ea4ed5f7
3 changed files with 15 additions and 16 deletions

View File

@@ -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 =

View File

@@ -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

View File

@@ -19,13 +19,12 @@
(** 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]
(** [install_drivers g inspect systemroot root current_cs]
installs virtio drivers from the driver directory or driver
ISO ([virtio_win]) into the guest driver directory and updates
the registry so that the [viostor.sys] driver gets loaded by
Windows at boot.
ISO into the guest driver directory and updates the registry
so that the [viostor.sys] driver gets loaded by Windows at boot.
[root] is the root node of the system hive (which is open for writes
when this function is called). [current_cs] is the name of the