[v2v PATCH v2 0/3] Use libosinfo for query device drivers
by Pino Toscano
This patch series integrates libosinfo in virt-v2v to get the list of
files for Windows from libosinfo, if possible. The actual data is still
from virtio-win, just unpacked.
Changes from v1:
- adapt to use the priority in libosinfo 1.7.0+
- filter out non-pre-installable drivers
- collect all the drivers matching the requirements, not just the first,
sorting them by priority like libosinfo does to get the best ones
- actually upload the files by the lowercase file name
- few minor fixes
Pino Toscano (3):
build: require libosinfo
v2v: add a minimal libosinfo interface
v2v: try to get windows driver files from libosinfo
m4/guestfs-v2v.m4 | 3 +
v2v/Makefile.am | 9 +-
v2v/libosinfo-c.c | 237 ++++++++++++++++++++++++++++++++++++++++
v2v/libosinfo.ml | 53 +++++++++
v2v/libosinfo.mli | 48 ++++++++
v2v/libosinfo_utils.ml | 34 ++++++
v2v/libosinfo_utils.mli | 26 +++++
v2v/windows_virtio.ml | 78 ++++++++++++-
8 files changed, 483 insertions(+), 5 deletions(-)
create mode 100644 v2v/libosinfo-c.c
create mode 100644 v2v/libosinfo.ml
create mode 100644 v2v/libosinfo.mli
create mode 100644 v2v/libosinfo_utils.ml
create mode 100644 v2v/libosinfo_utils.mli
--
2.24.1
4 years, 9 months
[v2v PATCH 1/2] Add back guestcaps as parameter of output#prepare_targets
by Pino Toscano
It will be used to do extra checks in the output before copying the
disks.
Partially revert commit 3bafec4e693a25ef1c84abc0fd1bc3251862c7de.
---
v2v/output_glance.ml | 2 +-
v2v/output_json.ml | 2 +-
v2v/output_libvirt.ml | 2 +-
v2v/output_local.ml | 2 +-
v2v/output_null.ml | 2 +-
v2v/output_openstack.ml | 2 +-
v2v/output_qemu.ml | 2 +-
v2v/output_rhv.ml | 2 +-
v2v/output_rhv_upload.ml | 2 +-
v2v/output_vdsm.ml | 2 +-
v2v/types.ml | 2 +-
v2v/types.mli | 2 +-
v2v/v2v.ml | 3 ++-
13 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/v2v/output_glance.ml b/v2v/output_glance.ml
index 0eb8b5e6..21e8cc62 100644
--- a/v2v/output_glance.ml
+++ b/v2v/output_glance.ml
@@ -59,7 +59,7 @@ object
method supported_firmware = [ TargetBIOS; TargetUEFI ]
- method prepare_targets _ overlays =
+ method prepare_targets _ overlays _ =
(* Write targets to a temporary local file - see above for reason. *)
List.map (fun (_, ov) -> TargetFile (tmpdir // ov.ov_sd)) overlays
diff --git a/v2v/output_json.ml b/v2v/output_json.ml
index 29c4a1d0..b23420a7 100644
--- a/v2v/output_json.ml
+++ b/v2v/output_json.ml
@@ -71,7 +71,7 @@ class output_json dir json_options = object
method as_options = sprintf "-o json -os %s" dir
- method prepare_targets source_name overlays =
+ method prepare_targets source_name overlays _ =
List.mapi (
fun i (_, ov) ->
let outname =
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index dfd5d1a3..6c6b23ed 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -75,7 +75,7 @@ object (self)
| None -> sprintf "-o libvirt -os %s" output_pool
| Some uri -> sprintf "-o libvirt -oc %s -os %s" uri output_pool
- method prepare_targets source_name overlays =
+ method prepare_targets source_name overlays _ =
(* Get the capabilities from libvirt. *)
let xml =
try
diff --git a/v2v/output_local.ml b/v2v/output_local.ml
index 5eb743a4..48c29eeb 100644
--- a/v2v/output_local.ml
+++ b/v2v/output_local.ml
@@ -31,7 +31,7 @@ class output_local dir = object
method as_options = sprintf "-o local -os %s" dir
- method prepare_targets source_name overlays =
+ method prepare_targets source_name overlays _ =
List.map (
fun (_, ov) -> TargetFile (dir // source_name ^ "-" ^ ov.ov_sd)
) overlays
diff --git a/v2v/output_null.ml b/v2v/output_null.ml
index df451f9f..36710e68 100644
--- a/v2v/output_null.ml
+++ b/v2v/output_null.ml
@@ -89,7 +89,7 @@ object
(* Force raw output, ignoring -of command line option. *)
method override_output_format _ = Some "raw"
- method prepare_targets _ overlays =
+ method prepare_targets _ overlays _ =
if can_use_qemu_null_co_device () then (
let json_params = [
"file.driver", JSON.String "null-co";
diff --git a/v2v/output_openstack.ml b/v2v/output_openstack.ml
index caaedf45..81c55a43 100644
--- a/v2v/output_openstack.ml
+++ b/v2v/output_openstack.ml
@@ -400,7 +400,7 @@ object
(* Create the Cinder volumes, wait for them to attach to the
* appliance, and return the paths of the /dev devices.
*)
- method prepare_targets source_name overlays =
+ method prepare_targets source_name overlays _ =
(* Set up an at-exit handler so we:
* (1) Unconditionally detach volumes.
* (2) Delete the volumes, but only if conversion was not successful.
diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml
index 22e8581a..0156370e 100644
--- a/v2v/output_qemu.ml
+++ b/v2v/output_qemu.ml
@@ -36,7 +36,7 @@ object
method as_options =
sprintf "-o qemu -os %s%s" dir (if qemu_boot then " --qemu-boot" else "")
- method prepare_targets source_name overlays =
+ method prepare_targets source_name overlays _ =
List.map (
fun (_, ov) ->
TargetFile (dir // source_name ^ "-" ^ ov.ov_sd)
diff --git a/v2v/output_rhv.ml b/v2v/output_rhv.ml
index a9102c06..133d03a8 100644
--- a/v2v/output_rhv.ml
+++ b/v2v/output_rhv.ml
@@ -151,7 +151,7 @@ object
* 'os' is the output storage (-os nfs:/export). 'targets' describes
* the destination files. We modify and return this list.
*)
- method prepare_targets _ overlays =
+ method prepare_targets _ overlays _ =
let mp, uuid =
mount_and_check_storage_domain (s_"Export Storage Domain") os in
esd_mp <- mp;
diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml
index 14153db3..01b1ce4a 100644
--- a/v2v/output_rhv_upload.ml
+++ b/v2v/output_rhv_upload.ml
@@ -290,7 +290,7 @@ object
(* rhev-apt.exe will be installed (if available). *)
method install_rhev_apt = true
- method prepare_targets source_name overlays =
+ method prepare_targets source_name overlays _ =
let uuids =
match rhv_options.rhv_disk_uuids with
| None ->
diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
index 1c84439e..bfb9856d 100644
--- a/v2v/output_vdsm.ml
+++ b/v2v/output_vdsm.ml
@@ -144,7 +144,7 @@ object
* 'os' is the output storage domain (-os /rhv/data/<data center>/<data domain>)
* this is already mounted path.
*)
- method prepare_targets _ overlays =
+ method prepare_targets _ overlays _ =
if List.length vdsm_options.image_uuids <> List.length overlays ||
List.length vdsm_options.vol_uuids <> List.length overlays then
error (f_"the number of ‘-oo vdsm-image-uuid’ and ‘-oo vdsm-vol-uuid’ parameters passed on the command line has to match the number of guest disk images (for this guest: %d)")
diff --git a/v2v/types.ml b/v2v/types.ml
index 8de48aec..a6a52294 100644
--- a/v2v/types.ml
+++ b/v2v/types.ml
@@ -530,7 +530,7 @@ class virtual output = object
method check_target_firmware (_ : guestcaps) (_ : target_firmware) = ()
method override_output_format (_ : overlay) = (None : string option)
method transfer_format t = t.target_format
- method virtual prepare_targets : string -> (string * overlay) list -> target_file list
+ method virtual prepare_targets : string -> (string * overlay) list -> guestcaps -> target_file list
method disk_create = (open_guestfs ())#disk_create
method disk_copied (_ : target) (_ : int) (_ : int) = ()
method virtual create_metadata : source -> target list -> target_buses -> guestcaps -> inspect -> target_firmware -> unit
diff --git a/v2v/types.mli b/v2v/types.mli
index 9ceee8a2..483b8910 100644
--- a/v2v/types.mli
+++ b/v2v/types.mli
@@ -492,7 +492,7 @@ class virtual output : object
(** Typically the transfer format is same as the target format, but
some outputs may need to overide the transfer format, but create disk
using target format. *)
- method virtual prepare_targets : string -> (string * overlay) list -> target_file list
+ method virtual prepare_targets : string -> (string * overlay) list -> guestcaps -> target_file list
(** Called after conversion but before copying to prepare (but {b not}
create) the target file. The [(string * overlay list)] parameter
is a list of the (format, overlay) for each target disk. If
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index dc1dedd7..9fd63442 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -173,7 +173,8 @@ let rec main () =
let target_formats = get_target_formats cmdline output overlays in
let target_files =
output#prepare_targets source.s_name
- (List.combine target_formats overlays) in
+ (List.combine target_formats overlays)
+ guestcaps in
List.map (
fun (target_file, target_format, target_overlay) ->
{ target_file; target_format; target_overlay }
--
2.24.1
4 years, 9 months