From: "Richard W.M. Jones" <rjones(a)redhat.com>
When injecting a block VirtIO driver during conversion, we rely on the
predefined list of names of such drivers. Order in this list denotes the
priority (see common/mlcustomize/inject_virtio_win.ml).
This commit introduces the "block_driver" convert option, setting its
value to the default Virtio_blk and making sure it's being properly passed
to the conversion functions. Along with the means of altering the drivers
list (introduced in a separate commit in the common submodule), this option
will be brought to command line, giving us the opportunity to choose the
block driver to be used on conversion.
Originally-by: Richard W.M. Jones <rjones(a)redhat.com>
Signed-off-by: Andrey Drobyshev <andrey.drobyshev(a)virtuozzo.com>
---
convert/convert.ml | 9 ++++++---
convert/convert.mli | 1 +
convert/convert_linux.ml | 2 +-
convert/convert_linux.mli | 3 ++-
convert/convert_windows.ml | 2 +-
convert/convert_windows.mli | 3 ++-
in-place/in_place.ml | 3 ++-
inspector/inspector.ml | 3 ++-
v2v/v2v.ml | 3 ++-
9 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml
index 084619c8..9c76f76d 100644
--- a/convert/convert.ml
+++ b/convert/convert.ml
@@ -31,6 +31,7 @@ open Utils
module G = Guestfs
type options = {
+ block_driver : guestcaps_block_type;
keep_serial_console : bool;
ks : key_store;
network_map : Networks.t;
@@ -88,7 +89,7 @@ let rec convert dir options source =
(* Conversion. *)
let guestcaps =
do_convert g source inspect i_firmware
- options.keep_serial_console options.static_ips in
+ options.block_driver options.keep_serial_console options.static_ips in
g#umount_all ();
@@ -221,7 +222,8 @@ and do_fstrim g inspect =
) fses
(* Conversion. *)
-and do_convert g source inspect i_firmware keep_serial_console interfaces =
+and do_convert g source inspect i_firmware
+ block_driver keep_serial_console interfaces =
(match inspect.i_product_name with
| "unknown" ->
message (f_"Converting the guest to run on KVM")
@@ -246,7 +248,8 @@ and do_convert g source inspect i_firmware keep_serial_console
interfaces =
inspect.i_type inspect.i_distro in
debug "picked conversion module %s" conversion_name;
let guestcaps =
- convert g source inspect i_firmware keep_serial_console interfaces in
+ convert g source inspect i_firmware
+ block_driver keep_serial_console interfaces in
debug "%s" (string_of_guestcaps guestcaps);
(* Did we manage to install virtio drivers? *)
diff --git a/convert/convert.mli b/convert/convert.mli
index 3bd39e2d..c63bf6f0 100644
--- a/convert/convert.mli
+++ b/convert/convert.mli
@@ -17,6 +17,7 @@
*)
type options = {
+ block_driver : Types.guestcaps_block_type; (** [--block-driver] option *)
keep_serial_console : bool;
ks : Tools_utils.key_store; (** [--key] option *)
network_map : Networks.t; (** [-b] and [-n] options *)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index dab4f36d..8d702084 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -34,7 +34,7 @@ open Linux_kernels
module G = Guestfs
(* The conversion function. *)
-let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ =
+let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ =
(*----------------------------------------------------------------------*)
(* Inspect the guest first. We already did some basic inspection in
* the common v2v.ml code, but that has to deal with generic guests
diff --git a/convert/convert_linux.mli b/convert/convert_linux.mli
index 6eb272e9..dc6968fe 100644
--- a/convert/convert_linux.mli
+++ b/convert/convert_linux.mli
@@ -23,5 +23,6 @@
Mint and Kali are supported by this module. *)
val convert : Guestfs.guestfs -> Types.source -> Types.inspect ->
- Firmware.i_firmware -> bool -> Types.static_ip list ->
+ Firmware.i_firmware -> Types.guestcaps_block_type ->
+ bool -> Types.static_ip list ->
Types.guestcaps
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml
index 4f672487..1ace2948 100644
--- a/convert/convert_windows.ml
+++ b/convert/convert_windows.ml
@@ -38,7 +38,7 @@ module G = Guestfs
* time the Windows VM is booted on KVM.
*)
-let convert (g : G.guestfs) _ inspect i_firmware _ static_ips =
+let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips =
(*----------------------------------------------------------------------*)
(* Inspect the Windows guest. *)
diff --git a/convert/convert_windows.mli b/convert/convert_windows.mli
index 42dac9f5..33a14f65 100644
--- a/convert/convert_windows.mli
+++ b/convert/convert_windows.mli
@@ -21,5 +21,6 @@
This module converts a Windows guest to run on KVM. *)
val convert : Guestfs.guestfs -> Types.source -> Types.inspect ->
- Firmware.i_firmware -> bool -> Types.static_ip list ->
+ Firmware.i_firmware -> Types.guestcaps_block_type ->
+ bool -> Types.static_ip list ->
Types.guestcaps
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
index 68ef9965..2049db16 100644
--- a/in-place/in_place.ml
+++ b/in-place/in_place.ml
@@ -294,7 +294,8 @@ read the man page virt-v2v-in-place(1).
(* Get the conversion options. *)
let conv_options = {
- Convert.keep_serial_console = true;
+ Convert.block_driver = Virtio_blk;
+ keep_serial_console = true;
ks = opthandle.ks;
network_map;
root_choice;
diff --git a/inspector/inspector.ml b/inspector/inspector.ml
index a6428946..02d1a0e7 100644
--- a/inspector/inspector.ml
+++ b/inspector/inspector.ml
@@ -324,7 +324,8 @@ read the man page virt-v2v-inspector(1).
(* Get the conversion options. *)
let conv_options = {
- Convert.keep_serial_console = true;
+ Convert.block_driver = Virtio_blk;
+ keep_serial_console = true;
ks = opthandle.ks;
network_map;
root_choice;
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 13fe477a..22f7c631 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -524,7 +524,8 @@ read the man page virt-v2v(1).
(* Get the conversion options. *)
let conv_options = {
- Convert.keep_serial_console = not remove_serial_console;
+ Convert.block_driver = Virtio_blk;
+ keep_serial_console = not remove_serial_console;
ks = opthandle.ks;
network_map;
root_choice;
--
2.31.1