diff --git a/.gitignore b/.gitignore index 8944817..fd61af7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ SOURCES/libguestfs.keyring -SOURCES/virt-v2v-1.45.3.tar.gz +SOURCES/virt-v2v-1.45.96.tar.gz diff --git a/.virt-v2v.metadata b/.virt-v2v.metadata index 2de4242..e7f2c5f 100644 --- a/.virt-v2v.metadata +++ b/.virt-v2v.metadata @@ -1,2 +1,2 @@ 1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring -afb8d9d36adf52857e16c73514dda00bd5e30c58 SOURCES/virt-v2v-1.45.3.tar.gz +cbb9faca2b2ddbda18b67724740b797bc40af25e SOURCES/virt-v2v-1.45.96.tar.gz diff --git a/SOURCES/0001-Revert-v2v-Remove-o-rhv-upload-oa-preallocated.patch b/SOURCES/0001-Revert-v2v-Remove-o-rhv-upload-oa-preallocated.patch deleted file mode 100644 index a596368..0000000 --- a/SOURCES/0001-Revert-v2v-Remove-o-rhv-upload-oa-preallocated.patch +++ /dev/null @@ -1,123 +0,0 @@ -From 4d5509a98823cc0b8930678716b862adbd2c0b81 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Fri, 6 Aug 2021 13:01:28 +0100 -Subject: [PATCH 01/12] Revert "v2v: Remove -o rhv-upload -oa preallocated" - -This reverts commit 18084f90d9dd9092831cb3487039328981796291. ---- - v2v/cmdline.ml | 2 +- - v2v/output_rhv_upload.ml | 22 ++++++++++++++++++++-- - v2v/output_rhv_upload.mli | 7 ++++--- - v2v/rhv-upload-transfer.py | 1 + - 4 files changed, 26 insertions(+), 6 deletions(-) - -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index 79d943df..5e7c01f8 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -699,7 +699,7 @@ read the man page virt-v2v(1). - | Some os -> os in - if qemu_boot then - error_option_cannot_be_used_in_output_mode "rhv-upload" "--qemu-boot"; -- Output_rhv_upload.output_rhv_upload output_conn -+ Output_rhv_upload.output_rhv_upload output_alloc output_conn - output_password os - rhv_options, - output_format, output_alloc -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index 6a632eaa..50baa595 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -146,11 +146,22 @@ let error_unless_nbdkit_compiled_with_selinux config = - error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") - ) - -+(* Output sparse must be sparse. We may be able to -+ * lift this limitation in future, but it requires changes on the -+ * RHV side. See TODO file for details. XXX -+ *) -+let error_current_limitation required_param = -+ error (f_"rhv-upload: currently you must use ‘%s’. This restriction will be loosened in a future version.") required_param -+ -+let error_unless_output_alloc_sparse output_alloc = -+ if output_alloc <> Sparse then -+ error_current_limitation "-oa sparse" -+ - let json_optstring = function - | Some s -> JSON.String s - | None -> JSON.Null - --class output_rhv_upload output_conn -+class output_rhv_upload output_alloc output_conn - output_password output_storage - rhv_options = - (* Create a temporary directory which will be deleted on exit. *) -@@ -189,6 +200,9 @@ class output_rhv_upload output_conn - "output_conn", JSON.String output_conn; - "output_password", JSON.String output_password; - "output_storage", JSON.String output_storage; -+ "output_sparse", JSON.Bool (match output_alloc with -+ | Sparse -> true -+ | Preallocated -> false); - "rhv_cafile", json_optstring rhv_options.rhv_cafile; - "rhv_cluster", - JSON.String (Option.default "Default" rhv_options.rhv_cluster); -@@ -257,6 +271,7 @@ object - error_unless_nbdkit_min_version config; - error_unless_nbdkit_python_plugin_working plugin_script; - error_unless_nbdkit_compiled_with_selinux config; -+ error_unless_output_alloc_sparse output_alloc; - - (* Python code prechecks. *) - let json_params = match rhv_options.rhv_disk_uuids with -@@ -282,6 +297,9 @@ object - - method as_options = - "-o rhv-upload" ^ -+ (match output_alloc with -+ | Sparse -> "" (* default, don't need to print it *) -+ | Preallocated -> " -oa preallocated") ^ - sprintf " -oc %s -op %s -os %s" - output_conn output_password output_storage - -@@ -449,7 +467,7 @@ object - (* Create the metadata. *) - let ovf = - Create_ovf.create_ovf source inspect target_meta targets -- Sparse sd_uuid disk_uuids vol_uuids vm_uuid -+ output_alloc sd_uuid disk_uuids vol_uuids vm_uuid - OVirt in - let ovf = DOM.doc_to_string ovf in - -diff --git a/v2v/output_rhv_upload.mli b/v2v/output_rhv_upload.mli -index 01507dff..eb85a57d 100644 ---- a/v2v/output_rhv_upload.mli -+++ b/v2v/output_rhv_upload.mli -@@ -25,8 +25,9 @@ val print_output_options : unit -> unit - val parse_output_options : (string * string) list -> rhv_options - (** Print and parse rhv-upload -oo options. *) - --val output_rhv_upload : string -> string -> string -> rhv_options -> -- Types.output --(** [output_rhv_upload output_conn output_password output_storage rhv_options] -+val output_rhv_upload : Types.output_allocation -> string -> string -> -+ string -> rhv_options -> Types.output -+(** [output_rhv_upload output_alloc output_conn output_password output_storage -+ rhv_options] - creates and returns a new {!Types.output} object specialized for writing - output to oVirt or RHV directly via RHV APIs. *) -diff --git a/v2v/rhv-upload-transfer.py b/v2v/rhv-upload-transfer.py -index cf4f8807..5aebcd1d 100644 ---- a/v2v/rhv-upload-transfer.py -+++ b/v2v/rhv-upload-transfer.py -@@ -111,6 +111,7 @@ def create_disk(connection): - # size, based on qemu-img measure of the overlay. - initial_size=params['disk_size'], - provisioned_size=params['disk_size'], -+ # XXX Ignores params['output_sparse']. - # Handling this properly will be complex, see: - # https://www.redhat.com/archives/libguestfs/2018-March/msg00177.html - sparse=True, --- -2.31.1 - diff --git a/SOURCES/0001-lib-types-reformat-string_of_guestcaps.patch b/SOURCES/0001-lib-types-reformat-string_of_guestcaps.patch new file mode 100644 index 0000000..c5a00f9 --- /dev/null +++ b/SOURCES/0001-lib-types-reformat-string_of_guestcaps.patch @@ -0,0 +1,44 @@ +From dc69bb6033bd41b79e6203080059d4f3b0eb8027 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:02 +0100 +Subject: [PATCH] lib/types: reformat "string_of_guestcaps" + +The printf format string in "string_of_guestcaps" is hard to read, because +it is not indented properly wrt. the rest of the source code. Indent it +properly without changing its behavior. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-2-lersek@redhat.com> +Acked-by: Richard W.M. Jones +--- + lib/types.ml | 13 +++++++------ + 1 file changed, 7 insertions(+), 6 deletions(-) + +diff --git a/lib/types.ml b/lib/types.ml +index 894391ba..dc3308dc 100644 +--- a/lib/types.ml ++++ b/lib/types.ml +@@ -423,12 +423,13 @@ let string_of_machine = function + + let string_of_guestcaps gcaps = + sprintf "\ +-gcaps_block_bus = %s +-gcaps_net_bus = %s +-gcaps_machine = %s +-gcaps_arch = %s +-gcaps_acpi = %b +-" (string_of_block_type gcaps.gcaps_block_bus) ++ gcaps_block_bus = %s\n\ ++ gcaps_net_bus = %s\n\ ++ gcaps_machine = %s\n\ ++ gcaps_arch = %s\n\ ++ gcaps_acpi = %b\n\ ++ " ++ (string_of_block_type gcaps.gcaps_block_bus) + (string_of_net_type gcaps.gcaps_net_bus) + (string_of_machine gcaps.gcaps_machine) + gcaps.gcaps_arch +-- +2.31.1 + diff --git a/SOURCES/0002-RHEL-v2v-rhv-upload-Remove-restriction-on-oa-sparse.patch b/SOURCES/0002-RHEL-v2v-rhv-upload-Remove-restriction-on-oa-sparse.patch deleted file mode 100644 index 6abff63..0000000 --- a/SOURCES/0002-RHEL-v2v-rhv-upload-Remove-restriction-on-oa-sparse.patch +++ /dev/null @@ -1,90 +0,0 @@ -From abe3c7539b6221e8ab3cc35ee3d58b1aa06bbef4 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Mon, 14 May 2018 10:16:58 +0100 -Subject: [PATCH 02/12] RHEL: v2v: rhv-upload: Remove restriction on -oa - sparse. - -See: https://bugzilla.redhat.com/show_bug.cgi?id=1565681 -and the v2v-devel private thread "Do we already support migration using FC?" ---- - docs/virt-v2v-output-rhv.pod | 8 +------- - v2v/output_rhv_upload.ml | 10 +--------- - v2v/rhv-upload-transfer.py | 4 +--- - 3 files changed, 3 insertions(+), 19 deletions(-) - -diff --git a/docs/virt-v2v-output-rhv.pod b/docs/virt-v2v-output-rhv.pod -index dc6b2c0a..7b8fdc0f 100644 ---- a/docs/virt-v2v-output-rhv.pod -+++ b/docs/virt-v2v-output-rhv.pod -@@ -5,7 +5,7 @@ virt-v2v-output-rhv - Using virt-v2v to convert guests to oVirt or RHV - =head1 SYNOPSIS - - virt-v2v [-i* options] -o rhv-upload [-oc ENGINE_URL] -os STORAGE -- [-op PASSWORD] [-of raw] -+ [-op PASSWORD] - [-oo rhv-cafile=FILE] - [-oo rhv-cluster=CLUSTER] - [-oo rhv-direct] -@@ -79,12 +79,6 @@ username is not specified then virt-v2v defaults to using - C which is the typical superuser account for oVirt - instances. - --=item I<-of raw> -- --Currently you must use I<-of raw> and you cannot use I<-oa preallocated>. -- --These restrictions will be loosened in a future version. -- - =item I<-op> F - - A file containing a password to be used when connecting to the oVirt -diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml -index 50baa595..be5e9851 100644 ---- a/v2v/output_rhv_upload.ml -+++ b/v2v/output_rhv_upload.ml -@@ -146,17 +146,10 @@ let error_unless_nbdkit_compiled_with_selinux config = - error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") - ) - --(* Output sparse must be sparse. We may be able to -- * lift this limitation in future, but it requires changes on the -- * RHV side. See TODO file for details. XXX -- *) -+(* Output format must be raw. *) - let error_current_limitation required_param = - error (f_"rhv-upload: currently you must use ‘%s’. This restriction will be loosened in a future version.") required_param - --let error_unless_output_alloc_sparse output_alloc = -- if output_alloc <> Sparse then -- error_current_limitation "-oa sparse" -- - let json_optstring = function - | Some s -> JSON.String s - | None -> JSON.Null -@@ -271,7 +264,6 @@ object - error_unless_nbdkit_min_version config; - error_unless_nbdkit_python_plugin_working plugin_script; - error_unless_nbdkit_compiled_with_selinux config; -- error_unless_output_alloc_sparse output_alloc; - - (* Python code prechecks. *) - let json_params = match rhv_options.rhv_disk_uuids with -diff --git a/v2v/rhv-upload-transfer.py b/v2v/rhv-upload-transfer.py -index 5aebcd1d..f38cd9c0 100644 ---- a/v2v/rhv-upload-transfer.py -+++ b/v2v/rhv-upload-transfer.py -@@ -111,10 +111,8 @@ def create_disk(connection): - # size, based on qemu-img measure of the overlay. - initial_size=params['disk_size'], - provisioned_size=params['disk_size'], -- # XXX Ignores params['output_sparse']. -- # Handling this properly will be complex, see: - # https://www.redhat.com/archives/libguestfs/2018-March/msg00177.html -- sparse=True, -+ sparse=params['output_sparse'], - storage_domains=[ - types.StorageDomain( - name=params['output_storage'], --- -2.31.1 - diff --git a/SOURCES/0002-lib-types-update-string_of_guestcaps.patch b/SOURCES/0002-lib-types-update-string_of_guestcaps.patch new file mode 100644 index 0000000..d5cc9bf --- /dev/null +++ b/SOURCES/0002-lib-types-update-string_of_guestcaps.patch @@ -0,0 +1,55 @@ +From 08786886302cceb7ee73cfa6c01325f690a3c094 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:03 +0100 +Subject: [PATCH] lib/types: update "string_of_guestcaps" + +The "string_of_guestcaps" function is out of date; the following commits +did not update it, when they introduced new fields to the "guestcaps" +record type: + +- d295d6e510a4 ("v2v: Extend guestcaps to record drivers for virtio-rng, + balloon and pvpanic.", 2017-04-06) + +- 05f780c16f01 ("v2v: support configuration of viosock driver", + 2021-02-26) + +Print those fields now. + +Fixes: d295d6e510a4fb251d545c52c0a9d6dccabe6f78 +Fixes: 05f780c16f0135c657615520c2245b42de1efc3e +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-3-lersek@redhat.com> +Acked-by: Richard W.M. Jones +--- + lib/types.ml | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/lib/types.ml b/lib/types.ml +index dc3308dc..52db1f9e 100644 +--- a/lib/types.ml ++++ b/lib/types.ml +@@ -425,12 +425,20 @@ let string_of_guestcaps gcaps = + sprintf "\ + gcaps_block_bus = %s\n\ + gcaps_net_bus = %s\n\ ++ gcaps_virtio_rng = %b\n\ ++ gcaps_virtio_balloon = %b\n\ ++ gcaps_isa_pvpanic = %b\n\ ++ gcaps_virtio_socket = %b\n\ + gcaps_machine = %s\n\ + gcaps_arch = %s\n\ + gcaps_acpi = %b\n\ + " + (string_of_block_type gcaps.gcaps_block_bus) + (string_of_net_type gcaps.gcaps_net_bus) ++ gcaps.gcaps_virtio_rng ++ gcaps.gcaps_virtio_balloon ++ gcaps.gcaps_isa_pvpanic ++ gcaps.gcaps_virtio_socket + (string_of_machine gcaps.gcaps_machine) + gcaps.gcaps_arch + gcaps.gcaps_acpi +-- +2.31.1 + diff --git a/SOURCES/0003-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch b/SOURCES/0003-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch deleted file mode 100644 index 6857062..0000000 --- a/SOURCES/0003-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 0839ba57487b73cfb684ea495280db5d946f667a Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Sun, 28 Sep 2014 19:14:43 +0100 -Subject: [PATCH 03/12] RHEL: v2v: Select correct qemu binary for -o qemu mode - (RHBZ#1147313). - -RHEL does not have qemu-system-x86_64 (etc), and in addition the -qemu binary is located in /usr/libexec. Encode the path to this -binary directly in the script. - -Note that we don't support people running qemu directly like this. -It's just for quick testing of converted VMs, and to help us with -support cases. ---- - v2v/output_qemu.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/output_qemu.ml b/v2v/output_qemu.ml -index 12c56836..7391eda0 100644 ---- a/v2v/output_qemu.ml -+++ b/v2v/output_qemu.ml -@@ -79,7 +79,7 @@ object - * module deals with shell and qemu comma quoting. - *) - let cmd = Qemuopts.create () in -- Qemuopts.set_binary_by_arch cmd (Some guestcaps.gcaps_arch); -+ Qemuopts.set_binary cmd "/usr/libexec/qemu-kvm"; - - let flag = Qemuopts.flag cmd - and arg = Qemuopts.arg cmd --- -2.31.1 - diff --git a/SOURCES/0003-lib-types-introduce-the-gcaps_virtio_1_0-guest-capab.patch b/SOURCES/0003-lib-types-introduce-the-gcaps_virtio_1_0-guest-capab.patch new file mode 100644 index 0000000..bb0180f --- /dev/null +++ b/SOURCES/0003-lib-types-introduce-the-gcaps_virtio_1_0-guest-capab.patch @@ -0,0 +1,95 @@ +From 789017805ad0ddfacfb16d39313ef8b2f8f478ac Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:04 +0100 +Subject: [PATCH] lib/types: introduce the "gcaps_virtio_1_0" guest capability + +Add a new field to the "guestcaps" record to track whether the guest +supports the virtio devices that it does at the virtio-1.0 protocol level. + +Virt-v2v's current assumption is that virtio-1.0 is supported by any +guest, namely for those virtio devices specifically that the guest +supports -- which in fact may be the empty set. Make this assumption +explicit by setting the new field to "true" in "convert/convert_linux.ml" +and "convert/convert_windows.ml". + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-4-lersek@redhat.com> +Acked-by: Richard W.M. Jones +--- + convert/convert_linux.ml | 1 + + convert/convert_windows.ml | 1 + + lib/types.ml | 3 +++ + lib/types.mli | 4 ++++ + 4 files changed, 9 insertions(+) + +diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml +index d49ecec0..3f1114ad 100644 +--- a/convert/convert_linux.ml ++++ b/convert/convert_linux.ml +@@ -155,6 +155,7 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ = + gcaps_machine = machine; + gcaps_arch = Utils.kvm_arch inspect.i_arch; + gcaps_acpi = acpi; ++ gcaps_virtio_1_0 = true; + } in + + guestcaps +diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml +index 0ebffb15..30e494ea 100644 +--- a/convert/convert_windows.ml ++++ b/convert/convert_windows.ml +@@ -259,6 +259,7 @@ let convert (g : G.guestfs) _ inspect _ static_ips = + gcaps_machine = machine; + gcaps_arch = Utils.kvm_arch inspect.i_arch; + gcaps_acpi = true; ++ gcaps_virtio_1_0 = true; + } in + + guestcaps +diff --git a/lib/types.ml b/lib/types.ml +index 52db1f9e..50c41918 100644 +--- a/lib/types.ml ++++ b/lib/types.ml +@@ -404,6 +404,7 @@ type guestcaps = { + gcaps_machine : guestcaps_machine; + gcaps_arch : string; + gcaps_acpi : bool; ++ gcaps_virtio_1_0 : bool; + } + and guestcaps_block_type = Virtio_blk | IDE + and guestcaps_net_type = Virtio_net | E1000 | RTL8139 +@@ -432,6 +433,7 @@ let string_of_guestcaps gcaps = + gcaps_machine = %s\n\ + gcaps_arch = %s\n\ + gcaps_acpi = %b\n\ ++ gcaps_virtio_1_0 = %b\n\ + " + (string_of_block_type gcaps.gcaps_block_bus) + (string_of_net_type gcaps.gcaps_net_bus) +@@ -442,6 +444,7 @@ let string_of_guestcaps gcaps = + (string_of_machine gcaps.gcaps_machine) + gcaps.gcaps_arch + gcaps.gcaps_acpi ++ gcaps.gcaps_virtio_1_0 + + type target_buses = { + target_virtio_blk_bus : target_bus_slot array; +diff --git a/lib/types.mli b/lib/types.mli +index 02913c0c..0b9b6e25 100644 +--- a/lib/types.mli ++++ b/lib/types.mli +@@ -270,6 +270,10 @@ type guestcaps = { + gcaps_machine : guestcaps_machine; (** Machine model. *) + gcaps_arch : string; (** Architecture that KVM must emulate. *) + gcaps_acpi : bool; (** True if guest supports acpi. *) ++ ++ gcaps_virtio_1_0 : bool; ++ (** The guest supports the virtio devices that it does at the virtio-1.0 ++ protocol level. *) + } + (** Guest capabilities after conversion. eg. Was virtio found or installed? *) + +-- +2.31.1 + diff --git a/SOURCES/0004-output-create_libvirt_xml-pick-virtio-transitional-m.patch b/SOURCES/0004-output-create_libvirt_xml-pick-virtio-transitional-m.patch new file mode 100644 index 0000000..f1c7554 --- /dev/null +++ b/SOURCES/0004-output-create_libvirt_xml-pick-virtio-transitional-m.patch @@ -0,0 +1,118 @@ +From e4cf85bd3ad44aed28cf3e8d3bfd67fec38ebdab Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:05 +0100 +Subject: [PATCH] output/create_libvirt_xml: pick "virtio-transitional" models + when needed + +In the domain XML we generate, we do not assign PCI B/D/F addresses to +devices; that job is left to libvirtd. When using the Q35 machine type, +libvirtd places the virtio devices into PCI Express Root Ports. As a +consequence, QEMU disables virtio-0.9.5 support on these devices, and so +guest OSes without virtio-1.0 drivers cannot drive them. + +Prevent QEMU from turning off the virtio-0.9.5 ("legacy") protocol by +specifying the "virtio-transitional" (not "virtio") model for our virtio +devices: + +- For non-disk devices, simply change the value of the existent "model" + attribute. + +- For disk devices, add the "model" attribute as a new one. + +(In fact, libvirtd doesn't (only) add the "disable_legacy=off" QEMU device +property for the "virtio-transitional" devices -- libvirtd even moves +these devices from PCI Express Root Ports to a dedicated +"pcie-to-pci-bridge". This has the same effect on QEMU.) + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-5-lersek@redhat.com> +Acked-by: Richard W.M. Jones +--- + output/create_libvirt_xml.ml | 28 ++++++++++++++++++---------- + 1 file changed, 18 insertions(+), 10 deletions(-) + +diff --git a/output/create_libvirt_xml.ml b/output/create_libvirt_xml.ml +index 9413cc0b..87bfab17 100644 +--- a/output/create_libvirt_xml.ml ++++ b/output/create_libvirt_xml.ml +@@ -312,18 +312,26 @@ let create_libvirt_xml ?pool source inspect + (* The devices. *) + let devices = ref [] in + ++ (* This will affect all of the virtio devices (if any). *) ++ let virtio_transitional = ++ guestcaps.gcaps_machine = Q35 && not guestcaps.gcaps_virtio_1_0 in ++ let virtio_model = ++ if virtio_transitional then "virtio-transitional" else "virtio" in ++ + (* Fixed and removable disks. *) + let () = +- let make_disk bus_name drive_prefix i = function ++ let make_disk bus_name ?(viotrans = false) drive_prefix i = function + | BusSlotEmpty -> Comment (sprintf "%s slot %d is empty" bus_name i) + + | BusSlotDisk d -> + let outdisk = outdisk_name d.s_disk_id in + +- e "disk" [ +- "type", if pool = None then "file" else "volume"; +- "device", "disk" +- ] [ ++ e "disk" ( ++ [ ++ "type", if pool = None then "file" else "volume"; ++ "device", "disk" ++ ] @ if (viotrans) then [ "model", "virtio-transitional" ] else [] ++ ) [ + e "driver" [ + "name", "qemu"; + "type", output_format; +@@ -364,7 +372,7 @@ let create_libvirt_xml ?pool source inspect + in + + List.push_back_list devices +- (List.mapi (make_disk "virtio" "vd") ++ (List.mapi (make_disk "virtio" ~viotrans:virtio_transitional "vd") + (Array.to_list target_buses.target_virtio_blk_bus)); + let ide_disks = + match guestcaps.gcaps_machine with +@@ -392,7 +400,7 @@ let create_libvirt_xml ?pool source inspect + let nics = + let net_model = + match guestcaps.gcaps_net_bus with +- | Virtio_net -> "virtio" | E1000 -> "e1000" | RTL8139 -> "rtl8139" in ++ | Virtio_net -> virtio_model | E1000 -> "e1000" | RTL8139 -> "rtl8139" in + List.map ( + fun { s_mac = mac; s_vnet_type = vnet_type; s_vnet = vnet } -> + let vnet_type_str = +@@ -483,7 +491,7 @@ let create_libvirt_xml ?pool source inspect + (* Miscellaneous KVM devices. *) + if guestcaps.gcaps_virtio_rng then + List.push_back devices ( +- e "rng" ["model", "virtio"] [ ++ e "rng" ["model", virtio_model] [ + (* XXX Using /dev/urandom requires libvirt >= 1.3.4. Libvirt + * was broken before that. + *) +@@ -496,7 +504,7 @@ let create_libvirt_xml ?pool source inspect + List.push_back devices ( + e "memballoon" + ["model", +- if guestcaps.gcaps_virtio_balloon then "virtio" else "none"] ++ if guestcaps.gcaps_virtio_balloon then virtio_model else "none"] + [] + ); + if guestcaps.gcaps_isa_pvpanic then +@@ -508,7 +516,7 @@ let create_libvirt_xml ?pool source inspect + List.push_back devices ( + e "viosock" + ["model", +- if guestcaps.gcaps_virtio_socket then "virtio" else "none"] ++ if guestcaps.gcaps_virtio_socket then virtio_model else "none"] + [] + ); + +-- +2.31.1 + diff --git a/SOURCES/0005-output-create_json-expose-gcaps_virtio_1_0.patch b/SOURCES/0005-output-create_json-expose-gcaps_virtio_1_0.patch new file mode 100644 index 0000000..ca3bb20 --- /dev/null +++ b/SOURCES/0005-output-create_json-expose-gcaps_virtio_1_0.patch @@ -0,0 +1,33 @@ +From 511910e1f7e956fb8a032c1c04fd0a983b2108df Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:06 +0100 +Subject: [PATCH] output/create_json: expose "gcaps_virtio_1_0" + +Let CNV / KubeVirt know about the "gcaps_virtio_1_0" field as well, so +that it can make the same determination from "machine" and +"gcaps_virtio_1_0" as virt-v2v does in the libvirt output (from an earlier +patch in this series). + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-6-lersek@redhat.com> +Acked-by: Richard W.M. Jones +--- + output/create_json.ml | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/output/create_json.ml b/output/create_json.ml +index b48902b7..985e10a9 100644 +--- a/output/create_json.ml ++++ b/output/create_json.ml +@@ -219,6 +219,7 @@ let create_json_metadata source inspect + "isa-pvpanic", JSON.Bool guestcaps.gcaps_isa_pvpanic; + "virtio-socket", JSON.Bool guestcaps.gcaps_virtio_socket; + "acpi", JSON.Bool guestcaps.gcaps_acpi; ++ "virtio-1-0", JSON.Bool guestcaps.gcaps_virtio_1_0; + ] in + List.push_back doc ("guestcaps", JSON.Dict guestcaps_dict); + +-- +2.31.1 + diff --git a/SOURCES/0006-convert-libosinfo-wrap-osinfo_os_get_all_devices.patch b/SOURCES/0006-convert-libosinfo-wrap-osinfo_os_get_all_devices.patch new file mode 100644 index 0000000..2288454 --- /dev/null +++ b/SOURCES/0006-convert-libosinfo-wrap-osinfo_os_get_all_devices.patch @@ -0,0 +1,165 @@ +From 46f5885dba1b669588d98eb840af454564d07cae Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:07 +0100 +Subject: [PATCH] convert/libosinfo: wrap osinfo_os_get_all_devices() + +Introduce the "osinfo_os.get_devices" OCaml method, for wrapping the +libosinfo API osinfo_os_get_all_devices(). + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-7-lersek@redhat.com> +[lersek@redhat.com: call OCaml values "v" (Rich)] +Acked-by: Richard W.M. Jones +--- + convert/libosinfo-c.c | 66 +++++++++++++++++++++++++++++++++++++++++++ + convert/libosinfo.ml | 14 +++++++++ + convert/libosinfo.mli | 14 +++++++++ + 3 files changed, 94 insertions(+) + +diff --git a/convert/libosinfo-c.c b/convert/libosinfo-c.c +index 09cf588d..b8e78bec 100644 +--- a/convert/libosinfo-c.c ++++ b/convert/libosinfo-c.c +@@ -50,6 +50,7 @@ + G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoFilter, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoLoader, g_object_unref) + G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoOsList, g_object_unref) ++G_DEFINE_AUTOPTR_CLEANUP_FUNC(OsinfoDeviceList, g_object_unref) + #endif + + typedef OsinfoDb *OsinfoDb_t; +@@ -255,3 +256,68 @@ v2v_osinfo_os_get_device_drivers (value osv) + + CAMLreturn (rv); + } ++ ++/* Collect OsinfoDevice properties from two levels: ++ * ++ * - The OSINFO_ENTITY_PROP_ID property, originating from the OsinfoEntity base ++ * class. This is a unique URI, identifying the device. ++ * ++ * - All currently known OSINFO_DEVICE_PROP_* properties, originating from the ++ * OsinfoDevice class. ++ * ++ * All of the above properties have string values. Thus, for uniformity, access ++ * all these properties by their names at the OsinfoEntity level (i.e., forego ++ * the class- and property-specific, dedicated property getter functions). ++ */ ++static const char * const device_prop[] = { ++ OSINFO_ENTITY_PROP_ID, ++ OSINFO_DEVICE_PROP_VENDOR, ++ OSINFO_DEVICE_PROP_VENDOR_ID, ++ OSINFO_DEVICE_PROP_PRODUCT, ++ OSINFO_DEVICE_PROP_PRODUCT_ID, ++ OSINFO_DEVICE_PROP_NAME, ++ OSINFO_DEVICE_PROP_CLASS, ++ OSINFO_DEVICE_PROP_BUS_TYPE, ++ OSINFO_DEVICE_PROP_SUBSYSTEM, ++}; ++#define NUM_DEVICE_PROPS (sizeof device_prop / sizeof device_prop[0]) ++ ++value ++v2v_osinfo_os_get_all_devices (value osv) ++{ ++ CAMLparam1 (osv); ++ CAMLlocal3 (retvalv, linkv, propsv); ++ g_autoptr (OsinfoDeviceList) dev_list = NULL; ++ OsinfoList *ent_list; ++ gint ent_nr; ++ ++ retvalv = Val_emptylist; ++ dev_list = osinfo_os_get_all_devices (OsinfoOs_t_val (osv), NULL); ++ ent_list = OSINFO_LIST (dev_list); ++ ent_nr = osinfo_list_get_length (ent_list); ++ ++ while (ent_nr > 0) { ++ OsinfoEntity *ent; ++ size_t prop_nr; ++ ++ --ent_nr; ++ ent = osinfo_list_get_nth (ent_list, ent_nr); ++ ++ propsv = caml_alloc (NUM_DEVICE_PROPS, 0); ++ for (prop_nr = 0; prop_nr < NUM_DEVICE_PROPS; ++prop_nr) { ++ const gchar *prop_val; ++ ++ prop_val = osinfo_entity_get_param_value (ent, device_prop[prop_nr]); ++ if (prop_val == NULL) ++ prop_val = ""; ++ Store_field (propsv, prop_nr, caml_copy_string (prop_val)); ++ } ++ ++ linkv = caml_alloc (2, 0); ++ Store_field (linkv, 0, propsv); ++ Store_field (linkv, 1, retvalv); ++ retvalv = linkv; ++ } ++ ++ CAMLreturn (retvalv); ++} +diff --git a/convert/libosinfo.ml b/convert/libosinfo.ml +index bd9ca126..78271be2 100644 +--- a/convert/libosinfo.ml ++++ b/convert/libosinfo.ml +@@ -32,13 +32,27 @@ type osinfo_device_driver = { + files : string list; + } + ++type osinfo_device = { ++ id : string; ++ vendor : string; ++ vendor_id : string; ++ product : string; ++ product_id : string; ++ name : string; ++ class_ : string; ++ bus_type : string; ++ subsystem : string; ++} ++ + external osinfo_os_get_id : osinfo_os_t -> string = "v2v_osinfo_os_get_id" + external osinfo_os_get_device_drivers : osinfo_os_t -> osinfo_device_driver list = "v2v_osinfo_os_get_device_drivers" ++external osinfo_os_get_devices : osinfo_os_t -> osinfo_device list = "v2v_osinfo_os_get_all_devices" + + class osinfo_os h = + object (self) + method get_id () = osinfo_os_get_id h + method get_device_drivers () = osinfo_os_get_device_drivers h ++ method get_devices () = osinfo_os_get_devices h + end + + external osinfo_db_load : unit -> osinfo_db_t = "v2v_osinfo_db_load" +diff --git a/convert/libosinfo.mli b/convert/libosinfo.mli +index 0428ef91..1ece7b41 100644 +--- a/convert/libosinfo.mli ++++ b/convert/libosinfo.mli +@@ -29,11 +29,25 @@ type osinfo_device_driver = { + files : string list; + } + ++type osinfo_device = { ++ id : string; ++ vendor : string; ++ vendor_id : string; ++ product : string; ++ product_id : string; ++ name : string; ++ class_ : string; ++ bus_type : string; ++ subsystem : string; ++} ++ + class osinfo_os : osinfo_os_t -> object + method get_id : unit -> string + (** Return the ID. *) + method get_device_drivers : unit -> osinfo_device_driver list + (** Return the list of device drivers. *) ++ method get_devices : unit -> osinfo_device list ++ (** Return the list of devices. *) + end + (** Minimal OsinfoOs wrapper. *) + +-- +2.31.1 + diff --git a/SOURCES/0007-RHEL-v2v-Disable-the-virt-v2v-in-place-option.patch b/SOURCES/0007-RHEL-v2v-Disable-the-virt-v2v-in-place-option.patch deleted file mode 100644 index df36eac..0000000 --- a/SOURCES/0007-RHEL-v2v-Disable-the-virt-v2v-in-place-option.patch +++ /dev/null @@ -1,288 +0,0 @@ -From 3b69cfa365c7b014ca81b09e857ab294cff04914 Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 14 Jan 2016 11:53:42 -0500 -Subject: [PATCH 07/12] RHEL: v2v: Disable the virt-v2v --in-place option. - -This disables the virt-v2v --in-place option which we do not -wish to support in RHEL. -(See commit d0069559a939e47e5f29973ed9a69a13f0b58301). ---- - docs/test-v2v-docs.sh | 1 + - docs/virt-v2v.pod | 50 +---------------- - tests/Makefile.am | 2 - - tests/test-v2v-in-place.sh | 108 ------------------------------------- - v2v/cmdline.ml | 8 +-- - 5 files changed, 8 insertions(+), 161 deletions(-) - delete mode 100755 tests/test-v2v-in-place.sh - -diff --git a/docs/test-v2v-docs.sh b/docs/test-v2v-docs.sh -index 465df26f..ae1a6c68 100755 ---- a/docs/test-v2v-docs.sh -+++ b/docs/test-v2v-docs.sh -@@ -30,6 +30,7 @@ $srcdir/../podcheck.pl virt-v2v.pod virt-v2v \ - --debug-overlay,\ - --ic,\ - --if,\ -+--in-place,\ - --io,\ - --ip,\ - --it,\ -diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod -index 83f6fd4d..719a95b5 100644 ---- a/docs/virt-v2v.pod -+++ b/docs/virt-v2v.pod -@@ -8,10 +8,6 @@ virt-v2v - Convert a guest to use KVM - [-o mode] [other -o* options] - [guest|filename] - -- virt-v2v --in-place -- [-i mode] [other -i* options] -- [guest|filename] -- - =head1 DESCRIPTION - - Virt-v2v converts a single guest from a foreign hypervisor to run on -@@ -39,9 +35,6 @@ these sides of virt-v2v are documented separately in this manual. - - Virt-v2v normally copies from the input to the output, called "copying - mode". In this case the source guest is always left unchanged. --In-place conversion (I<--in-place>) only uses the I<-i*> options and --modifies the source guest in-place. (See L --below.) - - =head2 Other virt-v2v topics - -@@ -292,20 +285,6 @@ For I<-i disk> only, this specifies the format of the input disk - image. For other input methods you should specify the input - format in the metadata. - --=item B<--in-place> -- --Do not create an output virtual machine in the target hypervisor. --Instead, adjust the guest OS in the source VM to run in the input --hypervisor. -- --This mode is meant for integration with other toolsets, which take the --responsibility of converting the VM configuration, providing for --rollback in case of errors, transforming the storage, etc. -- --See L below. -- --Conflicts with all I<-o *> options. -- - =item B<-io> OPTION=VALUE - - Set input option(s) related to the current input mode or transport. -@@ -1298,8 +1277,8 @@ have at least 100 available inodes. - =head3 Minimum free space check in the host - - You must have sufficient free space in the host directory used to --store large temporary overlays (except in I<--in-place> mode). To --find out which directory this is, use: -+store large temporary overlays. To find out -+which directory this is, use: - - $ df -h "`guestfish get-cachedir`" - Filesystem Size Used Avail Use% Mounted on -@@ -1437,31 +1416,6 @@ that instead. - - - --=head2 In-place conversion -- --It is also possible to use virt-v2v in scenarios where a foreign VM --has already been imported into a KVM-based hypervisor, but still needs --adjustments in the guest to make it run in the new virtual hardware. -- --In that case it is assumed that a third-party tool has created the --target VM in the supported KVM-based hypervisor based on the source VM --configuration and contents, but using virtual devices more appropriate --for KVM (e.g. virtio storage and network, etc.). -- --Then, to make the guest OS boot and run in the changed environment, --one can use: -- -- virt-v2v -ic qemu:///system converted_vm --in-place -- --Virt-v2v will analyze the configuration of C in the --C libvirt instance, and apply various fixups to the --guest OS configuration to make it match the VM configuration. This --may include installing virtio drivers, configuring the bootloader, the --mountpoints, the network interfaces, and so on. -- --Should an error occur during the operation, virt-v2v exits with an --error code leaving the VM in an undefined state. -- - =head2 Machine readable output - - The I<--machine-readable> option can be used to make the output more -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 41d38d30..9bbd86d6 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -77,7 +77,6 @@ TESTS = \ - test-v2v-floppy.sh \ - test-v2v-i-disk.sh \ - test-v2v-i-ova.sh \ -- test-v2v-in-place.sh \ - test-v2v-mac.sh \ - test-v2v-machine-readable.sh \ - test-v2v-networks-and-bridges.sh \ -@@ -226,7 +225,6 @@ EXTRA_DIST += \ - test-v2v-i-vmx-3.vmx \ - test-v2v-i-vmx-4.vmx \ - test-v2v-i-vmx-5.vmx \ -- test-v2v-in-place.sh \ - test-v2v-it-vddk-io-query.sh \ - test-v2v-machine-readable.sh \ - test-v2v-mac-expected.xml \ -diff --git a/tests/test-v2v-in-place.sh b/tests/test-v2v-in-place.sh -deleted file mode 100755 -index 9da8fa63..00000000 ---- a/tests/test-v2v-in-place.sh -+++ /dev/null -@@ -1,108 +0,0 @@ --#!/bin/bash - --# libguestfs virt-v2v test script --# Copyright (C) 2014 Red Hat Inc. --# Copyright (C) 2015 Parallels IP Holdings GmbH. --# --# This program is free software; you can redistribute it and/or modify --# it under the terms of the GNU General Public License as published by --# the Free Software Foundation; either version 2 of the License, or --# (at your option) any later version. --# --# This program is distributed in the hope that it will be useful, --# but WITHOUT ANY WARRANTY; without even the implied warranty of --# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the --# GNU General Public License for more details. --# --# You should have received a copy of the GNU General Public License --# along with this program; if not, write to the Free Software --# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -- --# Test --in-place. -- --unset CDPATH --export LANG=C --set -e -- --source ./functions.sh --set -e --set -x -- --skip_if_skipped --requires test -f ../test-data/phony-guests/windows.img -- --img_base="$abs_top_builddir/test-data/phony-guests/windows.img" -- --export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools" --export VIRTIO_WIN="$srcdir/../test-data/fake-virtio-win" -- --d=$PWD/test-v2v-in-place.d --rm -rf $d --cleanup_fn rm -r $d --mkdir $d -- --img="$d/test.qcow2" --rm -f $img --qemu-img create -f qcow2 -b $img_base -o compat=1.1,backing_fmt=raw $img --md5="$(do_md5 $img_base)" -- --libvirt_xml="$d/test.xml" --rm -f $libvirt_xml --n=windows-overlay --cat > $libvirt_xml < -- -- $n -- 1048576 -- -- hvm -- -- -- -- -- -- -- -- -- -- -- --EOF -- --$VG virt-v2v --debug-gc -i libvirt -ic "test://$libvirt_xml" $n --in-place -- --# Test that the drivers have been copied over into the guest --script="$d/test.fish" --expected="$d/expected" --response="$d/response" -- --mktest () --{ -- local cmd="$1" exp="$2" -- -- echo "echo '$cmd'" >> "$script" -- echo "$cmd" >> "$expected" -- -- echo "$cmd" >> "$script" -- echo "$exp" >> "$expected" --} -- --:> "$script" --:> "$expected" -- --firstboot_dir="/Program Files/Guestfs/Firstboot" --mktest "is-dir \"$firstboot_dir\"" true --mktest "is-file \"$firstboot_dir/firstboot.bat\"" true --mktest "is-dir \"$firstboot_dir/scripts\"" true --virtio_dir="/Windows/Drivers/VirtIO" --mktest "is-dir \"$virtio_dir\"" true --for drv in netkvm qxl vioscsi viostor; do -- for sfx in cat inf sys; do -- mktest "is-file \"$virtio_dir/$drv.$sfx\"" true -- done --done -- --guestfish --ro -a "$img" -i < "$script" > "$response" --diff -u "$expected" "$response" -- --# Test the base image remained untouched --test "$md5" = "$(do_md5 $img_base)" -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index ac10ec31..01314580 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -246,8 +246,7 @@ let parse_cmdline () = - s_"Use password from file to connect to input hypervisor"; - [ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport), - s_"Input transport"; -- [ L"in-place" ], Getopt.Set in_place, -- s_"Only tune the guest in the input VM"; -+ [ L"in-place" ], Getopt.Set in_place, Getopt.hidden_option_description; - [ L"mac" ], Getopt.String ("mac:network|bridge|ip:out", add_mac), - s_"Map NIC to network or bridge or assign static IP"; - [ S 'n'; L"network" ], Getopt.String ("in:out", add_network), -@@ -386,7 +385,6 @@ read the man page virt-v2v(1). - pr "vddk\n"; - pr "colours-option\n"; - pr "vdsm-compat-option\n"; -- pr "in-place\n"; - pr "io/oo\n"; - pr "mac-option\n"; - pr "bandwidth-option\n"; -@@ -556,6 +554,10 @@ read the man page virt-v2v(1). - error (f_"only ‘-it ssh’ can be used here") in - Input_vmx.input_vmx input_password input_transport arg in - -+ (* Prevent use of --in-place option in RHEL. *) -+ if in_place then -+ error (f_"--in-place cannot be used in RHEL"); -+ - (* Common error message. *) - let error_option_cannot_be_used_in_output_mode mode opt = - error (f_"-o %s: %s option cannot be used in this output mode") mode opt --- -2.31.1 - diff --git a/SOURCES/0007-convert-libosinfo_utils-introduce-string_of_osinfo_d.patch b/SOURCES/0007-convert-libosinfo_utils-introduce-string_of_osinfo_d.patch new file mode 100644 index 0000000..d1c172a --- /dev/null +++ b/SOURCES/0007-convert-libosinfo_utils-introduce-string_of_osinfo_d.patch @@ -0,0 +1,77 @@ +From 00473c6ac09d85a6b6e1ce0cbe132e31407a2d00 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:08 +0100 +Subject: [PATCH] convert/libosinfo_utils: introduce + "string_of_osinfo_device_list" + +For debugging purposes, we'll want to print the list of devices returned +by the previously introduced "osinfo_os#get_devices" method. + +Format the device list as a nice table. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-8-lersek@redhat.com> +Acked-by: Richard W.M. Jones +--- + convert/libosinfo_utils.ml | 35 +++++++++++++++++++++++++++++++++++ + convert/libosinfo_utils.mli | 3 +++ + 2 files changed, 38 insertions(+) + +diff --git a/convert/libosinfo_utils.ml b/convert/libosinfo_utils.ml +index 1fc138cc..d5eb082b 100644 +--- a/convert/libosinfo_utils.ml ++++ b/convert/libosinfo_utils.ml +@@ -42,3 +42,38 @@ let string_of_osinfo_device_driver { Libosinfo.architecture; location; + (if signed then "signed" else "unsigned") + priority + (String.concat " " files) ++ ++let string_of_osinfo_device_list dev_list = ++ ++ (* Turn the fields of an "osinfo_device" record into a list. *) ++ let listify { Libosinfo.id; vendor; vendor_id; product; product_id; name; ++ class_; bus_type; subsystem } = ++ [ id; vendor; vendor_id; product; product_id; name; ++ class_; bus_type; subsystem ] ++ ++ (* Given a list of strings, and a list of previously known maximum widths, ++ * "increase" each width, if necessary, to the length of the corresponding ++ * string. ++ *) ++ and grow_widths = List.map2 (fun s -> max (String.length s)) ++ in ++ ++ (* Compute the maximum width for each field in "dev_list". *) ++ let max_widths = ++ List.fold_right grow_widths (List.map listify dev_list) ++ [ 0; 0; 0; 0; 0; 0; 0; 0; 0 ] ++ ++ (* Given a list of strings and a list of field widths, format "string1 | ++ * string2 | ... | stringN" such that each field is right-padded to the ++ * corresponding width. ++ *) ++ and columnate strings widths = ++ String.concat " | " (List.map2 (Printf.sprintf "%-*s") widths strings) ++ in ++ ++ (* Format "dev_list" as a table by (a) printing one "osinfo_device" record ++ * per line, and (b) right-padding each field of each "osinfo_device" record ++ * to the maximum width of that field. ++ *) ++ String.concat "\n" ++ (List.map (fun dev -> columnate (listify dev) max_widths) dev_list) +diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli +index b3714d22..5a703334 100644 +--- a/convert/libosinfo_utils.mli ++++ b/convert/libosinfo_utils.mli +@@ -27,3 +27,6 @@ val get_os_by_short_id : string -> Libosinfo.osinfo_os + + val string_of_osinfo_device_driver : Libosinfo.osinfo_device_driver -> string + (** Convert a [osinfo_device_driver] to a printable string for debugging. *) ++ ++val string_of_osinfo_device_list : Libosinfo.osinfo_device list -> string ++(** Convert an [osinfo_device] list to a printable string for debugging. *) +-- +2.31.1 + diff --git a/SOURCES/0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch b/SOURCES/0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch deleted file mode 100644 index cf31f28..0000000 --- a/SOURCES/0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch +++ /dev/null @@ -1,26 +0,0 @@ -From e57a5dafc00b3b5737824977aad0feb0ec497a1f Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Thu, 2 Mar 2017 14:21:37 +0100 -Subject: [PATCH 08/12] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671) - -The SDL output mode is not supported in RHEL's qemu-kvm. ---- - v2v/input_disk.ml | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/v2v/input_disk.ml b/v2v/input_disk.ml -index b3acb5f6..5b39dbe2 100644 ---- a/v2v/input_disk.ml -+++ b/v2v/input_disk.ml -@@ -88,7 +88,7 @@ class input_disk input_format disk = object - s_features = [ "acpi"; "apic"; "pae" ]; - s_firmware = UnknownFirmware; (* causes virt-v2v to autodetect *) - s_display = -- Some { s_display_type = Window; s_keymap = None; s_password = None; -+ Some { s_display_type = VNC; s_keymap = None; s_password = None; - s_listen = LNoListen; s_port = None }; - s_video = None; - s_sound = None; --- -2.31.1 - diff --git a/SOURCES/0008-convert-libosinfo_utils-introduce-os_support_of_osin.patch b/SOURCES/0008-convert-libosinfo_utils-introduce-os_support_of_osin.patch new file mode 100644 index 0000000..a028887 --- /dev/null +++ b/SOURCES/0008-convert-libosinfo_utils-introduce-os_support_of_osin.patch @@ -0,0 +1,77 @@ +From 2a2d7e9e1376084670dbf8587549948713341153 Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:09 +0100 +Subject: [PATCH] convert/libosinfo_utils: introduce + "os_support_of_osinfo_device_list" + +Add a helper function for calculating q35 support and virtio-1.0 support +from the list of devices returned by the previously introduced +"osinfo_os#get_devices" method. + +(Rather than folding the list into a record of bools, implement the +function explicitly, recursively. Folding wouldn't stop (without abusing +exceptions) once all fields in the record turned "true", but a recursive +function can just return the accumulator at that point.) + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-9-lersek@redhat.com> +[lersek@redhat.com: don't break "in" to a new line after a "let" that + defines a non-function (Rich)] +Acked-by: Richard W.M. Jones +--- + convert/libosinfo_utils.ml | 18 ++++++++++++++++++ + convert/libosinfo_utils.mli | 14 ++++++++++++++ + 2 files changed, 32 insertions(+) + +diff --git a/convert/libosinfo_utils.ml b/convert/libosinfo_utils.ml +index d5eb082b..77f22272 100644 +--- a/convert/libosinfo_utils.ml ++++ b/convert/libosinfo_utils.ml +@@ -77,3 +77,21 @@ let string_of_osinfo_device_list dev_list = + *) + String.concat "\n" + (List.map (fun dev -> columnate (listify dev) max_widths) dev_list) ++ ++type os_support = { ++ q35 : bool; ++ vio10 : bool; ++} ++ ++let os_support_of_osinfo_device_list = ++ let rec next accu left = ++ match accu, left with ++ | { q35 = true; vio10 = true }, _ ++ | _ , [] -> ++ accu ++ | { q35; vio10 }, { Libosinfo.id } :: tail -> ++ let q35 = q35 || id = "http://qemu.org/chipset/x86/q35" ++ and vio10 = vio10 || id = "http://pcisig.com/pci/1af4/1041" in ++ next { q35; vio10 } tail ++ in ++ next { q35 = false; vio10 = false } +diff --git a/convert/libosinfo_utils.mli b/convert/libosinfo_utils.mli +index 5a703334..ab77ec97 100644 +--- a/convert/libosinfo_utils.mli ++++ b/convert/libosinfo_utils.mli +@@ -30,3 +30,17 @@ val string_of_osinfo_device_driver : Libosinfo.osinfo_device_driver -> string + + val string_of_osinfo_device_list : Libosinfo.osinfo_device list -> string + (** Convert an [osinfo_device] list to a printable string for debugging. *) ++ ++type os_support = { ++ q35 : bool; ++ vio10 : bool; ++} ++(** Tell whether the operating system supports the Q35 board type and/or ++ non-transitional (virtio-1.0-only) virtio devices. (Internally, the ++ virtio-1.0-net device is used as a proxy for the general statement about ++ virtio-1.0.) ++ *) ++ ++val os_support_of_osinfo_device_list : Libosinfo.osinfo_device list -> ++ os_support ++(** Get [os_support] from an [osinfo_device] list. *) +-- +2.31.1 + diff --git a/SOURCES/0009-convert-determine-machine-type-and-virtio-1.0-from-o.patch b/SOURCES/0009-convert-determine-machine-type-and-virtio-1.0-from-o.patch new file mode 100644 index 0000000..5ff3308 --- /dev/null +++ b/SOURCES/0009-convert-determine-machine-type-and-virtio-1.0-from-o.patch @@ -0,0 +1,207 @@ +From f0cea012d0183edf6f7b769c28d5038593f3fe6a Mon Sep 17 00:00:00 2001 +From: Laszlo Ersek +Date: Thu, 6 Jan 2022 15:09:10 +0100 +Subject: [PATCH] convert: determine machine type and virtio-1.0 from osinfo + for x86 guests + +Determine the machine type and virtio-1.0 support from osinfo, for x86 +guests. This connects the previous two parts of this series. + +Keep the original logic from commit ac39fa292c31 ("v2v: Set machine type +explicitly for outputs which support it (RHBZ#1581428).", 2020-12-04) for +non-x86 guests, and for the case when libosinfo does not recognize the +guest OS. + +Update the "cdrom", "floppy", and "i-ova" test cases, which all use a +(phony) Windows 7 image -- Windows 7 does not support virtio-1.0-only +devices, according to libosinfo. + +Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1942325 +Signed-off-by: Laszlo Ersek +Message-Id: <20220106140910.13695-10-lersek@redhat.com> +Acked-by: Richard W.M. Jones +--- + convert/convert_linux.ml | 51 +++++++++++++++++++++------------- + convert/convert_windows.ml | 32 ++++++++++++++------- + tests/test-v2v-cdrom.expected | 2 +- + tests/test-v2v-floppy.expected | 2 +- + tests/test-v2v-i-ova.xml | 8 +++--- + 5 files changed, 60 insertions(+), 35 deletions(-) + +diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml +index 3f1114ad..45ce069a 100644 +--- a/convert/convert_linux.ml ++++ b/convert/convert_linux.ml +@@ -123,26 +123,39 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ = + + SELinux_relabel.relabel g; + +- (* Pivot on the year 2007. Any Linux distro from earlier than +- * 2007 should use i440fx, anything 2007 or newer should use q35. +- * XXX Look up this information in libosinfo in future. +- *) +- let machine = +- match inspect.i_arch, inspect.i_distro, inspect.i_major_version with +- | ("i386"|"x86_64"), "fedora", _ -> Q35 +- | ("i386"|"x86_64"), ("rhel"|"centos"|"scientificlinux"| +- "redhat-based"|"oraclelinux"), major -> +- if major <= 4 then I440FX else Q35 +- | ("i386"|"x86_64"), ("sles"|"suse-based"|"opensuse"), major -> +- if major < 10 then I440FX else Q35 +- | ("i386"|"x86_64"), ("debian"|"ubuntu"|"linuxmint"| +- "kalilinux"), major -> +- if major < 4 then I440FX else Q35 ++ let machine, virtio_1_0 = ++ match inspect.i_arch with ++ | ("i386"|"x86_64") -> ++ (try ++ let os = Libosinfo_utils.get_os_by_short_id inspect.i_osinfo in ++ let devices = os#get_devices () in ++ debug "libosinfo devices for OS \"%s\":\n%s" inspect.i_osinfo ++ (Libosinfo_utils.string_of_osinfo_device_list devices); ++ let { Libosinfo_utils.q35; vio10 } = ++ Libosinfo_utils.os_support_of_osinfo_device_list devices in ++ (if q35 then Q35 else I440FX), vio10 ++ with ++ | Not_found -> ++ (* Pivot on the year 2007. Any Linux distro from earlier than 2007 ++ * should use i440fx, anything 2007 or newer should use q35. ++ *) ++ (match inspect.i_distro, inspect.i_major_version with ++ | "fedora", _ -> Q35 ++ | ("rhel"|"centos"|"scientificlinux"|"redhat-based"|"oraclelinux"), ++ major -> ++ if major <= 4 then I440FX else Q35 ++ | ("sles"|"suse-based"|"opensuse"), major -> ++ if major < 10 then I440FX else Q35 ++ | ("debian"|"ubuntu"|"linuxmint"|"kalilinux"), major -> ++ if major < 4 then I440FX else Q35 + +- (* reasonable default for all modern Linux kernels *) +- | ("i386"|"x86_64"), _, _ -> Q35 ++ (* reasonable default for all modern Linux kernels *) ++ | _, _ -> Q35 ++ ), true ++ ) + +- | _ -> Virt in ++ | _ -> Virt, true ++ in + + (* Return guest capabilities from the convert () function. *) + let guestcaps = { +@@ -155,7 +168,7 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ = + gcaps_machine = machine; + gcaps_arch = Utils.kvm_arch inspect.i_arch; + gcaps_acpi = acpi; +- gcaps_virtio_1_0 = true; ++ gcaps_virtio_1_0 = virtio_1_0; + } in + + guestcaps +diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml +index 30e494ea..1c2d17f2 100644 +--- a/convert/convert_windows.ml ++++ b/convert/convert_windows.ml +@@ -238,15 +238,27 @@ let convert (g : G.guestfs) _ inspect _ static_ips = + warning (f_"this guest has Anti-Virus (AV) software and a new virtio block device driver was installed. In some circumstances, AV may prevent new drivers from working (resulting in a 7B boot error). If this happens, try disabling AV before doing the conversion."); + ); + +- (* Pivot on the year 2007. Any Windows version from earlier than +- * 2007 should use i440fx, anything 2007 or newer should use q35. +- * Luckily this coincides almost exactly with the release of NT 6. +- * XXX Look up this information in libosinfo in future. +- *) +- let machine = +- match inspect.i_arch, inspect.i_major_version with +- | ("i386"|"x86_64"), major -> if major < 6 then I440FX else Q35 +- | _ -> Virt in ++ let machine, virtio_1_0 = ++ match inspect.i_arch with ++ | ("i386"|"x86_64") -> ++ (try ++ let os = Libosinfo_utils.get_os_by_short_id inspect.i_osinfo in ++ let devices = os#get_devices () in ++ debug "libosinfo devices for OS \"%s\":\n%s" inspect.i_osinfo ++ (Libosinfo_utils.string_of_osinfo_device_list devices); ++ let { Libosinfo_utils.q35; vio10 } = ++ Libosinfo_utils.os_support_of_osinfo_device_list devices in ++ (if q35 then Q35 else I440FX), vio10 ++ with ++ | Not_found -> ++ (* Pivot on the year 2007. Any Windows version from earlier than ++ * 2007 should use i440fx, anything 2007 or newer should use q35. ++ * Luckily this coincides almost exactly with the release of NT 6. ++ *) ++ (if inspect.i_major_version < 6 then I440FX else Q35), true ++ ) ++ | _ -> Virt, true ++ in + + (* Return guest capabilities from the convert () function. *) + let guestcaps = { +@@ -259,7 +271,7 @@ let convert (g : G.guestfs) _ inspect _ static_ips = + gcaps_machine = machine; + gcaps_arch = Utils.kvm_arch inspect.i_arch; + gcaps_acpi = true; +- gcaps_virtio_1_0 = true; ++ gcaps_virtio_1_0 = virtio_1_0; + } in + + guestcaps +diff --git a/tests/test-v2v-cdrom.expected b/tests/test-v2v-cdrom.expected +index 17bd152d..b9504929 100644 +--- a/tests/test-v2v-cdrom.expected ++++ b/tests/test-v2v-cdrom.expected +@@ -1,4 +1,4 @@ +- ++ + + + +diff --git a/tests/test-v2v-floppy.expected b/tests/test-v2v-floppy.expected +index a718c21f..f4b67954 100644 +--- a/tests/test-v2v-floppy.expected ++++ b/tests/test-v2v-floppy.expected +@@ -1,4 +1,4 @@ +- ++ + + + +diff --git a/tests/test-v2v-i-ova.xml b/tests/test-v2v-i-ova.xml +index 9f3c1974..2b6a8de0 100644 +--- a/tests/test-v2v-i-ova.xml ++++ b/tests/test-v2v-i-ova.xml +@@ -21,7 +21,7 @@ + restart + restart + +- ++ + + + +@@ -36,16 +36,16 @@ + + + +- ++ + + + +- ++ + /dev/urandom + +- ++ + + + +-- +2.31.1 + diff --git a/SOURCES/0010-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch b/SOURCES/0010-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch new file mode 100644 index 0000000..75782c2 --- /dev/null +++ b/SOURCES/0010-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch @@ -0,0 +1,33 @@ +From 44314b8d8d201e6043b7148240446c98c726bc95 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Sun, 28 Sep 2014 19:14:43 +0100 +Subject: [PATCH] RHEL: v2v: Select correct qemu binary for -o qemu mode + (RHBZ#1147313). + +RHEL does not have qemu-system-x86_64 (etc), and in addition the +qemu binary is located in /usr/libexec. Encode the path to this +binary directly in the script. + +Note that we don't support people running qemu directly like this. +It's just for quick testing of converted VMs, and to help us with +support cases. +--- + output/output_qemu.ml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/output/output_qemu.ml b/output/output_qemu.ml +index 0aac1eba..c4265703 100644 +--- a/output/output_qemu.ml ++++ b/output/output_qemu.ml +@@ -119,7 +119,7 @@ and qemu_finalize dir source inspect target_meta + * module deals with shell and qemu comma quoting. + *) + let cmd = Qemuopts.create () in +- Qemuopts.set_binary_by_arch cmd (Some guestcaps.gcaps_arch); ++ Qemuopts.set_binary cmd "/usr/libexec/qemu-kvm"; + + let flag = Qemuopts.flag cmd + and arg = Qemuopts.arg cmd +-- +2.31.1 + diff --git a/SOURCES/0004-RHEL-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch b/SOURCES/0011-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch similarity index 60% rename from SOURCES/0004-RHEL-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch rename to SOURCES/0011-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch index 230bfc3..6807c80 100644 --- a/SOURCES/0004-RHEL-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch +++ b/SOURCES/0011-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch @@ -1,7 +1,7 @@ -From bb55b78b68e6e8039734eb1d7af22b455f8fbdc2 Mon Sep 17 00:00:00 2001 +From 1c1eb51b4f7e9d5f1e2aef7d695181a14fbd0a7d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 30 Sep 2014 10:50:27 +0100 -Subject: [PATCH 04/12] RHEL: v2v: Disable the --qemu-boot option +Subject: [PATCH] RHEL: v2v: Disable the --qemu-boot / -oo qemu-boot option (RHBZ#1147313). This cannot work because there is no Gtk or SDL output mode @@ -11,9 +11,10 @@ In addition you will have to edit the -display option in the qemu script. --- docs/virt-v2v-output-local.pod | 6 ++---- - docs/virt-v2v.pod | 13 ------------- - v2v/cmdline.ml | 3 ++- - 3 files changed, 4 insertions(+), 18 deletions(-) + docs/virt-v2v.pod | 12 ------------ + output/output_qemu.ml | 3 +++ + v2v/v2v.ml | 2 -- + 4 files changed, 5 insertions(+), 18 deletions(-) diff --git a/docs/virt-v2v-output-local.pod b/docs/virt-v2v-output-local.pod index a5f155cb..3a2e6238 100644 @@ -43,7 +44,7 @@ index a5f155cb..3a2e6238 100644 =item B<-o json -os> C diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod -index bdf4d716..83f6fd4d 100644 +index 3d0e00a3..04f3efd2 100644 --- a/docs/virt-v2v.pod +++ b/docs/virt-v2v.pod @@ -141,11 +141,6 @@ Since F contains the path(s) to the guest disk @@ -53,54 +54,59 @@ index bdf4d716..83f6fd4d 100644 -To convert a local disk image and immediately boot it in local -qemu, do: - -- virt-v2v -i disk disk.img -o qemu -os /var/tmp --qemu-boot +- virt-v2v -i disk disk.img -o qemu -os /var/tmp -oo qemu-boot - =head1 OPTIONS =over 4 -@@ -528,9 +523,6 @@ This is similar to I<-o local>, except that a shell script is written +@@ -510,9 +505,6 @@ This is similar to I<-o local>, except that a shell script is written which you can use to boot the guest in qemu. The converted disks and shell script are written to the directory specified by I<-os>. --When using this output mode, you can also specify the I<--qemu-boot> +-When using this output mode, you can also specify the I<-oo qemu-boot> -option which boots the guest under qemu immediately. - =item B<-o> B This is the same as I<-o rhv>. -@@ -775,11 +767,6 @@ Print information about the source guest and stop. This option is +@@ -768,10 +760,6 @@ Print information about the source guest and stop. This option is useful when you are setting up network and bridge maps. See L. -=item B<--qemu-boot> - --When using I<-o qemu> only, this boots the guest immediately after --virt-v2v finishes. +-This is the same as I<-oo qemu-boot>. - =item B<-q> =item B<--quiet> -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index 5e7c01f8..ac10ec31 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -276,7 +276,6 @@ let parse_cmdline () = - s_"Same as ‘-ip filename’"; - [ L"print-source" ], Getopt.Set print_source, - s_"Print source and stop"; -- [ L"qemu-boot" ], Getopt.Set qemu_boot, s_"Boot in qemu (-o qemu only)"; - [ L"root" ], Getopt.String ("ask|... ", set_root_choice), - s_"How to choose root filesystem"; - [ L"vddk-config" ], Getopt.String ("filename", set_input_option_compat "vddk-config"), -@@ -652,6 +651,8 @@ read the man page virt-v2v(1). - | Some d when not (is_directory d) -> - error (f_"-os %s: output directory does not exist or is not a directory") d - | Some d -> d in -+ if qemu_boot then -+ error (f_"-o qemu: the --qemu-boot option cannot be used in RHEL"); - Output_qemu.output_qemu os qemu_boot, - output_format, output_alloc +diff --git a/output/output_qemu.ml b/output/output_qemu.ml +index c4265703..822e4c72 100644 +--- a/output/output_qemu.ml ++++ b/output/output_qemu.ml +@@ -52,6 +52,9 @@ and qemu_parse_options options = + ) options.output_options; + let qemu_boot = !qemu_boot in ++ if qemu_boot then ++ error (f_"-o qemu: the -oo qemu-boot option cannot be used in RHEL"); ++ + (* -os must be set to a directory. *) + let output_storage = + match options.output_storage with +diff --git a/v2v/v2v.ml b/v2v/v2v.ml +index 47e6e937..503dfb55 100644 +--- a/v2v/v2v.ml ++++ b/v2v/v2v.ml +@@ -277,8 +277,6 @@ let rec main () = + s_"Same as ‘-ip filename’"; + [ L"print-source" ], Getopt.Set print_source, + s_"Print source and stop"; +- [ L"qemu-boot" ], Getopt.Unit (fun () -> set_output_option_compat "qemu-boot" ""), +- s_"Boot in qemu (-o qemu only)"; + [ L"root" ], Getopt.String ("ask|... ", set_root_choice), + s_"How to choose root filesystem"; + [ L"vddk-config" ], Getopt.String ("filename", set_input_option_compat "vddk-config"), -- 2.31.1 diff --git a/SOURCES/0005-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch b/SOURCES/0012-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch similarity index 64% rename from SOURCES/0005-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch rename to SOURCES/0012-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch index b8812aa..dc4ce8c 100644 --- a/SOURCES/0005-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch +++ b/SOURCES/0012-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch @@ -1,17 +1,17 @@ -From 49385571ce5967f8d9a102e935f201ee9c22326d Mon Sep 17 00:00:00 2001 +From 281273484f675b3ddba584ddc9751fc74653e67f Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 24 Apr 2015 09:45:41 -0400 -Subject: [PATCH 05/12] RHEL: Fix list of supported sound cards to match RHEL - qemu (RHBZ#1176493). +Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu + (RHBZ#1176493). --- - v2v/utils.ml | 5 +++-- + lib/utils.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -diff --git a/v2v/utils.ml b/v2v/utils.ml -index 7136e4be..a6c359f0 100644 ---- a/v2v/utils.ml -+++ b/v2v/utils.ml +diff --git a/lib/utils.ml b/lib/utils.ml +index d6861d08..a2fccf29 100644 +--- a/lib/utils.ml ++++ b/lib/utils.ml @@ -59,13 +59,14 @@ let kvm_arch = function (* Does qemu support the given sound card? *) let qemu_supports_sound_card = function diff --git a/SOURCES/0012-v2v-windows-Do-not-fix-NTFS-heads-in-Windows-Vista-a.patch b/SOURCES/0012-v2v-windows-Do-not-fix-NTFS-heads-in-Windows-Vista-a.patch deleted file mode 100644 index 802fb03..0000000 --- a/SOURCES/0012-v2v-windows-Do-not-fix-NTFS-heads-in-Windows-Vista-a.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 5581ad03910a3b0d198176453c92ad714343697d Mon Sep 17 00:00:00 2001 -From: "Richard W.M. Jones" -Date: Wed, 18 Aug 2021 11:00:12 +0100 -Subject: [PATCH 12/12] v2v: windows: Do not fix NTFS heads in Windows Vista - and later - -Setting/adjusting the number of drive heads in the NTFS header is only -necessary for ancient versions of Windows. Modern versions ignore -this. In addition this operation broke when we added BitLocker -support. Only do this for ancient Windows 2000/XP and skip it for -everything else. - -Reported-by: Ming Xie -Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1994984 -(cherry picked from commit 0a394c5c2f802098c9e481b4bacee7821e5dd0ae) ---- - v2v/convert_windows.ml | 44 ++++++++++++++++++++++-------------------- - 1 file changed, 23 insertions(+), 21 deletions(-) - -diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml -index 52e45599..1ed1d59e 100644 ---- a/v2v/convert_windows.ml -+++ b/v2v/convert_windows.ml -@@ -710,30 +710,32 @@ if errorlevel 3010 exit /b 0 - however, as this is specific to Windows 2003 it lists location - 0x1A as unused. - *) -- let rootpart = inspect.i_root in -+ if inspect.i_major_version < 6 (* is Windows 2000/XP *) then ( -+ let rootpart = inspect.i_root in - -- (* Ignore if the rootpart is something like /dev/sda. RHBZ#1276540. *) -- if not (g#is_whole_device rootpart) then ( -- (* Check that the root device contains NTFS magic. *) -- let magic = g#pread_device rootpart 8 3L in -- if magic = "NTFS " then ( -- (* Get the size of the whole disk containing the root partition. *) -- let rootdev = g#part_to_dev rootpart in (* eg. /dev/sda *) -- let size = g#blockdev_getsize64 rootdev in -+ (* Ignore if the rootpart is something like /dev/sda. RHBZ#1276540. *) -+ if not (g#is_whole_device rootpart) then ( -+ (* Check that the root device contains NTFS magic. *) -+ let magic = g#pread_device rootpart 8 3L in -+ if magic = "NTFS " then ( -+ (* Get the size of the whole disk containing the root partition. *) -+ let rootdev = g#part_to_dev rootpart in (* eg. /dev/sda *) -+ let size = g#blockdev_getsize64 rootdev in - -- let heads = (* refer to the table above *) -- if size < 2114445312L then 0x40 -- else if size < 4228374780L then 0x80 -- else 0xff in -+ let heads = (* refer to the table above *) -+ if size < 2114445312L then 0x40 -+ else if size < 4228374780L then 0x80 -+ else 0xff in - -- (* Update NTFS's idea of the number of heads. This is an -- * unsigned 16 bit little-endian integer, offset 0x1a from the -- * beginning of the partition. -- *) -- let b = Bytes.create 2 in -- Bytes.unsafe_set b 0 (Char.chr heads); -- Bytes.unsafe_set b 1 '\000'; -- ignore (g#pwrite_device rootpart (Bytes.to_string b) 0x1a_L) -+ (* Update NTFS's idea of the number of heads. This is an -+ * unsigned 16 bit little-endian integer, offset 0x1a from the -+ * beginning of the partition. -+ *) -+ let b = Bytes.create 2 in -+ Bytes.unsafe_set b 0 (Char.chr heads); -+ Bytes.unsafe_set b 1 '\000'; -+ ignore (g#pwrite_device rootpart (Bytes.to_string b) 0x1a_L) -+ ) - ) - ) - --- -2.31.1 - diff --git a/SOURCES/0006-RHEL-Fix-tests-for-libguestfs-winsupport.patch b/SOURCES/0013-RHEL-Fixes-for-libguestfs-winsupport.patch similarity index 59% rename from SOURCES/0006-RHEL-Fix-tests-for-libguestfs-winsupport.patch rename to SOURCES/0013-RHEL-Fixes-for-libguestfs-winsupport.patch index ff2817e..2d487e2 100644 --- a/SOURCES/0006-RHEL-Fix-tests-for-libguestfs-winsupport.patch +++ b/SOURCES/0013-RHEL-Fixes-for-libguestfs-winsupport.patch @@ -1,15 +1,42 @@ -From db2150a5d790c35fb23c6d9d6b29e602482ce555 Mon Sep 17 00:00:00 2001 +From aa4e5271d3fe02f252ace148b89e9894436a79fb Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sun, 30 Aug 2015 03:21:57 -0400 -Subject: [PATCH 06/12] RHEL: Fix tests for libguestfs-winsupport. +Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport. -It doesn't let us use guestfish for arbitrary Windows edits. +In tests we cannot use guestfish for arbitrary Windows edits. +In virt-v2v helpers we must set the program name to virt-v2v. --- + convert/convert.ml | 1 + + convert/windows_virtio.ml | 1 + test-data/phony-guests/make-windows-img.sh | 1 + tests/test-v2v-virtio-win-iso.sh | 8 +++++++- tests/test-v2v-windows-conversion.sh | 8 +++++++- - 3 files changed, 15 insertions(+), 2 deletions(-) + 5 files changed, 17 insertions(+), 2 deletions(-) +diff --git a/convert/convert.ml b/convert/convert.ml +index f78e87ef..d61d7fb4 100644 +--- a/convert/convert.ml ++++ b/convert/convert.ml +@@ -53,6 +53,7 @@ let rec convert dir options source = + + message (f_"Opening the source"); + let g = open_guestfs ~identifier:"v2v" () in ++ g#set_program "virt-v2v"; + g#set_memsize (g#get_memsize () * 2); + (* Setting the number of vCPUs allows parallel mkinitrd, but make + * sure this is not too large because each vCPU consumes guest RAM. +diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml +index 1c5c148e..b3a35a0a 100644 +--- a/convert/windows_virtio.ml ++++ b/convert/windows_virtio.ml +@@ -283,6 +283,7 @@ and copy_from_virtio_win g inspect srcdir destdir filter missing = + let g2 = + try + let g2 = open_guestfs ~identifier:"virtio_win" () in ++ g#set_program "virt-v2v"; + g2#add_drive_opts virtio_win ~readonly:true; + g2#launch (); + g2 diff --git a/test-data/phony-guests/make-windows-img.sh b/test-data/phony-guests/make-windows-img.sh index 30908a91..73cf5144 100755 --- a/test-data/phony-guests/make-windows-img.sh @@ -47,7 +74,7 @@ index 69f6f414..b9b806fb 100755 +guestfish --ro -a "$d/windows-sda" < "$script" > "$response" diff -u "$expected" "$response" diff --git a/tests/test-v2v-windows-conversion.sh b/tests/test-v2v-windows-conversion.sh -index aeab9a48..4b422c5b 100755 +index a4cf191d..1ff41f6a 100755 --- a/tests/test-v2v-windows-conversion.sh +++ b/tests/test-v2v-windows-conversion.sh @@ -76,6 +76,12 @@ mktest () @@ -63,7 +90,7 @@ index aeab9a48..4b422c5b 100755 firstboot_dir="/Program Files/Guestfs/Firstboot" mktest "is-dir \"$firstboot_dir\"" true mktest "is-file \"$firstboot_dir/firstboot.bat\"" true -@@ -88,7 +94,7 @@ for drv in netkvm qxl vioscsi viostor; do +@@ -88,7 +94,7 @@ for drv in netkvm vioscsi viostor; do done done diff --git a/SOURCES/0014-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch b/SOURCES/0014-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch new file mode 100644 index 0000000..f40d1f3 --- /dev/null +++ b/SOURCES/0014-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch @@ -0,0 +1,26 @@ +From a6b21f626a74c436563c14751f19f60a6433e153 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 2 Mar 2017 14:21:37 +0100 +Subject: [PATCH] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671) + +The SDL output mode is not supported in RHEL's qemu-kvm. +--- + input/input_disk.ml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/input/input_disk.ml b/input/input_disk.ml +index 0d92f256..753938f6 100644 +--- a/input/input_disk.ml ++++ b/input/input_disk.ml +@@ -70,7 +70,7 @@ let rec disk_source dir options args = + s_features = [ "acpi"; "apic"; "pae" ]; + s_firmware = UnknownFirmware; (* causes virt-v2v to autodetect *) + s_display = +- Some { s_display_type = Window; s_keymap = None; s_password = None; ++ Some { s_display_type = VNC; s_keymap = None; s_password = None; + s_listen = LNoListen; s_port = None }; + s_sound = None; + s_disks = s_disks; +-- +2.31.1 + diff --git a/SOURCES/0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch b/SOURCES/0015-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch similarity index 82% rename from SOURCES/0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch rename to SOURCES/0015-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch index bdf0b68..1180918 100644 --- a/SOURCES/0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch +++ b/SOURCES/0015-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch @@ -1,7 +1,7 @@ -From aa5cf3ba5d10400ee6d6c63dd77c711b6fdec116 Mon Sep 17 00:00:00 2001 +From 621a424738cb94f387171992af5352305121da6b Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 8 Mar 2017 11:03:40 +0100 -Subject: [PATCH 09/12] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203) +Subject: [PATCH] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203) They are not supported in RHEL. --- diff --git a/SOURCES/0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch b/SOURCES/0016-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch similarity index 94% rename from SOURCES/0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch rename to SOURCES/0016-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch index 5d10d09..cf87964 100644 --- a/SOURCES/0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch +++ b/SOURCES/0016-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch @@ -1,7 +1,7 @@ -From ccaae02ef3f081b544eca82f3652ca50ac5566a9 Mon Sep 17 00:00:00 2001 +From af0265e36747be9e6e4d7f91af2529f20e91e7ab Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Tue, 26 Mar 2019 09:42:25 +0100 -Subject: [PATCH 10/12] RHEL: point to KB for supported v2v hypervisors/guests +Subject: [PATCH] RHEL: point to KB for supported v2v hypervisors/guests --- docs/virt-v2v-support.pod | 104 ++------------------------------------ diff --git a/SOURCES/0011-RHEL-9-Disable-o-glance.patch b/SOURCES/0017-RHEL-Disable-o-glance.patch similarity index 69% rename from SOURCES/0011-RHEL-9-Disable-o-glance.patch rename to SOURCES/0017-RHEL-Disable-o-glance.patch index 564bd7d..e5446dd 100644 --- a/SOURCES/0011-RHEL-9-Disable-o-glance.patch +++ b/SOURCES/0017-RHEL-Disable-o-glance.patch @@ -1,16 +1,16 @@ -From 7edb403ee54153c64205915c0bd1d177c0094ee0 Mon Sep 17 00:00:00 2001 +From afec4c531c71de4f98115258d3eee17a25afae5e Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Wed, 30 Jun 2021 11:15:52 +0100 -Subject: [PATCH 11/12] RHEL 9: Disable -o glance +Subject: [PATCH] RHEL: Disable -o glance Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1977539 --- docs/virt-v2v-output-openstack.pod | 56 ++---------------------------- - docs/virt-v2v.pod | 22 ------------ + docs/virt-v2v.pod | 20 ----------- + output/output_glance.mli | 2 +- tests/test-v2v-o-glance.sh | 3 ++ - v2v/cmdline.ml | 3 -- - v2v/output_glance.ml | 2 +- - 5 files changed, 6 insertions(+), 80 deletions(-) + v2v/v2v.ml | 7 +--- + 5 files changed, 7 insertions(+), 81 deletions(-) diff --git a/docs/virt-v2v-output-openstack.pod b/docs/virt-v2v-output-openstack.pod index f5a3abad..1ab356e8 100644 @@ -100,16 +100,10 @@ index f5a3abad..1ab356e8 100644 =head1 AUTHOR diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod -index 719a95b5..2f4fe86c 100644 +index 04f3efd2..7c101513 100644 --- a/docs/virt-v2v.pod +++ b/docs/virt-v2v.pod -@@ -422,20 +422,10 @@ interested in looking at the metadata. - This option is not compatible with I<-o libvirt> since it would create - a faulty guest (one with no disks). - --This option is not compatible with I<-o glance> for technical reasons. -- - =item B<-o> B +@@ -432,14 +432,6 @@ See L below. This is the same as I<-o local>. @@ -124,7 +118,7 @@ index 719a95b5..2f4fe86c 100644 =item B<-o> B Set the output method to I. -@@ -1148,11 +1138,6 @@ and output methods may use disk space, as outlined in the table below. +@@ -1162,11 +1154,6 @@ and output methods may use disk space, as outlined in the table below. This temporarily places a full copy of the uncompressed source disks in C<$VIRT_V2V_TMPDIR> (or F). @@ -136,7 +130,7 @@ index 719a95b5..2f4fe86c 100644 =item I<-o local> =item I<-o qemu> -@@ -1337,13 +1322,6 @@ instance. +@@ -1351,13 +1338,6 @@ instance. Because of how Cinder volumes are presented as F block devices, using I<-o openstack> normally requires that virt-v2v is run as root. @@ -150,6 +144,16 @@ index 719a95b5..2f4fe86c 100644 =item Writing to block devices This normally requires root. See the next section. +diff --git a/output/output_glance.mli b/output/output_glance.mli +index 972320a2..9befc461 100644 +--- a/output/output_glance.mli ++++ b/output/output_glance.mli +@@ -18,4 +18,4 @@ + + (** [-o glance] output mode. *) + +-module Glance : Output.OUTPUT ++(*module Glance : Output.OUTPUT*) diff --git a/tests/test-v2v-o-glance.sh b/tests/test-v2v-o-glance.sh index c0db9115..074b5e16 100755 --- a/tests/test-v2v-o-glance.sh @@ -164,37 +168,52 @@ index c0db9115..074b5e16 100755 source ./functions.sh set -e set -x -diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml -index 01314580..e6c86b6f 100644 ---- a/v2v/cmdline.ml -+++ b/v2v/cmdline.ml -@@ -170,7 +170,6 @@ let parse_cmdline () = +diff --git a/v2v/v2v.ml b/v2v/v2v.ml +index 503dfb55..39fef0fa 100644 +--- a/v2v/v2v.ml ++++ b/v2v/v2v.ml +@@ -205,7 +205,6 @@ let rec main () = if !output_mode <> `Not_set then error (f_"%s option used more than once on the command line") "-o"; match mode with - | "glance" -> output_mode := `Glance | "libvirt" -> output_mode := `Libvirt - | "disk" | "local" -> output_mode := `Local + | "disk" | "local" -> output_mode := `Disk | "json" -> output_mode := `JSON -@@ -323,8 +322,6 @@ let parse_cmdline () = +@@ -257,7 +256,7 @@ let rec main () = + s_"Map network ‘in’ to ‘out’"; + [ L"no-trim" ], Getopt.String ("-", no_trim_warning), + s_"Ignored for backwards compatibility"; +- [ S 'o' ], Getopt.String ("glance|json|libvirt|local|null|openstack|qemu|rhv|rhv-upload|vdsm", set_output_mode), ++ [ S 'o' ], Getopt.String ("json|libvirt|local|null|openstack|qemu|rhv|rhv-upload|vdsm", set_output_mode), + s_"Set output mode (default: libvirt)"; + [ M"oa" ], Getopt.String ("sparse|preallocated", set_output_alloc), + s_"Set output allocation mode"; +@@ -325,8 +324,6 @@ virt-v2v -i libvirtxml guest-domain.xml -o local -os /var/tmp - virt-v2v -i disk disk.img -o local -os /var/tmp + virt-v2v -i disk disk.img -o local -os /var/tmp -- virt-v2v -i disk disk.img -o glance +-virt-v2v -i disk disk.img -o glance - There is a companion front-end called \"virt-p2v\" which comes as an ISO or CD image that can be booted on physical machines. -diff --git a/v2v/output_glance.ml b/v2v/output_glance.ml -index 8c5426b9..3fce4e7a 100644 ---- a/v2v/output_glance.ml -+++ b/v2v/output_glance.ml -@@ -100,4 +100,4 @@ object - end - - let output_glance = new output_glance --let () = Modules_list.register_output_module "glance" -+(* let () = Modules_list.register_output_module "glance" *) +@@ -396,7 +393,6 @@ read the man page virt-v2v(1). + pr "input:libvirtxml\n"; + pr "input:ova\n"; + pr "input:vmx\n"; +- pr "output:glance\n"; + pr "output:json\n"; + pr "output:libvirt\n"; + pr "output:local\n"; +@@ -486,7 +482,6 @@ read the man page virt-v2v(1). + | `Disk -> (module Output_disk.Disk) + | `Null -> (module Output_null.Null) + | `QEmu -> (module Output_qemu.QEMU) +- | `Glance -> (module Output_glance.Glance) + | `Openstack -> (module Output_openstack.Openstack) + | `RHV_Upload -> (module Output_rhv_upload.RHVUpload) + | `RHV -> (module Output_rhv.RHV) -- 2.31.1 diff --git a/SOURCES/0018-RHEL-Remove-the-in-place-option.patch b/SOURCES/0018-RHEL-Remove-the-in-place-option.patch new file mode 100644 index 0000000..7ce8c7b --- /dev/null +++ b/SOURCES/0018-RHEL-Remove-the-in-place-option.patch @@ -0,0 +1,152 @@ +From 39f31f9c86ed94699382b2c4d683fc1fd0d59195 Mon Sep 17 00:00:00 2001 +From: "Richard W.M. Jones" +Date: Thu, 2 Dec 2021 11:56:05 +0000 +Subject: [PATCH] RHEL: Remove the --in-place option + +This disables the virt-v2v --in-place option which we do not +wish to support in RHEL. +--- + docs/virt-v2v.pod | 51 +---------------------------------------------- + v2v/v2v.ml | 8 -------- + 2 files changed, 1 insertion(+), 58 deletions(-) + +diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod +index 7c101513..4f89d2b2 100644 +--- a/docs/virt-v2v.pod ++++ b/docs/virt-v2v.pod +@@ -8,10 +8,6 @@ virt-v2v - Convert a guest to use KVM + [-o mode] [other -o* options] + [guest|filename] + +- virt-v2v --in-place +- [-i mode] [other -i* options] +- [guest|filename] +- + =head1 DESCRIPTION + + Virt-v2v converts a single guest from a foreign hypervisor to run on +@@ -37,12 +33,6 @@ The input and output sides of virt-v2v are separate and unrelated. + Virt-v2v can read from any input and write to any output. Therefore + these sides of virt-v2v are documented separately in this manual. + +-Virt-v2v normally copies from the input to the output, called "copying +-mode". In this case the source guest is always left unchanged. +-In-place conversion (I<--in-place>) only uses the I<-i*> options and +-modifies the source guest in-place. (See L +-below.) +- + =head2 Other virt-v2v topics + + L — Supported hypervisors, virtualization +@@ -290,20 +280,6 @@ For I<-i disk> only, this specifies the format of the input disk + image. For other input methods you should specify the input + format in the metadata. + +-=item B<--in-place> +- +-Do not create an output virtual machine in the target hypervisor. +-Instead, adjust the guest OS in the source VM to run in the input +-hypervisor. +- +-This mode is meant for integration with other toolsets, which take the +-responsibility of converting the VM configuration, providing for +-rollback in case of errors, transforming the storage, etc. +- +-See L below. +- +-Conflicts with all I<-o *> options. +- + =item B<-io> OPTION=VALUE + + Set input option(s) related to the current input mode or transport. +@@ -1278,7 +1254,7 @@ have at least 100 available inodes. + =head3 Minimum free space check in the host + + You must have sufficient free space in the host directory used to +-store large temporary overlays (except in I<--in-place> mode). To ++store large temporary overlays. To + find out which directory this is, use: + + $ df -h "`guestfish get-cachedir`" +@@ -1410,31 +1386,6 @@ that instead. + + + +-=head2 In-place conversion +- +-It is also possible to use virt-v2v in scenarios where a foreign VM +-has already been imported into a KVM-based hypervisor, but still needs +-adjustments in the guest to make it run in the new virtual hardware. +- +-In that case it is assumed that a third-party tool has created the +-target VM in the supported KVM-based hypervisor based on the source VM +-configuration and contents, but using virtual devices more appropriate +-for KVM (e.g. virtio storage and network, etc.). +- +-Then, to make the guest OS boot and run in the changed environment, +-one can use: +- +- virt-v2v -ic qemu:///system converted_vm --in-place +- +-Virt-v2v will analyze the configuration of C in the +-C libvirt instance, and apply various fixups to the +-guest OS configuration to make it match the VM configuration. This +-may include installing virtio drivers, configuring the bootloader, the +-mountpoints, the network interfaces, and so on. +- +-Should an error occur during the operation, virt-v2v exits with an +-error code leaving the VM in an undefined state. +- + =head2 Machine readable output + + The I<--machine-readable> option can be used to make the output more +diff --git a/v2v/v2v.ml b/v2v/v2v.ml +index 39fef0fa..a1143b68 100644 +--- a/v2v/v2v.ml ++++ b/v2v/v2v.ml +@@ -183,7 +183,6 @@ let rec main () = + let output_storage = ref None in + + (* Other options that we handle here. *) +- let in_place = ref false in + let print_source = ref false in + + let input_mode = ref `Not_set in +@@ -248,8 +247,6 @@ let rec main () = + s_"Use password from file to connect to input hypervisor"; + [ M"it" ], Getopt.String ("transport", set_string_option_once "-it" input_transport), + s_"Input transport"; +- [ L"in-place" ], Getopt.Set in_place, +- s_"Only tune the guest in the input VM"; + [ L"mac" ], Getopt.String ("mac:network|bridge|ip:out", add_mac), + s_"Map NIC to network or bridge or assign static IP"; + [ S 'n'; L"network" ], Getopt.String ("in:out", add_network), +@@ -347,7 +344,6 @@ read the man page virt-v2v(1). + + (* Dereference the arguments. *) + let args = List.rev !args in +- let in_place = !in_place in + let input_conn = !input_conn in + let input_mode = !input_mode in + let input_transport = +@@ -367,9 +363,6 @@ read the man page virt-v2v(1). + let root_choice = !root_choice in + let static_ips = !static_ips in + +- (* --in-place isn't implemented yet - TODO *) +- if in_place then error "XXX --in-place option is not implemented yet"; +- + (* No arguments and machine-readable mode? Print out some facts + * about what this binary supports. + *) +@@ -383,7 +376,6 @@ read the man page virt-v2v(1). + pr "vddk\n"; + pr "colours-option\n"; + pr "vdsm-compat-option\n"; +- pr "in-place\n"; + pr "io/oo\n"; + pr "mac-option\n"; + pr "bandwidth-option\n"; +-- +2.31.1 + diff --git a/SOURCES/copy-patches.sh b/SOURCES/copy-patches.sh index 4f63c5f..935c7d4 100755 --- a/SOURCES/copy-patches.sh +++ b/SOURCES/copy-patches.sh @@ -6,24 +6,29 @@ set -e # directory. Use it like this: # ./copy-patches.sh -rhel_version=av-8.3.0 +project=virt-v2v +rhel_version=9.0.0 # Check we're in the right directory. -if [ ! -f virt-v2v.spec ]; then - echo "$0: run this from the directory containing 'virt-v2v.spec'" +if [ ! -f $project.spec ]; then + echo "$0: run this from the directory containing '$project.spec'" exit 1 fi -git_checkout=$HOME/d/virt-v2v-rhel-$rhel_version +case `id -un` in + rjones) git_checkout=$HOME/d/$project-rhel-$rhel_version ;; + lacos) git_checkout=$HOME/src/v2v/$project ;; + *) git_checkout=$HOME/d/$project-rhel-$rhel_version ;; +esac if [ ! -d $git_checkout ]; then echo "$0: $git_checkout does not exist" echo "This script is only for use by the maintainer when preparing a" - echo "virt-v2v release on RHEL." + echo "$project release on RHEL." exit 1 fi -# Get the base version of virt-v2v. -version=`grep '^Version:' virt-v2v.spec | awk '{print $2}'` +# Get the base version of the project. +version=`grep '^Version:' $project.spec | awk '{print $2}'` tag="v$version" # Remove any existing patches. @@ -31,7 +36,7 @@ git rm -f [0-9]*.patch ||: rm -f [0-9]*.patch # Get the patches. -(cd $git_checkout; rm -f [0-9]*.patch; git format-patch -N --submodule=diff $tag) +(cd $git_checkout; rm -f [0-9]*.patch; git -c core.abbrev=8 format-patch -O/dev/null --subject-prefix=PATCH -N --submodule=diff $tag) mv $git_checkout/[0-9]*.patch . # Remove any not to be applied. @@ -42,7 +47,7 @@ git add [0-9]*.patch # Print out the patch lines. echo -echo "--- Copy the following text into virt-v2v.spec file" +echo "--- Copy the following text into $project.spec file" echo echo "# Patches." diff --git a/SOURCES/virt-v2v-1.45.3.tar.gz.sig b/SOURCES/virt-v2v-1.45.3.tar.gz.sig deleted file mode 100644 index 01d0de8..0000000 --- a/SOURCES/virt-v2v-1.45.3.tar.gz.sig +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN PGP SIGNATURE----- - -iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmENHIERHHJpY2hAYW5u -ZXhpYS5vcmcACgkQkXOPc+G3aKDoYhAAqqvZDL3kQg3wgfeKQyxuSB8ZczXHYk8r -Qp+ciXMxDmfp/Eb98MsBlWfsHbORMerXR/AYT/in4i2VgHGVjOwX2ejCDgex09KL -WrLug4sCIJo6Lv5r6bCR55aVCTOtcp9XPYsm5hZCLKzrpG2NfjHWnIAuHsyKQEhg -mkNAAT7vakfh8Yj6LYo7Pa+/QIor+0nHNTHpMupboxqSjWcmZIewg4O9rhLS6yIK -nNVetrnyBynYuvjy3Ls7IuwTtDLK/9yAPBV8Ln7EXutD54jYHAGLtxyqjk1lDVvW -inVq231DNbznx0Za+uViyl9Q/rJGxla8js5Q5xUjDtWAs8ZTuSUCA+HLjGD+lmLc -iL4tY4j9An5rO3ZArEXYZuQvftcMIwIgg5VMfB7f7KjxhIdgt7x6ivAq6wy59Z8N -kdY22JsUZyuZ60MZVO9smGSfOePIuZpOASRCwQlaRp7qlwpHCzuzpeZvWs5/U+JB -XCL/kUoXAxbNdpmvXO0J2AJ8CByFrhqcexO+guzxKa5sRuDIi4XuwGm2EqCuQ0t0 -bi1eJYmgArw6SZawVj6MQHw6ckzoQ2vnO08278nSYfjXtiDlTjq1Z79GlmmyXkQO -SEVEgcYBY8ZNEuxFftQ+JTU+RGW3RX5/zEhi67kfqBWvweFtkMqq+pIY5IXJ/8th -umDx3CPFkoE= -=DOvs ------END PGP SIGNATURE----- diff --git a/SOURCES/virt-v2v-1.45.96.tar.gz.sig b/SOURCES/virt-v2v-1.45.96.tar.gz.sig new file mode 100644 index 0000000..3d95d76 --- /dev/null +++ b/SOURCES/virt-v2v-1.45.96.tar.gz.sig @@ -0,0 +1,17 @@ +-----BEGIN PGP SIGNATURE----- + +iQJFBAABCAAvFiEE93dPsa0HSn6Mh2fqkXOPc+G3aKAFAmHW+SkRHHJpY2hAYW5u +ZXhpYS5vcmcACgkQkXOPc+G3aKCH9g/+LcnZLSLWTtcb8ZeXsxdAX8hna4r15VsE +c4qZqT8/DJCrAw5aaP+udTryF01RMXogCeIx+zaEPioCNlISxQRBooKwz6V8ajP6 +vglyzu6veZ1TYwdnmnDhp8GThoP4NTtHRINMTOpgpMR6FKTIrdDGu6WN3DHaMCQL +E2nNBWKNOiiYZfR6O/mZlpxnnIag6O7/5ZM4QgGFdZXe83adYNNuB9Mg06RSt3wa +Ae9zaqBU3AonVZFe41XJv1Zs7uis7zUu03sHUDP1R6NpVfo1+93EKju71Tshd/Aq +9ZXN+3ELlj+9uYqTDycCbQWHzP/PuwtRNLAQVlQPm3S/emW54IaPAwU8auIboR4W +fhlWqFoYzDg4JRB44/N9+eTRUYDrDS5UgAzy5IwuOJMp0sLo4vl0mRa5y7ddDyG2 +sNI2TbJNFgOfKbRdcZD5JUQNuym5TXvd6LGzMOoLYFa6dOOx18LJHUvloVuHzZu5 +Y2AJFQDpOB6j3cG4dre/K2Nm806spBLbvYEMB4wBSJECfOTC6Toz0DeHoGsVlv08 +ATeaM9zKJyPUtnFKETY1v+tUnOc41bh8YHYhP/KrYOjC+pQlJsNZyPwmgL+WC8gw +zMmLfdKrmqNNeZD0uoWcPT0myqrnRdu69anqVHVLIEaBHsp9TwwxrIrfS028FtxP +u70vmzhQjM0= +=OjBh +-----END PGP SIGNATURE----- diff --git a/SPECS/virt-v2v.spec b/SPECS/virt-v2v.spec index 1a96b00..13f3c2c 100644 --- a/SPECS/virt-v2v.spec +++ b/SPECS/virt-v2v.spec @@ -14,8 +14,8 @@ Name: virt-v2v Epoch: 1 -Version: 1.45.3 -Release: 3%{?dist} +Version: 1.45.96 +Release: 1%{?dist} Summary: Convert a virtual machine to run on KVM License: GPLv2+ @@ -50,18 +50,25 @@ ExclusiveArch: x86_64 # Downstream (RHEL-only) patches. %if 0%{?rhel} -Patch9001: 0001-Revert-v2v-Remove-o-rhv-upload-oa-preallocated.patch -Patch9002: 0002-RHEL-v2v-rhv-upload-Remove-restriction-on-oa-sparse.patch -Patch9003: 0003-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch -Patch9004: 0004-RHEL-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch -Patch9005: 0005-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch -Patch9006: 0006-RHEL-Fix-tests-for-libguestfs-winsupport.patch -Patch9007: 0007-RHEL-v2v-Disable-the-virt-v2v-in-place-option.patch -Patch9008: 0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch -Patch9009: 0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch -Patch9010: 0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch -Patch9011: 0011-RHEL-9-Disable-o-glance.patch -Patch9012: 0012-v2v-windows-Do-not-fix-NTFS-heads-in-Windows-Vista-a.patch +# Patches. +Patch0001: 0001-lib-types-reformat-string_of_guestcaps.patch +Patch0002: 0002-lib-types-update-string_of_guestcaps.patch +Patch0003: 0003-lib-types-introduce-the-gcaps_virtio_1_0-guest-capab.patch +Patch0004: 0004-output-create_libvirt_xml-pick-virtio-transitional-m.patch +Patch0005: 0005-output-create_json-expose-gcaps_virtio_1_0.patch +Patch0006: 0006-convert-libosinfo-wrap-osinfo_os_get_all_devices.patch +Patch0007: 0007-convert-libosinfo_utils-introduce-string_of_osinfo_d.patch +Patch0008: 0008-convert-libosinfo_utils-introduce-os_support_of_osin.patch +Patch0009: 0009-convert-determine-machine-type-and-virtio-1.0-from-o.patch +Patch0010: 0010-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch +Patch0011: 0011-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch +Patch0012: 0012-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch +Patch0013: 0013-RHEL-Fixes-for-libguestfs-winsupport.patch +Patch0014: 0014-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch +Patch0015: 0015-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch +Patch0016: 0016-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch +Patch0017: 0017-RHEL-Disable-o-glance.patch +Patch0018: 0018-RHEL-Remove-the-in-place-option.patch %endif %if 0%{patches_touch_autotools} @@ -72,16 +79,17 @@ BuildRequires: make BuildRequires: /usr/bin/pod2man BuildRequires: gcc BuildRequires: ocaml >= 4.01 -BuildRequires: libguestfs-devel >= 1:1.42 +BuildRequires: libguestfs-devel >= 1:1.42 BuildRequires: augeas-devel BuildRequires: bash-completion BuildRequires: file-devel BuildRequires: gettext-devel BuildRequires: jansson-devel +BuildRequires: libnbd-devel BuildRequires: libosinfo-devel -BuildRequires: libvirt-devel BuildRequires: libvirt-daemon-kvm +BuildRequires: libvirt-devel BuildRequires: libxml2-devel BuildRequires: pcre-devel BuildRequires: perl(Sys::Guestfs) @@ -91,6 +99,7 @@ BuildRequires: xorriso BuildRequires: ocaml-findlib-devel BuildRequires: ocaml-libguestfs-devel +BuildRequires: ocaml-libnbd-devel BuildRequires: ocaml-fileutils-devel BuildRequires: ocaml-gettext-devel %if !0%{?rhel} @@ -118,7 +127,8 @@ Requires: gawk Requires: gzip Requires: unzip Requires: curl -Requires: /usr/bin/virsh +Requires: openssh-clients >= 8.7p1 +Requires: %{_bindir}/virsh # Ensure the UEFI firmware is available, to properly convert # EFI guests (RHBZ#1429643). @@ -129,14 +139,25 @@ Requires: edk2-ovmf Requires: edk2-aarch64 %endif -# Needed for -it vddk, and -o rhv-upload. -Requires: nbdkit +Requires: libnbd >= 1.8.2-2.el9 +Requires: %{_bindir}/qemu-nbd +Requires: %{_bindir}/nbdcopy +Requires: %{_bindir}/nbdinfo +Requires: nbdkit-server >= 1.28.3-2.el9 Requires: nbdkit-curl-plugin +Requires: nbdkit-file-plugin +Requires: nbdkit-nbd-plugin +Requires: nbdkit-null-plugin Requires: nbdkit-python-plugin Requires: nbdkit-ssh-plugin %ifarch x86_64 Requires: nbdkit-vddk-plugin %endif +Requires: nbdkit-cacheextents-filter +Requires: nbdkit-cow-filter >= 1.26.5-1.el9 +Requires: nbdkit-rate-filter +Requires: nbdkit-readahead-filter +Requires: nbdkit-retry-filter # For rhsrvany.exe, used to install firstboot scripts in Windows guests. Requires: mingw32-srvany >= 1.0-13 @@ -288,6 +309,29 @@ popd %changelog +* Thu Jan 06 2022 Richard W.M. Jones - 1:1.45.96-1 +- Rebase to upstream 1.45.96. + resolves: rhbz#2011713 +- Add virtio-transitional for older guests when converting to q35 + resolves: rhbz#1942325 + +* Thu Dec 23 2021 Laszlo Ersek - 1:1.45.95-3 +- output_rhv: restrict block status collection to the old RHV output +- Rebase from upstream commit 702a511b7f33 to direct child commit 07b12fe99fb9 + resolves: rhbz#2034240 + +* Sat Dec 18 2021 Richard W.M. Jones - 1:1.45.95-2 +- Rebase to upstream 1.45.95. +- Change video type to VGA (instead of QXL). +- Remove --in-place support properly. +- Remove -o glance support properly. +- Fix quoting with openssh >= 8.7 (RHEL) / 8.8 +- Fix q35 error "IDE controllers are unsupported" +- Add virt-v2v and libvirt version in debug output +- Fix -o rhv output mode showing no guests listed + resolves: rhbz#2011713, rhbz#1961107, rhbz#2027673, + rhbz#1637857, rhbz#2032112, rhbz#2027598 + * Wed Aug 18 2021 Richard W.M. Jones - 1:1.45.3-3 - Fix conversion of Windows BitLocker guests resolves: rhbz#1994984