diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml index 38fa300b2..f6f09114b 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 74411695c..bdce0387d 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 9edf4ec6b..2046faef5 100644 --- a/v2v/windows_virtio.mli +++ b/v2v/windows_virtio.mli @@ -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