Extend the guestcaps structure so it records whether a guest supports
(or drivers were added) for virtio-rng, the virtio memory balloon, and
the ISA pvpanic device.
---
v2v/convert_linux.ml | 3 +++
v2v/convert_windows.ml | 6 +++++-
v2v/linux_kernels.ml | 21 +++++++++++++++++----
v2v/linux_kernels.mli | 3 +++
v2v/types.ml | 3 +++
v2v/types.mli | 4 ++++
v2v/windows_virtio.ml | 10 ++++++++--
v2v/windows_virtio.mli | 5 +++--
8 files changed, 46 insertions(+), 9 deletions(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 46b989d5d..a65ce99b9 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -1042,6 +1042,9 @@ let rec convert (g : G.guestfs) inspect source output rcaps =
gcaps_block_bus = block_type;
gcaps_net_bus = net_type;
gcaps_video = video;
+ gcaps_virtio_rng = kernel.ki_supports_virtio_rng;
+ gcaps_virtio_balloon = kernel.ki_supports_virtio_balloon;
+ gcaps_isa_pvpanic = kernel.ki_supports_isa_pvpanic;
gcaps_arch = Utils.kvm_arch inspect.i_arch;
gcaps_acpi = acpi;
} in
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index 4fe671fab..dfb90d079 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -600,7 +600,8 @@ if errorlevel 3010 exit /b 0
configure_firstboot ();
(* Open the system hive for writes and update it. *)
- let block_driver, net_driver, video_driver =
+ let block_driver, net_driver, video_driver,
+ virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported =
Registry.with_hive_write g inspect.i_windows_system_hive
update_system_hive in
@@ -628,6 +629,9 @@ if errorlevel 3010 exit /b 0
gcaps_block_bus = block_driver;
gcaps_net_bus = net_driver;
gcaps_video = video_driver;
+ gcaps_virtio_rng = virtio_rng_supported;
+ gcaps_virtio_balloon = virtio_ballon_supported;
+ gcaps_isa_pvpanic = isa_pvpanic_supported;
gcaps_arch = Utils.kvm_arch inspect.i_arch;
gcaps_acpi = true;
} in
diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml
index 37b281bb0..5e96ad4c1 100644
--- a/v2v/linux_kernels.ml
+++ b/v2v/linux_kernels.ml
@@ -40,6 +40,9 @@ type kernel_info = {
ki_modules : string list;
ki_supports_virtio_blk : bool;
ki_supports_virtio_net : bool;
+ ki_supports_virtio_rng : bool;
+ ki_supports_virtio_balloon : bool;
+ ki_supports_isa_pvpanic : bool;
ki_is_xen_pv_only_kernel : bool;
ki_is_debug : bool;
ki_config_file : string option;
@@ -53,10 +56,11 @@ let print_kernel_info chan prefix ki =
fpf "%s\n" (match ki.ki_config_file with None -> "no config" |
Some s -> s);
fpf "%s\n" ki.ki_modpath;
fpf "%d modules found\n" (List.length ki.ki_modules);
- fpf "virtio: blk=%b net=%b\n"
- ki.ki_supports_virtio_blk ki.ki_supports_virtio_net;
- fpf "xen=%b debug=%b\n"
- ki.ki_is_xen_pv_only_kernel ki.ki_is_debug
+ fpf "virtio: blk=%b net=%b rng=%b balloon=%b\n"
+ ki.ki_supports_virtio_blk ki.ki_supports_virtio_net
+ ki.ki_supports_virtio_rng ki.ki_supports_virtio_balloon;
+ fpf "pvpanic=%b xen=%b debug=%b\n"
+ ki.ki_supports_isa_pvpanic ki.ki_is_xen_pv_only_kernel ki.ki_is_debug
let detect_kernels (g : G.guestfs) inspect family bootloader =
(* What kernel/kernel-like packages are installed on the current guest? *)
@@ -192,6 +196,12 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
kernel_supports "virtio_blk" "VIRTIO_BLK" in
let supports_virtio_net =
kernel_supports "virtio_net" "VIRTIO_NET" in
+ let supports_virtio_rng =
+ kernel_supports "virtio-rng" "HW_RANDOM_VIRTIO" in
+ let supports_virtio_balloon =
+ kernel_supports "virtio_balloon" "VIRTIO_BALLOON" in
+ let supports_isa_pvpanic =
+ kernel_supports "pvpanic" "PVPANIC" in
let is_xen_pv_only_kernel =
check_config "CONFIG_X86_XEN" config_file ||
check_config "CONFIG_X86_64_XEN" config_file in
@@ -215,6 +225,9 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
ki_modules = modules;
ki_supports_virtio_blk = supports_virtio_blk;
ki_supports_virtio_net = supports_virtio_net;
+ ki_supports_virtio_rng = supports_virtio_rng;
+ ki_supports_virtio_balloon = supports_virtio_balloon;
+ ki_supports_isa_pvpanic = supports_isa_pvpanic;
ki_is_xen_pv_only_kernel = is_xen_pv_only_kernel;
ki_is_debug = is_debug;
ki_config_file = config_file;
diff --git a/v2v/linux_kernels.mli b/v2v/linux_kernels.mli
index f536583ca..3702063d7 100644
--- a/v2v/linux_kernels.mli
+++ b/v2v/linux_kernels.mli
@@ -30,6 +30,9 @@ type kernel_info = {
ki_modules : string list; (** The list of module names. *)
ki_supports_virtio_blk : bool; (** Kernel supports virtio-blk? *)
ki_supports_virtio_net : bool; (** Kernel supports virtio-net? *)
+ ki_supports_virtio_rng : bool; (** Kernel supports virtio-rng? *)
+ ki_supports_virtio_balloon : bool; (** Kernel supports memory balloon? *)
+ ki_supports_isa_pvpanic : bool; (** Kernel supports ISA pvpanic device? *)
ki_is_xen_pv_only_kernel : bool; (** Is a Xen paravirt-only kernel? *)
ki_is_debug : bool; (** Is debug kernel? *)
ki_config_file : string option; (** Path of config file, if found. *)
diff --git a/v2v/types.ml b/v2v/types.ml
index 31cbbd2a8..a46c90439 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -396,6 +396,9 @@ type guestcaps = {
gcaps_block_bus : guestcaps_block_type;
gcaps_net_bus : guestcaps_net_type;
gcaps_video : guestcaps_video_type;
+ gcaps_virtio_rng : bool;
+ gcaps_virtio_balloon : bool;
+ gcaps_isa_pvpanic : bool;
gcaps_arch : string;
gcaps_acpi : bool;
}
diff --git a/v2v/types.mli b/v2v/types.mli
index c902b7abf..ca3697694 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -264,6 +264,10 @@ type guestcaps = {
installing drivers). Thus this is not known until after
conversion. *)
+ gcaps_virtio_rng : bool; (** Guest supports virtio-rng. *)
+ gcaps_virtio_balloon : bool; (** Guest supports virtio balloon. *)
+ gcaps_isa_pvpanic : bool; (** Guest supports ISA pvpanic device. *)
+
gcaps_arch : string; (** Architecture that KVM must emulate. *)
gcaps_acpi : bool; (** True if guest supports acpi. *)
}
diff --git a/v2v/windows_virtio.ml b/v2v/windows_virtio.ml
index 965d6ac8b..84a16e34e 100644
--- a/v2v/windows_virtio.ml
+++ b/v2v/windows_virtio.ml
@@ -61,7 +61,7 @@ let rec install_drivers ((g, _) as reg) inspect rcaps =
match net_type with
| Some model -> model
| None -> RTL8139 in
- (IDE, net_type, Cirrus)
+ (IDE, net_type, Cirrus, false, false, false)
)
else (
(* Can we install the block driver? *)
@@ -165,7 +165,13 @@ let rec install_drivers ((g, _) as reg) inspect rcaps =
| Some Cirrus, _ ->
Cirrus in
- (block, net, video)
+ (* Did we install the miscellaneous drivers? *)
+ let virtio_rng_supported = g#exists (driverdir // "viorng.inf") in
+ let virtio_ballon_supported = g#exists (driverdir // "balloon.inf") in
+ let isa_pvpanic_supported = g#exists (driverdir // "pvpanic.inf") in
+
+ (block, net, video,
+ virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported)
)
and add_guestor_to_registry ((g, root) as reg) inspect drv_name drv_pciid =
diff --git a/v2v/windows_virtio.mli b/v2v/windows_virtio.mli
index 0bc6faaa2..166e9ecfa 100644
--- a/v2v/windows_virtio.mli
+++ b/v2v/windows_virtio.mli
@@ -20,7 +20,7 @@
val install_drivers
: Registry.t -> Types.inspect -> Types.requested_guestcaps ->
- Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type
+ Types.guestcaps_block_type * Types.guestcaps_net_type * Types.guestcaps_video_type
* bool * bool * bool
(** [install_drivers reg inspect rcaps]
installs virtio drivers from the driver directory or driver
ISO into the guest driver directory and updates the registry
@@ -34,7 +34,8 @@ val install_drivers
install_drivers will adjust its choices based on that information, and
abort if the requested driver wasn't found.
- This returns the tuple [(block_driver, net_driver, video_driver)]
+ This returns the tuple [(block_driver, net_driver, video_driver,
+ virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported)]
reflecting what devices are now required by the guest, either
virtio devices if we managed to install those, or legacy devices
if we didn't. *)
--
2.12.0