commit e6de86d686fb150474b298d0127e466a3ed68217 Author: CentOS Sources Date: Wed Nov 3 18:31:07 2021 -0400 import virt-v2v-1.45.3-3.el9 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8944817 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +SOURCES/libguestfs.keyring +SOURCES/virt-v2v-1.45.3.tar.gz diff --git a/.virt-v2v.metadata b/.virt-v2v.metadata new file mode 100644 index 0000000..2de4242 --- /dev/null +++ b/.virt-v2v.metadata @@ -0,0 +1,2 @@ +1bbc40f501a7fef9eef2a39b701a71aee2fea7c4 SOURCES/libguestfs.keyring +afb8d9d36adf52857e16c73514dda00bd5e30c58 SOURCES/virt-v2v-1.45.3.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 new file mode 100644 index 0000000..a596368 --- /dev/null +++ b/SOURCES/0001-Revert-v2v-Remove-o-rhv-upload-oa-preallocated.patch @@ -0,0 +1,123 @@ +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/0002-RHEL-v2v-rhv-upload-Remove-restriction-on-oa-sparse.patch b/SOURCES/0002-RHEL-v2v-rhv-upload-Remove-restriction-on-oa-sparse.patch new file mode 100644 index 0000000..6abff63 --- /dev/null +++ b/SOURCES/0002-RHEL-v2v-rhv-upload-Remove-restriction-on-oa-sparse.patch @@ -0,0 +1,90 @@ +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/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 new file mode 100644 index 0000000..6857062 --- /dev/null +++ b/SOURCES/0003-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch @@ -0,0 +1,33 @@ +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/0004-RHEL-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch b/SOURCES/0004-RHEL-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch new file mode 100644 index 0000000..230bfc3 --- /dev/null +++ b/SOURCES/0004-RHEL-v2v-Disable-the-qemu-boot-option-RHBZ-1147313.patch @@ -0,0 +1,106 @@ +From bb55b78b68e6e8039734eb1d7af22b455f8fbdc2 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 + (RHBZ#1147313). + +This cannot work because there is no Gtk or SDL output mode +in RHEL's qemu-kvm. + +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(-) + +diff --git a/docs/virt-v2v-output-local.pod b/docs/virt-v2v-output-local.pod +index a5f155cb..3a2e6238 100644 +--- a/docs/virt-v2v-output-local.pod ++++ b/docs/virt-v2v-output-local.pod +@@ -9,7 +9,7 @@ or libvirt + + virt-v2v [-i* options] -o local -os DIRECTORY + +- virt-v2v [-i* options] -o qemu -os DIRECTORY [--qemu-boot] ++ virt-v2v [-i* options] -o qemu -os DIRECTORY + + virt-v2v [-i* options] -o json -os DIRECTORY + [-oo json-disks-pattern=PATTERN] +@@ -50,12 +50,10 @@ where C is the guest name. + + =item B<-o qemu -os> C + +-=item B<-o qemu -os> C B<--qemu-boot> +- + This converts the guest to files in C. Unlike I<-o local> + above, a shell script is created which contains the raw qemu command + you would need to boot the guest. However the shell script is not +-run, I you also add the I<--qemu-boot> option. ++run. + + =item B<-o json -os> C + +diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod +index bdf4d716..83f6fd4d 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 + image(s) you do not need to specify the name of the disk image on the + command line. + +-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 +- + =head1 OPTIONS + + =over 4 +@@ -528,9 +523,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> +-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 + 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. +- + =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 + +-- +2.31.1 + diff --git a/SOURCES/0005-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch b/SOURCES/0005-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch new file mode 100644 index 0000000..b8812aa --- /dev/null +++ b/SOURCES/0005-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch @@ -0,0 +1,34 @@ +From 49385571ce5967f8d9a102e935f201ee9c22326d 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). + +--- + v2v/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 +@@ -59,13 +59,14 @@ let kvm_arch = function + (* Does qemu support the given sound card? *) + let qemu_supports_sound_card = function + | Types.AC97 +- | Types.ES1370 + | Types.ICH6 + | Types.ICH9 + | Types.PCSpeaker ++ -> true ++ | Types.ES1370 + | Types.SB16 + | Types.USBAudio +- -> true ++ -> false + + (* Find the UEFI firmware. *) + let find_uefi_firmware guest_arch = +-- +2.31.1 + diff --git a/SOURCES/0006-RHEL-Fix-tests-for-libguestfs-winsupport.patch b/SOURCES/0006-RHEL-Fix-tests-for-libguestfs-winsupport.patch new file mode 100644 index 0000000..ff2817e --- /dev/null +++ b/SOURCES/0006-RHEL-Fix-tests-for-libguestfs-winsupport.patch @@ -0,0 +1,77 @@ +From db2150a5d790c35fb23c6d9d6b29e602482ce555 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. + +It doesn't let us use guestfish for arbitrary Windows edits. +--- + 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(-) + +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 ++++ b/test-data/phony-guests/make-windows-img.sh +@@ -37,6 +37,7 @@ fi + + # Create a disk image. + guestfish < "$script" + :> "$expected" + ++cat >> "$script" < "$response" ++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 +--- a/tests/test-v2v-windows-conversion.sh ++++ b/tests/test-v2v-windows-conversion.sh +@@ -76,6 +76,12 @@ mktest () + :> "$script" + :> "$expected" + ++cat >> "$script" < "$response" ++guestfish --ro -a "$d/windows-sda" < "$script" > "$response" + diff -u "$expected" "$response" + + # We also update the Registry several times, for firstboot, and (ONLY +-- +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 new file mode 100644 index 0000000..df36eac --- /dev/null +++ b/SOURCES/0007-RHEL-v2v-Disable-the-virt-v2v-in-place-option.patch @@ -0,0 +1,288 @@ +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/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 new file mode 100644 index 0000000..cf31f28 --- /dev/null +++ b/SOURCES/0008-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch @@ -0,0 +1,26 @@ +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/0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch b/SOURCES/0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch new file mode 100644 index 0000000..bdf0b68 --- /dev/null +++ b/SOURCES/0009-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch @@ -0,0 +1,26 @@ +From aa5cf3ba5d10400ee6d6c63dd77c711b6fdec116 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) + +They are not supported in RHEL. +--- + docs/virt-v2v-input-xen.pod | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/docs/virt-v2v-input-xen.pod b/docs/virt-v2v-input-xen.pod +index cd3210bf..e9f336a9 100644 +--- a/docs/virt-v2v-input-xen.pod ++++ b/docs/virt-v2v-input-xen.pod +@@ -12,7 +12,7 @@ virt-v2v-input-xen - Using virt-v2v to convert guests from Xen + =head1 DESCRIPTION + + This page documents how to use L to convert guests from +-RHEL 5 Xen, or SLES and OpenSUSE Xen hosts. ++RHEL 5 Xen hosts. + + =head1 INPUT FROM XEN + +-- +2.31.1 + diff --git a/SOURCES/0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch b/SOURCES/0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch new file mode 100644 index 0000000..5d10d09 --- /dev/null +++ b/SOURCES/0010-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch @@ -0,0 +1,127 @@ +From ccaae02ef3f081b544eca82f3652ca50ac5566a9 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 + +--- + docs/virt-v2v-support.pod | 104 ++------------------------------------ + 1 file changed, 4 insertions(+), 100 deletions(-) + +diff --git a/docs/virt-v2v-support.pod b/docs/virt-v2v-support.pod +index 9815f51f..1ffc0f9d 100644 +--- a/docs/virt-v2v-support.pod ++++ b/docs/virt-v2v-support.pod +@@ -8,106 +8,10 @@ systems and guests in virt-v2v + This page documents which foreign hypervisors, virtualization + management systems and guest types that L can support. + +-Note this page applies to upstream virt-v2v from +-L and in downstream distributions of virt-v2v +-sometimes features are intentionally removed, or are present but not +-supported. +- +-=head2 Hypervisors (Input) +- +-=over 4 +- +-=item VMware ESXi +- +-Must be managed by VMware vCenter E 5.0 unless VDDK is available. +- +-=item OVA exported from VMware +- +-OVAs from other hypervisors will not work. +- +-=item VMX from VMware +- +-VMX files generated by other hypervisors will not work. +- +-=item RHEL 5 Xen +- +-=item SUSE Xen +- +-=item Citrix Xen +- +-Citrix Xen has not been recently tested. +- +-=item Hyper-V +- +-Not recently tested. Requires that you export the disk or use +-L on Hyper-V. +- +-=item Direct from disk images +- +-Only disk images exported from supported hypervisors, and using +-container formats supported by qemu. +- +-=item Physical machines +- +-Using the L tool. +- +-=back +- +-=head2 Hypervisors (Output) +- +-QEMU and KVM only. +- +-=head2 Virtualization management systems (Output) +- +-=over 4 +- +-=item OpenStack +- +-=item Red Hat Virtualization (RHV) 4.1 and up +- +-=item Local libvirt +- +-And hence L, L, and similar tools. +- +-=item Local disk +- +-=back +- +-=head2 Guests +- +-=over 4 +- +-=item Red Hat Enterprise Linux 3, 4, 5, 6, 7 +- +-=item CentOS 3, 4, 5, 6, 7 +- +-=item Scientific Linux 3, 4, 5, 6, 7 +- +-=item Oracle Linux +- +-=item Fedora +- +-=item SLES 10 and up +- +-=item OpenSUSE 10 and up +- +-=item ALT Linux 9 and up +- +-=item Debian 6 and up +- +-=item Ubuntu 10.04, 12.04, 14.04, 16.04, and up +- +-=item Windows XP to Windows 10 / Windows Server 2016 +- +-We use Windows internal version numbers, see +-L +- +-Currently NT 5.2 to NT 6.3 are supported. +- +-See L below for additional notes on converting Windows +-guests. +- +-=back ++For more information on supported hypervisors, and guest types in ++RHEL, please consult the following Knowledgebase article on these ++Red Hat Customer Portal: ++L. + + =head2 Guest firmware + +-- +2.31.1 + diff --git a/SOURCES/0011-RHEL-9-Disable-o-glance.patch b/SOURCES/0011-RHEL-9-Disable-o-glance.patch new file mode 100644 index 0000000..564bd7d --- /dev/null +++ b/SOURCES/0011-RHEL-9-Disable-o-glance.patch @@ -0,0 +1,200 @@ +From 7edb403ee54153c64205915c0bd1d177c0094ee0 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 + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1977539 +--- + docs/virt-v2v-output-openstack.pod | 56 ++---------------------------- + docs/virt-v2v.pod | 22 ------------ + tests/test-v2v-o-glance.sh | 3 ++ + v2v/cmdline.ml | 3 -- + v2v/output_glance.ml | 2 +- + 5 files changed, 6 insertions(+), 80 deletions(-) + +diff --git a/docs/virt-v2v-output-openstack.pod b/docs/virt-v2v-output-openstack.pod +index f5a3abad..1ab356e8 100644 +--- a/docs/virt-v2v-output-openstack.pod ++++ b/docs/virt-v2v-output-openstack.pod +@@ -10,13 +10,10 @@ virt-v2v-output-openstack - Using virt-v2v to convert guests to OpenStack + [-oo verify-server-certificate=false] + [-oo os-username=admin] [-oo os-*=*] + +- virt-v2v [-i* options] -o glance +- + =head1 DESCRIPTION + + This page documents how to use L to convert guests to run +-on OpenStack. There are two output modes you can select, but only +-I<-o openstack> should be used normally. ++on OpenStack. + + =over 4 + +@@ -27,15 +24,6 @@ Full description: L + This is the modern method for uploading to OpenStack via the REST API. + Guests can be directly converted into Cinder volumes. + +-=item B<-o glance> +- +-Full description: L +- +-This is the old method for uploading to Glance. Unfortunately Glance +-is not well suited to storing converted guests (since virt-v2v deals +-with "pets" not templated "cattle"), so this method is not recommended +-unless you really know what you are doing. +- + =back + + =head1 OUTPUT TO OPENSTACK +@@ -170,50 +158,10 @@ no Cinder volume type is used. + The following options are B supported with OpenStack: I<-oa>, + I<-of>. + +-=head1 OUTPUT TO GLANCE +- +-Note this is a legacy option. In most cases you should use +-L instead. +- +-To output to OpenStack Glance, use the I<-o glance> option. +- +-This runs the L CLI program which must be installed on the +-virt-v2v conversion host. For authentication to work, you will need +-to set C environment variables. +- +-Normally there is a file called C or C +-which you can simply C to set everything up. +- +-Virt-v2v adds metadata for the guest to Glance, describing such things +-as the guest operating system and what drivers it requires. The +-command C will display the metadata as "Property" +-fields such as C and C. +- +-=head2 Glance and sparseness +- +-Glance image upload doesn't appear to correctly handle sparseness. +-For this reason, using qcow2 will be faster and use less space on the +-Glance server. Use the virt-v2v S> option. +- +-=head2 Glance and multiple disks +- +-If the guest has a single disk, then the name of the disk in Glance +-will be the name of the guest. You can control this using the I<-on> +-option. +- +-Glance doesn't have a concept of associating multiple disks with a +-single guest, and Nova doesn't allow you to boot a guest from multiple +-Glance disks either. If the guest has multiple disks, then the first +-(assumed to be the system disk) will have the name of the guest, and +-the second and subsequent data disks will be called +-C-disk2>, C-disk3> etc. It may be best to +-leave the system disk in Glance, and import the data disks to Cinder. +- + =head1 SEE ALSO + + L, +-L, +-L. ++L. + + =head1 AUTHOR + +diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod +index 719a95b5..2f4fe86c 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 + + This is the same as I<-o local>. + +-=item B<-o> B +- +-This is a legacy option. You should probably use I<-o openstack> +-instead. +- +-Set the output method to OpenStack Glance. In this mode the converted +-guest is uploaded to Glance. See L. +- + =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. + This temporarily places a full copy of the uncompressed source disks + in C<$VIRT_V2V_TMPDIR> (or F). + +-=item I<-o glance> +- +-This temporarily places a full copy of the output disks in +-C<$VIRT_V2V_TMPDIR> (or F). +- + =item I<-o local> + + =item I<-o qemu> +@@ -1337,13 +1322,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. + +-=item Writing to Glance +- +-This does I need root (in fact it probably won’t work), but may +-require either a special user and/or for you to source a script that +-sets authentication environment variables. Consult the Glance +-documentation. +- + =item Writing to block devices + + This normally requires root. See the next section. +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 ++++ b/tests/test-v2v-o-glance.sh +@@ -20,6 +20,9 @@ + + set -e + ++# Feature is disabled in RHEL 9. ++exit 77 ++ + 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 () = + 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 + | "json" -> output_mode := `JSON +@@ -323,8 +322,6 @@ let parse_cmdline () = + + virt-v2v -i disk disk.img -o local -os /var/tmp + +- 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" *) +-- +2.31.1 + 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 new file mode 100644 index 0000000..802fb03 --- /dev/null +++ b/SOURCES/0012-v2v-windows-Do-not-fix-NTFS-heads-in-Windows-Vista-a.patch @@ -0,0 +1,80 @@ +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/copy-patches.sh b/SOURCES/copy-patches.sh new file mode 100755 index 0000000..4f63c5f --- /dev/null +++ b/SOURCES/copy-patches.sh @@ -0,0 +1,55 @@ +#!/bin/bash - + +set -e + +# Maintainer script to copy patches from the git repo to the current +# directory. Use it like this: +# ./copy-patches.sh + +rhel_version=av-8.3.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'" + exit 1 +fi + +git_checkout=$HOME/d/virt-v2v-rhel-$rhel_version +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." + exit 1 +fi + +# Get the base version of virt-v2v. +version=`grep '^Version:' virt-v2v.spec | awk '{print $2}'` +tag="v$version" + +# Remove any existing patches. +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) +mv $git_checkout/[0-9]*.patch . + +# Remove any not to be applied. +rm -f *NOT-FOR-RPM*.patch + +# Add the patches. +git add [0-9]*.patch + +# Print out the patch lines. +echo +echo "--- Copy the following text into virt-v2v.spec file" +echo + +echo "# Patches." +for f in [0-9]*.patch; do + n=`echo $f | awk -F- '{print $1}'` + echo "Patch$n: $f" +done + +echo +echo "--- End of text" diff --git a/SOURCES/virt-v2v-1.45.3.tar.gz.sig b/SOURCES/virt-v2v-1.45.3.tar.gz.sig new file mode 100644 index 0000000..01d0de8 --- /dev/null +++ b/SOURCES/virt-v2v-1.45.3.tar.gz.sig @@ -0,0 +1,17 @@ +-----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/SPECS/virt-v2v.spec b/SPECS/virt-v2v.spec new file mode 100644 index 0000000..1a96b00 --- /dev/null +++ b/SPECS/virt-v2v.spec @@ -0,0 +1,421 @@ +# If we should verify tarball signature with GPGv2. +%global verify_tarball_signature 1 + +# If there are patches which touch autotools files, set this to 1. +%if !0%{?rhel} +%global patches_touch_autotools %{nil} +%else +# On RHEL the downstream patches always touch autotools files. +%global patches_touch_autotools 1 +%endif + +# The source directory. +%global source_directory 1.45-development + +Name: virt-v2v +Epoch: 1 +Version: 1.45.3 +Release: 3%{?dist} +Summary: Convert a virtual machine to run on KVM + +License: GPLv2+ +URL: https://github.com/libguestfs/virt-v2v + +Source0: http://download.libguestfs.org/virt-v2v/%{source_directory}/%{name}-%{version}.tar.gz +%if 0%{verify_tarball_signature} +Source1: http://download.libguestfs.org/virt-v2v/%{source_directory}/%{name}-%{version}.tar.gz.sig +# Keyring used to verify tarball signature. +Source2: libguestfs.keyring +%endif + +# Maintainer script which helps with handling patches. +Source3: copy-patches.sh + +%if !0%{?rhel} +# libguestfs hasn't been built on i686 for a while since there is no +# kernel built for this architecture any longer and libguestfs rather +# fundamentally depends on the kernel. Therefore we must exclude this +# arch. Note there is no bug filed for this because we do not ever +# expect that libguestfs or virt-v2v will be available on i686 so +# there is nothing that needs fixing. +ExcludeArch: %{ix86} +%else +# Architectures where virt-v2v is shipped on RHEL: +# +# not on aarch64 because it is not useful there +# not on %%{power64} because of RHBZ#1287826 +# not on s390x because it is not useful there +ExclusiveArch: x86_64 +%endif + +# 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 +%endif + +%if 0%{patches_touch_autotools} +BuildRequires: autoconf, automake, libtool +%endif + +BuildRequires: make +BuildRequires: /usr/bin/pod2man +BuildRequires: gcc +BuildRequires: ocaml >= 4.01 +BuildRequires: libguestfs-devel >= 1:1.42 + +BuildRequires: augeas-devel +BuildRequires: bash-completion +BuildRequires: file-devel +BuildRequires: gettext-devel +BuildRequires: jansson-devel +BuildRequires: libosinfo-devel +BuildRequires: libvirt-devel +BuildRequires: libvirt-daemon-kvm +BuildRequires: libxml2-devel +BuildRequires: pcre-devel +BuildRequires: perl(Sys::Guestfs) +BuildRequires: po4a +BuildRequires: /usr/bin/virsh +BuildRequires: xorriso + +BuildRequires: ocaml-findlib-devel +BuildRequires: ocaml-libguestfs-devel +BuildRequires: ocaml-fileutils-devel +BuildRequires: ocaml-gettext-devel +%if !0%{?rhel} +BuildRequires: ocaml-ounit-devel +%endif + +BuildRequires: nbdkit-python-plugin + +%if 0%{verify_tarball_signature} +BuildRequires: gnupg2 +%endif + +Requires: libguestfs%{?_isa} >= 1:1.42 +Requires: guestfs-tools >= 1.42 + +# XFS is the default filesystem in Fedora and RHEL. +Requires: libguestfs-xfs + +%if 0%{?rhel} +# For Windows conversions on RHEL. +Requires: libguestfs-winsupport >= 7.2 +%endif + +Requires: gawk +Requires: gzip +Requires: unzip +Requires: curl +Requires: /usr/bin/virsh + +# Ensure the UEFI firmware is available, to properly convert +# EFI guests (RHBZ#1429643). +%ifarch x86_64 +Requires: edk2-ovmf +%endif +%ifarch aarch64 +Requires: edk2-aarch64 +%endif + +# Needed for -it vddk, and -o rhv-upload. +Requires: nbdkit +Requires: nbdkit-curl-plugin +Requires: nbdkit-python-plugin +Requires: nbdkit-ssh-plugin +%ifarch x86_64 +Requires: nbdkit-vddk-plugin +%endif + +# For rhsrvany.exe, used to install firstboot scripts in Windows guests. +Requires: mingw32-srvany >= 1.0-13 + +# On RHEL, virtio-win should be used to install virtio drivers +# and qemu-ga in converted guests. (RHBZ#1972644) +%if 0%{?rhel} +Recommends: virtio-win +%endif + + +%description +Virt-v2v converts a single guest from a foreign hypervisor to run on +KVM. It can read Linux and Windows guests running on VMware, Xen, +Hyper-V and some other hypervisors, and convert them to KVM managed by +libvirt, OpenStack, oVirt, Red Hat Virtualisation (RHV) or several +other targets. It can modify the guest to make it bootable on KVM and +install virtio drivers so it will run quickly. + + +%package bash-completion +Summary: Bash tab-completion for %{name} +BuildArch: noarch +Requires: bash-completion >= 2.0 +Requires: %{name} = %{epoch}:%{version}-%{release} + + +%description bash-completion +Install this package if you want intelligent bash tab-completion +for %{name}. + + +%package man-pages-ja +Summary: Japanese (ja) man pages for %{name} +BuildArch: noarch +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description man-pages-ja +%{name}-man-pages-ja contains Japanese (ja) man pages +for %{name}. + + +%package man-pages-uk +Summary: Ukrainian (uk) man pages for %{name} +BuildArch: noarch +Requires: %{name} = %{epoch}:%{version}-%{release} + +%description man-pages-uk +%{name}-man-pages-uk contains Ukrainian (uk) man pages +for %{name}. + + +%prep +%if 0%{verify_tarball_signature} +%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%endif +%autosetup -p1 + +%if 0%{patches_touch_autotools} +autoreconf -i +%endif + + +%build +%configure \ +%if !0%{?rhel} + --with-extra="fedora=%{fedora},release=%{release}" \ +%else + --with-extra="rhel=%{rhel},release=%{release}" \ +%endif + +make V=1 %{?_smp_mflags} + + +%install +%make_install + +# Delete libtool crap. +find $RPM_BUILD_ROOT -name '*.la' -delete + +# Virt-tools data directory. This contains a symlink to rhsrvany.exe +# which is satisfied by the dependency on mingw32-srvany. +mkdir -p $RPM_BUILD_ROOT%{_datadir}/virt-tools +pushd $RPM_BUILD_ROOT%{_datadir}/virt-tools +ln -sf /usr/i686-w64-mingw32/sys-root/mingw/bin/rhsrvany.exe +popd + +# Find locale files. +%find_lang %{name} + + +%check +# All tests fail at the moment because of bugs in libvirt blockdev. +# # Tests fail on both armv7 and ppc64le in Fedora 31 because the kernel +# # cannot boot on qemu. +# %ifnarch %{arm} ppc64le + +# # On x86_64 this single test fails with: "virt-v2v: warning: the +# # target hypervisor does not support a x86_64 KVM guest". Missing +# # BuildRequires? +# %ifarch x86_64 +# truncate -s 0 tests/test-v2v-o-libvirt.sh +# %endif + +# # This test fails in mock. +# truncate -s 0 tests/test-v2v-oa-option.sh + +# # Make sure we can see the debug messages (RHBZ#1230160). +# export LIBGUESTFS_DEBUG=1 +# export LIBGUESTFS_TRACE=1 + +# make %{?_smp_mflags} check || { +# cat tests/test-suite.log +# exit 1 +# } + +# %endif + + +%files -f %{name}.lang +%license COPYING +%doc README +%{_bindir}/virt-v2v +%{_mandir}/man1/virt-v2v.1* +%{_mandir}/man1/virt-v2v-hacking.1* +%{_mandir}/man1/virt-v2v-input-vmware.1* +%{_mandir}/man1/virt-v2v-input-xen.1* +%{_mandir}/man1/virt-v2v-output-local.1* +%{_mandir}/man1/virt-v2v-output-openstack.1* +%{_mandir}/man1/virt-v2v-output-rhv.1* +%{_mandir}/man1/virt-v2v-release-notes-1.42.1* +%{_mandir}/man1/virt-v2v-support.1* +%{_datadir}/virt-tools + + +%files bash-completion +%license COPYING +%{_datadir}/bash-completion/completions/virt-v2v + + +%files man-pages-ja +%license COPYING +%lang(ja) %{_mandir}/ja/man1/*.1* + + +%files man-pages-uk +%license COPYING +%lang(uk) %{_mandir}/uk/man1/*.1* + + +%changelog +* Wed Aug 18 2021 Richard W.M. Jones - 1:1.45.3-3 +- Fix conversion of Windows BitLocker guests + resolves: rhbz#1994984 + +* Tue Aug 10 2021 Mohan Boddu - 1:1.45.3-2 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Fri Aug 06 2021 Richard W.M. Jones - 1:1.45.3-1 +- New upstream development version 1.45.3. +- Rebase RHEL patches. + resolves: rhbz#1950634 + +* Wed Jun 30 2021 Richard W.M. Jones - 1:1.45.2-1 +- New upstream development version 1.45.2. +- Remove --debug-overlays and --print-estimate options. +- Remove -o glance option on RHEL 9 (RHBZ#1977539). +- Remove support for RHEV-APT (RHBZ#1945549). + +* Wed Jun 16 2021 Richard W.M. Jones - 1:1.45.1-1.el9.1 +- New upstream development version 1.45.1. +- Require virtio-win on RHEL (RHBZ#1972644). +- v2v-test-harness, virt-v2v-copy-to-local have been removed upstream. + +* Thu Jun 10 2021 Richard W.M. Jones - 1:1.44.0-2 +- nbdkit-vddk-plugin dep only exists on x86-64. + +* Mon May 10 2021 Richard W.M. Jones - 1:1.44.0-1.el9.1 +- Rebuild in RHEL 9 against libguestfs 1.45.5 + resolves: rhbz#1959042 + +* Fri Apr 30 2021 Richard W.M. Jones - 1:1.44.0-1 +- New upstream stable branch version 1.44.0. + +* Wed Apr 14 2021 Richard W.M. Jones - 1:1.43.5-1 +- New upstream version 1.43.5. + +* Thu Apr 01 2021 Richard W.M. Jones - 1:1.43.4-5 +- Add upstream patch to depend on xorriso. +- Change libguestfs-tools-c -> guestfs-tools. + +* Tue Mar 30 2021 Richard W.M. Jones - 1:1.43.4-3 +- Add downstream (RHEL-only) patches (RHBZ#1931724). + +* Mon Mar 8 2021 Richard W.M. Jones - 1:1.43.4-2 +- Bump and rebuild for ocaml-gettext update. + +* Wed Mar 3 2021 Richard W.M. Jones - 1:1.43.4-1 +- New upstream version 1.43.4. + +* Tue Mar 2 2021 Richard W.M. Jones - 1:1.43.3-4 +- OCaml 4.12.0 build + +* Tue Mar 2 2021 Richard W.M. Jones - 1:1.43.3-3 +- Add fix for OCaml 4.12. + +* Wed Jan 27 2021 Fedora Release Engineering - 1:1.43.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jan 05 2021 Richard W.M. Jones - 1:1.43.3-1 +- New upstream version 1.43.3. + +* Thu Dec 03 2020 Richard W.M. Jones - 1:1.43.2-3 +- Drop obsolete virt-v2v-copy-to-local tool for Fedora 34 and RHEL 9. + +* Wed Dec 02 2020 Richard W.M. Jones - 1:1.43.2-2 +- Unify Fedora and RHEL spec files. + +* Tue Dec 01 2020 Richard W.M. Jones - 1:1.43.2-1 +- New upstream version 1.43.2. + +* Tue Sep 01 2020 Richard W.M. Jones - 1:1.43.1-5 +- OCaml 4.11.1 rebuild + +* Fri Aug 21 2020 Richard W.M. Jones - 1:1.43.1-4 +- OCaml 4.11.0 rebuild + +* Sat Aug 01 2020 Fedora Release Engineering - 1:1.43.1-3 +- Second attempt - Rebuilt for + https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Wed Jul 29 2020 Fedora Release Engineering - 1:1.43.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Mon Jul 06 2020 Richard W.M. Jones - 1.43.1-1 +- New development branch 1.43. + +* Wed May 06 2020 Richard W.M. Jones - 1.42.0-4 +- Re-add Epoch. Forgotten when we split this package from libguestfs. + +* Tue May 05 2020 Richard W.M. Jones - 1.42.0-2 +- OCaml 4.11.0+dev2-2020-04-22 rebuild + +* Thu Apr 16 2020 Richard W.M. Jones - 1.42.0-1 +- New upstream stable version 1.42.0. + +* Sat Apr 04 2020 Richard W.M. Jones - 1.41.8-11 +- Update all OCaml dependencies for RPM 4.16. + +* Thu Feb 27 2020 Richard W.M. Jones - 1.41.8-10 +- OCaml 4.10.0 final. + +* Fri Jan 31 2020 Fedora Release Engineering - 1.41.8-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Sun Jan 19 2020 Richard W.M. Jones - 1.41.8-8 +- Bump release and rebuild. + +* Sun Jan 19 2020 Richard W.M. Jones - 1.41.8-7 +- Bump release and rebuild. + +* Sun Jan 19 2020 Richard W.M. Jones - 1.41.8-6 +- Bump release and rebuild. + +* Sun Jan 19 2020 Richard W.M. Jones - 1.41.8-5 +- OCaml 4.10.0+beta1 rebuild. +- Use nbdkit-python-plugin (now all Python 3 in Rawhide). + +* Wed Nov 27 2019 Richard W.M. Jones - 1.41.8-4 +- Use license instead of doc for COPYING file. +- Include license in all subpackages. +- Use gpgverify macro. +- Don't own bash-completion directory because we Require the + bash-completion package which owns it already. + +* Tue Nov 26 2019 Richard W.M. Jones - 1.41.8-2 +- Fix permissions on .sig file. +- Disable -oa preallocated test since it fails in reviewers mock environment. + +* Fri Nov 15 2019 Richard W.M. Jones - 1.41.8-1 +- Initial release of separate virt-v2v program, was part of libguestfs.