Rebase to virt-v2v 2.9.8
resolves: RHEL-111241
This commit is contained in:
parent
4620873925
commit
e68c3e58ba
@ -1,4 +1,4 @@
|
||||
From e0ebc3ec50bd95d517f4e97a9196259fc2d9b7e9 Mon Sep 17 00:00:00 2001
|
||||
From 0e23a411191082061cc5aa0462c9a9ed512e54b2 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 30 Aug 2015 03:21:57 -0400
|
||||
Subject: [PATCH] RHEL: Fixes for libguestfs-winsupport.
|
||||
@ -19,7 +19,7 @@ https://bugzilla.redhat.com/show_bug.cgi?id=2187961#c1
|
||||
7 files changed, 40 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/convert/convert.ml b/convert/convert.ml
|
||||
index 1bdfdd69..b91cc136 100644
|
||||
index e3fd41b8..eb51e9b9 100644
|
||||
--- a/convert/convert.ml
|
||||
+++ b/convert/convert.ml
|
||||
@@ -55,6 +55,7 @@ let rec convert input_disks options source =
|
||||
@ -1,134 +0,0 @@
|
||||
From 06fa7bf0f9078d8035eab7ad4689a5018136e712 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Wed, 10 Sep 2025 14:39:18 +0100
|
||||
Subject: [PATCH] convert: Look for GRUB signature first to identify boot
|
||||
device
|
||||
|
||||
In commit ca6ec6317e ("convert: Detect target boot device for Linux
|
||||
guests") we tried to identify the boot order by looking for the device
|
||||
containing the /boot filesystem. However during our testing we found
|
||||
a guest where GRUB was installed on /dev/sda but the /boot partition
|
||||
was found on /dev/sdd. This guest would not boot with the boot order
|
||||
indicating that disk 4 (sdd) was the boot disk.
|
||||
|
||||
Change how we search for the boot device by first trying to find a
|
||||
GRUB signature in the boot sector of any disk. The first matching
|
||||
disk (if any) would then be picked as the boot device. If this fails
|
||||
then we fall back to looking at the device containing /boot as before.
|
||||
|
||||
This also updates the common module to get:
|
||||
|
||||
Richard W.M. Jones (1):
|
||||
mlstdutils: Export List.find_opt
|
||||
|
||||
Reported-by: Ming Xie
|
||||
Thanks: Gerd Hoffmann
|
||||
Fixes: commit ca6ec6317e20a633315f783a8ba4ece3c2fc01f2
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-108991
|
||||
See-also: https://thestarman.pcministry.com/asm/mbr/GRUB.htm
|
||||
---
|
||||
common | 2 +-
|
||||
convert/convert.ml | 77 +++++++++++++++++++++++++++++-----------------
|
||||
2 files changed, 49 insertions(+), 30 deletions(-)
|
||||
|
||||
Submodule common 7ecf3992..5be8d552:
|
||||
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
|
||||
index a20e720c..6c1911da 100644
|
||||
--- a/common/mlstdutils/std_utils.mli
|
||||
+++ b/common/mlstdutils/std_utils.mli
|
||||
@@ -46,6 +46,7 @@ module List : sig
|
||||
val mem : 'a -> 'a list -> bool
|
||||
val memq : 'a -> 'a list -> bool
|
||||
val find : ('a -> bool) -> 'a list -> 'a
|
||||
+ val find_opt : ('a -> bool) -> 'a list -> 'a option
|
||||
val filter : ('a -> bool) -> 'a list -> 'a list
|
||||
val find_all : ('a -> bool) -> 'a list -> 'a list
|
||||
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
|
||||
diff --git a/convert/convert.ml b/convert/convert.ml
|
||||
index 304bbb52..1bdfdd69 100644
|
||||
--- a/convert/convert.ml
|
||||
+++ b/convert/convert.ml
|
||||
@@ -395,35 +395,54 @@ and get_target_firmware i_firmware guestcaps source output =
|
||||
target_firmware
|
||||
|
||||
and get_target_boot_device g inspect =
|
||||
- (* We only do it for Linux, as most likely Windows never(?) boots
|
||||
- * from any drive other than C:. We can revisit this decision
|
||||
- * if someone reports a bug.
|
||||
- *)
|
||||
- match inspect.i_type with
|
||||
- | "linux" ->
|
||||
- (try
|
||||
- (* In sane cases, the Grub stage1/boot.img (ie. the boot sector) is
|
||||
- * always on the same drive as /boot. So we can just find out
|
||||
- * where /boot is mounted and use that.
|
||||
- *)
|
||||
- let boot_mountpoint = List.assoc "/boot" inspect.i_mountpoints in
|
||||
- let boot_device = g#part_to_dev boot_mountpoint in
|
||||
- let boot_device = g#device_index boot_device in
|
||||
- Some boot_device
|
||||
- with
|
||||
- | Not_found -> None
|
||||
- | G.Error msg
|
||||
- (* Returned by part_to_dev if the /boot mountpoint is not
|
||||
- * a partition name.
|
||||
- *)
|
||||
- when String.find msg "device name is not a partition" >= 0 -> None
|
||||
- | G.Error msg
|
||||
- (* Returned by device_index if the /boot device is not
|
||||
- * a normal drive name (eg. /dev/mdX).
|
||||
- *)
|
||||
- when String.find msg "device not found" >= 0 -> None
|
||||
- )
|
||||
- | _ -> None
|
||||
+ with_return (fun {return} ->
|
||||
+ (* We only do it for Linux, as most likely Windows never(?) boots
|
||||
+ * from any drive other than C:. We can revisit this decision
|
||||
+ * if someone reports a bug.
|
||||
+ *)
|
||||
+ if inspect.i_type <> "linux" then return None;
|
||||
+
|
||||
+ (* Look for "GRUB" signature in the boot sector of each disk.
|
||||
+ * If we find it, choose that disk.
|
||||
+ *)
|
||||
+ let devices = g#list_devices () |> Array.to_list in
|
||||
+ let boot_device = List.find_opt (has_grub_signature g) devices in
|
||||
+ let boot_device = Option.map g#device_index boot_device in
|
||||
+ if boot_device <> None then return boot_device;
|
||||
+
|
||||
+ (* If that fails, in sane cases, the Grub stage1/boot.img (ie. the boot
|
||||
+ * sector) is always on the same drive as /boot. So we can just find
|
||||
+ * out where /boot is mounted and use that.
|
||||
+ *)
|
||||
+ get_device_of_boot_filesystem g inspect
|
||||
+ )
|
||||
+
|
||||
+and has_grub_signature g dev =
|
||||
+ let boot_sector = g#pread_device dev 512 0_L in
|
||||
+ let r = String.find boot_sector "GRUB" >= 0 in
|
||||
+ debug "has_grub_signature: \"GRUB\" signature on %s? %b" dev r;
|
||||
+ r
|
||||
+
|
||||
+and get_device_of_boot_filesystem g inspect =
|
||||
+ try
|
||||
+ let boot_mountpoint = List.assoc "/boot" inspect.i_mountpoints in
|
||||
+ let boot_device = g#part_to_dev boot_mountpoint in
|
||||
+ debug "get_device_of_boot_filesystem: found /boot filesystem on device %s"
|
||||
+ boot_device;
|
||||
+ let boot_device = g#device_index boot_device in
|
||||
+ Some boot_device
|
||||
+ with
|
||||
+ | Not_found -> None
|
||||
+ (* Returned by part_to_dev if the /boot mountpoint is not
|
||||
+ * a partition name.
|
||||
+ *)
|
||||
+ | G.Error msg
|
||||
+ when String.find msg "device name is not a partition" >= 0 -> None
|
||||
+ (* Returned by device_index if the /boot device is not
|
||||
+ * a normal drive name (eg. /dev/mdX).
|
||||
+ *)
|
||||
+ | G.Error msg
|
||||
+ when String.find msg "device not found" >= 0 -> None
|
||||
|
||||
(* After conversion we dump as much information about the guest
|
||||
* as we can in one place. Note this is only called when verbose
|
||||
@ -1,4 +1,4 @@
|
||||
From 8252595a0b8c6cc3d49343c724620835aab577ea Mon Sep 17 00:00:00 2001
|
||||
From 1d7dc77268f6bc57e5c7d065b7530e7e4cc94955 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Sun, 28 Sep 2014 19:14:43 +0100
|
||||
Subject: [PATCH] RHEL: v2v: Select correct qemu binary for -o qemu mode
|
||||
@ -1,178 +0,0 @@
|
||||
From cd027b7c9a176dc9591c521ce6a935d4225aa866 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Wed, 10 Sep 2025 16:52:41 +0100
|
||||
Subject: [PATCH] vddk: Make the thumbprint optional
|
||||
|
||||
If -io vddk-thumbprint=XX:XX:... is not specified, fetch it from the
|
||||
server. Doing this mildly reduces security (but you're already using
|
||||
?no_verify=1), but greatly increases convenience.
|
||||
---
|
||||
docs/virt-v2v-input-vmware.pod | 29 +++++++++++-----------
|
||||
docs/virt-v2v.pod | 3 +--
|
||||
input/input_vddk.ml | 44 +++++++++++++++++++++-------------
|
||||
3 files changed, 44 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/docs/virt-v2v-input-vmware.pod b/docs/virt-v2v-input-vmware.pod
|
||||
index 164eef49..9ce5bd1e 100644
|
||||
--- a/docs/virt-v2v-input-vmware.pod
|
||||
+++ b/docs/virt-v2v-input-vmware.pod
|
||||
@@ -16,7 +16,6 @@ virt-v2v-input-vmware - Using virt-v2v to convert guests from VMware
|
||||
-ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1'
|
||||
-it vddk
|
||||
-io vddk-libdir=/path/to/vmware-vix-disklib-distrib
|
||||
- -io vddk-thumbprint=xx:xx:xx:...
|
||||
"GUEST NAME"
|
||||
[-o* options]
|
||||
|
||||
@@ -227,15 +226,9 @@ enabled unconditionally.
|
||||
|
||||
=item 3.
|
||||
|
||||
-You must find the SSL "thumbprint" of your VMware server. How to do
|
||||
-this is explained in L<nbdkit-vddk-plugin(1)>, also available at the
|
||||
-link above.
|
||||
-
|
||||
-=item 4.
|
||||
-
|
||||
VDDK imports require a feature added in libvirt E<ge> 3.7.
|
||||
|
||||
-=item 5.
|
||||
+=item 4.
|
||||
|
||||
The VMware server must not be in maintenance mode.
|
||||
|
||||
@@ -329,23 +322,31 @@ continuing.
|
||||
The I<-it vddk> parameter selects VDDK as the input transport for disks.
|
||||
|
||||
To import a particular guest from vCenter server or ESXi hypervisor,
|
||||
-use a command like the following, substituting the URI, guest name and
|
||||
-SSL thumbprint:
|
||||
+use a command like the following, substituting the URI and guest name:
|
||||
|
||||
$ virt-v2v \
|
||||
-ic 'vpx://root@vcenter.example.com/Datacenter/esxi?no_verify=1' \
|
||||
-it vddk \
|
||||
-io vddk-libdir=/path/to/vmware-vix-disklib-distrib \
|
||||
- -io vddk-thumbprint=xx:xx:xx:... \
|
||||
"Windows 2003" \
|
||||
-o local -os /var/tmp
|
||||
|
||||
Other options that you might need to add in rare circumstances include
|
||||
I<-io vddk-compression>, I<-io vddk-config>, I<-io vddk-cookie>, I<-io
|
||||
vddk-file>, I<-io vddk-nfchostport>, I<-io vddk-port>, I<-io
|
||||
-vddk-snapshot>, and I<-io vddk-transports>, which are all explained in
|
||||
-the L<nbdkit-vddk-plugin(1)> documentation. Do not use these options
|
||||
-unless you know what you are doing.
|
||||
+vddk-snapshot>, I<-io vddk-thumbprint> and I<-io vddk-transports>,
|
||||
+which are all explained in the L<nbdkit-vddk-plugin(1)> documentation.
|
||||
+Do not use these options unless you know what you are doing.
|
||||
+
|
||||
+=head2 VDDK: Thumbprint
|
||||
+
|
||||
+You may specify the thumbprint of the VMware server using the I<-io
|
||||
+vddk-thumbprint=XX:XX...> parameter. Doing so increases security
|
||||
+against some man-in-the-middle attacks.
|
||||
+
|
||||
+Since virt-v2v 2.10, this parameter is not required. Virt-v2v will
|
||||
+get the thumbprint from the server if it is not specified (but the
|
||||
+L<openssl(1)> command must be installed for this to work).
|
||||
|
||||
=head2 VDDK: Debugging VDDK failures
|
||||
|
||||
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
|
||||
index fbb5bbd6..328a7c44 100644
|
||||
--- a/docs/virt-v2v.pod
|
||||
+++ b/docs/virt-v2v.pod
|
||||
@@ -354,8 +354,7 @@ In most cases this parameter is required when using the I<-it vddk>
|
||||
|
||||
Set the thumbprint of the remote VMware server.
|
||||
|
||||
-This parameter is required when using the I<-it vddk> (VDDK) transport.
|
||||
-See L<virt-v2v-input-vmware(1)> for details.
|
||||
+See L<virt-v2v-input-vmware(1)/VDDK: Thumbprint> for details.
|
||||
|
||||
=item B<-io vddk-compression=>COMPRESSION
|
||||
|
||||
diff --git a/input/input_vddk.ml b/input/input_vddk.ml
|
||||
index 6029e6bf..9f9436dd 100644
|
||||
--- a/input/input_vddk.ml
|
||||
+++ b/input/input_vddk.ml
|
||||
@@ -46,12 +46,8 @@ module VDDK = struct
|
||||
String.concat " " xs
|
||||
|
||||
let query_input_options () =
|
||||
- printf (f_"Input options (-io) which can be used with -it vddk:
|
||||
-
|
||||
- -io vddk-thumbprint=xx:xx:xx:...
|
||||
- VDDK server thumbprint (required)
|
||||
-
|
||||
-All other settings are optional:
|
||||
+ printf (f_"Input options (-io) which can be used with -it vddk
|
||||
+(all settings are optional):
|
||||
|
||||
-io vddk-compression=COMPR Set VDDK compression mode (see
|
||||
nbdkit-vddk-plugin documentation)
|
||||
@@ -63,6 +59,8 @@ All other settings are optional:
|
||||
-io vddk-port=PORT VDDK port
|
||||
-io vddk-snapshot=SNAPSHOT-MOREF
|
||||
VDDK snapshot moref
|
||||
+ -io vddk-thumbprint=xx:xx:xx:...
|
||||
+ VDDK server thumbprint
|
||||
-io vddk-transports=MODE:MODE:..
|
||||
VDDK transports
|
||||
|
||||
@@ -98,13 +96,6 @@ information on these settings.
|
||||
(key, value)
|
||||
) options.input_options in
|
||||
|
||||
- (* thumbprint is mandatory. *)
|
||||
- if not (List.mem_assoc "thumbprint" io_options) then
|
||||
- error (f_"You must pass the ‘-io vddk-thumbprint’ option with the \
|
||||
- SSL thumbprint of the VMware server. To find the thumbprint, \
|
||||
- see the nbdkit-vddk-plugin(1) manual. See also the \
|
||||
- virt-v2v-input-vmware(1) manual.");
|
||||
-
|
||||
(* Get the guest name. *)
|
||||
let guest =
|
||||
match args with
|
||||
@@ -201,6 +192,30 @@ information on these settings.
|
||||
| Some password_file ->
|
||||
password_file in
|
||||
|
||||
+ (* Thumbprint has to be passed to nbdkit. If we don't have it
|
||||
+ * then get it from the server.
|
||||
+ *)
|
||||
+ let thumbprint =
|
||||
+ try List.assoc "thumbprint" io_options
|
||||
+ with Not_found ->
|
||||
+ let openssl =
|
||||
+ try which "openssl"
|
||||
+ with Executable_not_found _ ->
|
||||
+ error (f_"‘openssl’ command not found: automatically detecting \
|
||||
+ thumbprint is not possible, so you must use \
|
||||
+ ‘-io vddk-thumbprint=XX:XX...’") in
|
||||
+ let cmd = sprintf {|
|
||||
+%s s_client -connect %s:443 </dev/null 2>/dev/null |
|
||||
+%s x509 -in /dev/stdin -fingerprint -sha1 -noout 2>/dev/null |
|
||||
+grep -i '^sha1 Fingerprint=' |
|
||||
+sed 's/.*Fingerprint=\([A-F0-9:]\+\)/\1/' |}
|
||||
+ openssl (quote server) openssl in
|
||||
+ let lines = external_command cmd in
|
||||
+ if List.length lines = 0 then
|
||||
+ error (f_"could not fetch thumbprint from the server, you mus use \
|
||||
+ ‘-io vddk-thumbprint=XX:XX...’");
|
||||
+ List.hd lines in
|
||||
+
|
||||
let compression =
|
||||
try Some (List.assoc "compression" io_options) with Not_found -> None in
|
||||
let config =
|
||||
@@ -215,9 +230,6 @@ information on these settings.
|
||||
try Some (List.assoc "port" io_options) with Not_found -> None in
|
||||
let snapshot =
|
||||
try Some (List.assoc "snapshot" io_options) with Not_found -> None in
|
||||
- let thumbprint =
|
||||
- try List.assoc "thumbprint" io_options
|
||||
- with Not_found -> assert false (* checked above *) in
|
||||
let transports =
|
||||
try Some (List.assoc "transports" io_options) with Not_found -> None in
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
From 17d92538e3dd2c1788163a6707d8f923f4a3f284 Mon Sep 17 00:00:00 2001
|
||||
From 765bb62948564481b5c4c71333d088c12f010f1c Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 30 Sep 2014 10:50:27 +0100
|
||||
Subject: [PATCH] RHEL: v2v: Disable the --qemu-boot / -oo qemu-boot option
|
||||
@ -43,7 +43,7 @@ index 49f00754..bdf12c5d 100644
|
||||
=item B<-o null>
|
||||
|
||||
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
|
||||
index 328a7c44..b46a0d43 100644
|
||||
index d530d54b..a4f2538c 100644
|
||||
--- a/docs/virt-v2v.pod
|
||||
+++ b/docs/virt-v2v.pod
|
||||
@@ -167,11 +167,6 @@ Since F<guest-domain.xml> contains the path(s) to the guest disk
|
||||
@ -1,73 +0,0 @@
|
||||
From 1f6d4e079dd5fdc9ed4c84ada57835b733bbbe78 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 18 Sep 2025 12:21:58 +0100
|
||||
Subject: [PATCH] convert: linux: Move uninstall_packages function below
|
||||
do_convert
|
||||
|
||||
The structure of conversion is the do_convert () function, followed by
|
||||
the subfunctions that are used for conversion. Move
|
||||
uninstall_packages below do_convert so it's like all the other
|
||||
functions.
|
||||
|
||||
This is just code motion, there is no functional change.
|
||||
|
||||
Updates: commit b3268a13beca4da218e7ffe4648a18420296103a
|
||||
---
|
||||
convert/convert_linux.ml | 37 ++++++++++++++++++-------------------
|
||||
1 file changed, 18 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
|
||||
index 872fa663..f339361a 100644
|
||||
--- a/convert/convert_linux.ml
|
||||
+++ b/convert/convert_linux.ml
|
||||
@@ -131,25 +131,6 @@ let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ =
|
||||
(*----------------------------------------------------------------------*)
|
||||
(* Conversion step. *)
|
||||
|
||||
- let uninstall_packages pkgs =
|
||||
- if pkgs <> [] then (
|
||||
- let cmd =
|
||||
- try Guest_packages.uninstall_command pkgs inspect.i_package_management
|
||||
- with
|
||||
- | Guest_packages.Unknown_package_manager msg
|
||||
- | Guest_packages.Unimplemented_package_manager msg ->
|
||||
- error "%s" msg
|
||||
- in
|
||||
- (try ignore (g#sh cmd)
|
||||
- with G.Error msg ->
|
||||
- warning (f_"could not uninstall packages ‘%s’: %s (ignored)")
|
||||
- (String.concat " " pkgs) msg
|
||||
- );
|
||||
- (* Reload Augeas in case anything changed. *)
|
||||
- Linux.augeas_reload g
|
||||
- )
|
||||
- in
|
||||
-
|
||||
let rec do_convert () =
|
||||
augeas_grub_configuration ();
|
||||
|
||||
@@ -1378,6 +1359,24 @@ fi
|
||||
"/etc/blkid/blkid.tab"; "/etc/blkid.tab";
|
||||
"/etc/lvm/cache/.cache"; "/etc/lvm/devices/system.devices"
|
||||
];
|
||||
+
|
||||
+ and uninstall_packages pkgs =
|
||||
+ if pkgs <> [] then (
|
||||
+ let cmd =
|
||||
+ try Guest_packages.uninstall_command pkgs inspect.i_package_management
|
||||
+ with
|
||||
+ | Guest_packages.Unknown_package_manager msg
|
||||
+ | Guest_packages.Unimplemented_package_manager msg ->
|
||||
+ error "%s" msg
|
||||
+ in
|
||||
+ (try ignore (g#sh cmd)
|
||||
+ with G.Error msg ->
|
||||
+ warning (f_"could not uninstall packages ‘%s’: %s (ignored)")
|
||||
+ (String.concat " " pkgs) msg
|
||||
+ );
|
||||
+ (* Reload Augeas in case anything changed. *)
|
||||
+ Linux.augeas_reload g
|
||||
+ )
|
||||
in
|
||||
|
||||
do_convert ()
|
||||
@ -1,4 +1,4 @@
|
||||
From cdcb70c77b22a2dcb5ffae5ad43d561101be8376 Mon Sep 17 00:00:00 2001
|
||||
From d1d137a4783267e9bce9fc348dce103c2aa371f7 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Fri, 24 Apr 2015 09:45:41 -0400
|
||||
Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu
|
||||
@ -9,10 +9,10 @@ Subject: [PATCH] RHEL: Fix list of supported sound cards to match RHEL qemu
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/utils.ml b/lib/utils.ml
|
||||
index f3f7a205..7b0d2327 100644
|
||||
index 9da6737c..042b03e8 100644
|
||||
--- a/lib/utils.ml
|
||||
+++ b/lib/utils.ml
|
||||
@@ -81,13 +81,14 @@ let kvm_arch = function
|
||||
@@ -83,13 +83,14 @@ let kvm_arch = function
|
||||
(* Does qemu support the given sound card? *)
|
||||
let qemu_supports_sound_card = function
|
||||
| Types.AC97
|
||||
@ -1,59 +0,0 @@
|
||||
From 46af0d612adeb43af416b8a4cc7d4b39c58355bf Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 18 Sep 2025 12:27:22 +0100
|
||||
Subject: [PATCH] convert: Rename uninstall_packages to indicate it is
|
||||
best-effort
|
||||
|
||||
Rename uninstall_packages -> uninstall_packages_nonfatal to indicate
|
||||
that this is a best effort operation. I also added a comment about
|
||||
what this function does.
|
||||
---
|
||||
convert/convert_linux.ml | 14 ++++++++++----
|
||||
1 file changed, 10 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
|
||||
index f339361a..6e08b857 100644
|
||||
--- a/convert/convert_linux.ml
|
||||
+++ b/convert/convert_linux.ml
|
||||
@@ -258,7 +258,7 @@ let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ =
|
||||
fun { G.app2_name = name } -> name = package_name
|
||||
) inspect.i_apps in
|
||||
if has_guest_additions then
|
||||
- uninstall_packages [package_name];
|
||||
+ uninstall_packages_nonfatal [package_name];
|
||||
|
||||
(* Guest Additions might have been installed from a tarball. The
|
||||
* above code won't detect this case. Look for the uninstall tool
|
||||
@@ -403,7 +403,7 @@ let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ =
|
||||
)
|
||||
);
|
||||
|
||||
- uninstall_packages !remove;
|
||||
+ uninstall_packages_nonfatal !remove;
|
||||
|
||||
(* VMware Tools may have been installed from a tarball, so the
|
||||
* above code won't remove it. Look for the uninstall tool and run
|
||||
@@ -451,7 +451,7 @@ let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ =
|
||||
let pkgs = List.map (fun { G.app2_name = name } -> name) pkgs in
|
||||
|
||||
if pkgs <> [] then (
|
||||
- uninstall_packages pkgs;
|
||||
+ uninstall_packages_nonfatal pkgs;
|
||||
|
||||
(* Installing these guest utilities automatically unconfigures
|
||||
* ttys in /etc/inittab if the system uses it. We need to put
|
||||
@@ -1360,7 +1360,13 @@ fi
|
||||
"/etc/lvm/cache/.cache"; "/etc/lvm/devices/system.devices"
|
||||
];
|
||||
|
||||
- and uninstall_packages pkgs =
|
||||
+ (* This is a wrapper around Guestfs_packages.uninstall_command
|
||||
+ * which catches errors and turns them into warnings, since
|
||||
+ * uninstalling packages is best effort in virt-v2v. It also
|
||||
+ * reloads the Augeas configuration since removing packages might
|
||||
+ * change /etc files.
|
||||
+ *)
|
||||
+ and uninstall_packages_nonfatal pkgs =
|
||||
if pkgs <> [] then (
|
||||
let cmd =
|
||||
try Guest_packages.uninstall_command pkgs inspect.i_package_management
|
||||
@ -1,4 +1,4 @@
|
||||
From c00816e9a4f16b074c62f74f513cfc25d64cee17 Mon Sep 17 00:00:00 2001
|
||||
From de3af4005116b23af926c3457c83e514cc6ea45b Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 2 Mar 2017 14:21:37 +0100
|
||||
Subject: [PATCH] RHEL: v2v: -i disk: force VNC as display (RHBZ#1372671)
|
||||
@ -9,10 +9,10 @@ The SDL output mode is not supported in RHEL's qemu-kvm.
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/input/input_disk.ml b/input/input_disk.ml
|
||||
index 2997efa2..00c11f80 100644
|
||||
index 8a71a3d9..1022ca2c 100644
|
||||
--- a/input/input_disk.ml
|
||||
+++ b/input/input_disk.ml
|
||||
@@ -78,7 +78,7 @@ module Disk = struct
|
||||
@@ -77,7 +77,7 @@ module Disk = struct
|
||||
s_firmware = UnknownFirmware; (* causes virt-v2v to autodetect *)
|
||||
s_uefi_secureboot = false;
|
||||
s_display =
|
||||
@ -1,68 +0,0 @@
|
||||
From d240eeb93950990bbb95b9d9654ba8bda43c3a04 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 18 Sep 2025 10:37:54 +0100
|
||||
Subject: [PATCH] convert: linux: Ignore /etc/lvm/archive/*.vg files
|
||||
|
||||
RHEL 7.2 had a bug where old volume group archive files did not get
|
||||
cleaned up. This was fixed later, but when converting some long-lived
|
||||
RHEL 7.2 guests where many thousands of these files might have
|
||||
accumulated, Augeas would try to read them all into memory, and this
|
||||
would fail in the restricted environment of the libguestfs appliance.
|
||||
|
||||
Since we don't care at all about these files, fix this by ignoring
|
||||
these files.
|
||||
|
||||
I added a generic mechanism here to allow us to extend this list on a
|
||||
case-by-case basis in future.
|
||||
|
||||
There are other places in virt-v2v where 'aug_init' will be called in
|
||||
a way that will load everything (eg. setting hostname and password),
|
||||
but we can fix those later if they happen to customers.
|
||||
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-113820
|
||||
Thanks: Sean Haselden
|
||||
Thanks: Alasdair Kergon
|
||||
---
|
||||
convert/convert_linux.ml | 28 ++++++++++++++++++++++++----
|
||||
1 file changed, 24 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
|
||||
index 6e08b857..45ff8036 100644
|
||||
--- a/convert/convert_linux.ml
|
||||
+++ b/convert/convert_linux.ml
|
||||
@@ -110,11 +110,31 @@ let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ =
|
||||
required in libguestfs.");
|
||||
|
||||
(* We use Augeas for inspection and conversion, so initialize it early.
|
||||
- * Calling debug_augeas_errors will display any //error nodes in
|
||||
- * debugging output if verbose (but otherwise it does nothing).
|
||||
*)
|
||||
- g#aug_init "/" 1;
|
||||
- debug_augeas_errors g;
|
||||
+ let () =
|
||||
+ let aug_save_backup = 1
|
||||
+ and aug_no_load = 32 in
|
||||
+ g#aug_init "/" (aug_save_backup + aug_no_load);
|
||||
+
|
||||
+ (* Exclude some lense includes which are problematic on a case-by-case
|
||||
+ * basis. Note the double quotes are part of the incl, and the incl
|
||||
+ * must exactly match the definition in the Augeas lens file.
|
||||
+ * - "/etc/lvm/archive/*.vg" because of RHEL-113820
|
||||
+ *)
|
||||
+ let removed_incls = [ {|"/etc/lvm/archive/*.vg"|} ] in
|
||||
+ List.iter (
|
||||
+ fun incl ->
|
||||
+ let augpath = sprintf "/augeas/load//incl[%s]" incl in
|
||||
+ let n = g#aug_rm augpath in
|
||||
+ debug "convert_linux: removed %d incl(s) matching %s" n incl;
|
||||
+ ) removed_incls;
|
||||
+
|
||||
+ g#aug_load ();
|
||||
+
|
||||
+ (* Calling debug_augeas_errors will display any //error nodes in
|
||||
+ * debugging output if verbose (but otherwise it does nothing).
|
||||
+ *)
|
||||
+ debug_augeas_errors g in
|
||||
|
||||
(* Clean RPM database. This must be done early to avoid RHBZ#1143866. *)
|
||||
Array.iter g#rm_f (g#glob_expand "/var/lib/rpm/__db.00?");
|
||||
@ -1,4 +1,4 @@
|
||||
From aef356963fdac8330de73c0d181ec2fa61c108ca Mon Sep 17 00:00:00 2001
|
||||
From 8a2c581d7b3fd7cdc7bafa2fff37677b8b162fd4 Mon Sep 17 00:00:00 2001
|
||||
From: Pino Toscano <ptoscano@redhat.com>
|
||||
Date: Tue, 26 Mar 2019 09:42:25 +0100
|
||||
Subject: [PATCH] RHEL: point to KB for supported v2v hypervisors/guests
|
||||
@ -1,4 +1,4 @@
|
||||
From 141d4f6e743c66bef61d8378c1ef1bdc4f25df83 Mon Sep 17 00:00:00 2001
|
||||
From 29a3ec7001f1fe348a13d1d983613cd6378bf76b Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 5 Jul 2022 11:58:09 +0100
|
||||
Subject: [PATCH] RHEL: tests: Remove btrfs test
|
||||
@ -1,29 +1,14 @@
|
||||
From 071ccf109b15d6af641e308645e99c74ecc20ad1 Mon Sep 17 00:00:00 2001
|
||||
From ae014771054670e263df84198db29a2246e2e81f Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 9 Jul 2024 11:30:09 +0100
|
||||
Subject: [PATCH] RHEL: Add warning about virt-v2v-in-place not being supported
|
||||
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-40903
|
||||
---
|
||||
docs/virt-v2v-in-place.pod | 4 ++++
|
||||
in-place/in_place.ml | 3 +++
|
||||
in-place/in_place.ml | 3 +++
|
||||
in-place/virt-v2v-in-place.pod | 4 ++++
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
diff --git a/docs/virt-v2v-in-place.pod b/docs/virt-v2v-in-place.pod
|
||||
index 69d2092e..7c0a4d90 100644
|
||||
--- a/docs/virt-v2v-in-place.pod
|
||||
+++ b/docs/virt-v2v-in-place.pod
|
||||
@@ -16,6 +16,10 @@ virt-v2v-in-place - Convert a guest to use KVM in-place
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
+B<virt-v2v-in-place is NOT SUPPORTED for command line use in Red Hat
|
||||
+Enterprise Linux>. It is almost always better to use L<virt-v2v(1)>
|
||||
+instead of this tool.
|
||||
+
|
||||
Virt-v2v-in-place converts a single guest from a foreign hypervisor to
|
||||
run on KVM. It does this conversion in place, modifying the original
|
||||
disk.
|
||||
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
|
||||
index 7e490867..6c2790af 100644
|
||||
--- a/in-place/in_place.ml
|
||||
@ -38,3 +23,18 @@ index 7e490867..6c2790af 100644
|
||||
(* Print the version, easier than asking users to tell us. *)
|
||||
debug "info: %s: %s %s (%s)"
|
||||
prog Config.package_name Config.package_version_full
|
||||
diff --git a/in-place/virt-v2v-in-place.pod b/in-place/virt-v2v-in-place.pod
|
||||
index 69d2092e..7c0a4d90 100644
|
||||
--- a/in-place/virt-v2v-in-place.pod
|
||||
+++ b/in-place/virt-v2v-in-place.pod
|
||||
@@ -16,6 +16,10 @@ virt-v2v-in-place - Convert a guest to use KVM in-place
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
+B<virt-v2v-in-place is NOT SUPPORTED for command line use in Red Hat
|
||||
+Enterprise Linux>. It is almost always better to use L<virt-v2v(1)>
|
||||
+instead of this tool.
|
||||
+
|
||||
Virt-v2v-in-place converts a single guest from a foreign hypervisor to
|
||||
run on KVM. It does this conversion in place, modifying the original
|
||||
disk.
|
||||
@ -1,51 +0,0 @@
|
||||
From 7b6f110e7b3e21bc3519a1cb7eba7180ae1a0f88 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Thu, 18 Sep 2025 14:33:25 +0100
|
||||
Subject: [PATCH] Update common submodule
|
||||
|
||||
NOTE: This is a temporary RHEL 10.2 patch.
|
||||
|
||||
Pull in the following commits from the common submodule:
|
||||
|
||||
Richard W.M. Jones (2):
|
||||
daemon, generator: Use power of 2 for initial size of Hashtbl.create
|
||||
mlcustomize/inject_virtio_win.ml: Use viostor.inf instead of guestor
|
||||
|
||||
Fixes: https://issues.redhat.com/browse/RHEL-112517
|
||||
---
|
||||
common | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
Submodule common 5be8d552..ebcd4d5e:
|
||||
diff --git a/common/mlcustomize/customize_run.ml b/common/mlcustomize/customize_run.ml
|
||||
index ff719f4e..64afd3ab 100644
|
||||
--- a/common/mlcustomize/customize_run.ml
|
||||
+++ b/common/mlcustomize/customize_run.ml
|
||||
@@ -97,7 +97,7 @@ let run (g : G.guestfs) root (ops : ops) =
|
||||
) in
|
||||
|
||||
(* Store the passwords and set them all at the end. *)
|
||||
- let passwords = Hashtbl.create 13 in
|
||||
+ let passwords = Hashtbl.create 16 in
|
||||
let set_password user pw =
|
||||
if Hashtbl.mem passwords user then
|
||||
error (f_"multiple --root-password/--password options set the \
|
||||
diff --git a/common/mlcustomize/inject_virtio_win.ml b/common/mlcustomize/inject_virtio_win.ml
|
||||
index b26b14d3..114df064 100644
|
||||
--- a/common/mlcustomize/inject_virtio_win.ml
|
||||
+++ b/common/mlcustomize/inject_virtio_win.ml
|
||||
@@ -310,8 +310,13 @@ and ddb_regedits inspect drv_name drv_pciid =
|
||||
* one must add keys into the DriverDatabase.
|
||||
*)
|
||||
|
||||
+ let winarch =
|
||||
+ match inspect.i_arch with
|
||||
+ | "i386" -> "x86" | "x86_64" -> "amd64"
|
||||
+ | _ -> assert false in
|
||||
+
|
||||
let drv_inf = "guestor.inf" in
|
||||
- let drv_inf_label = drv_inf ^ "_tmp" in
|
||||
+ let drv_inf_label = sprintf "%s_%s_0000000000000000" drv_inf winarch in
|
||||
let drv_config = "guestor_conf" in
|
||||
|
||||
[
|
||||
4
sources
4
sources
@ -1,2 +1,2 @@
|
||||
SHA512 (virt-v2v-2.9.6.tar.gz) = 983c784d5190c0590f83357dea1ccb2c1f9a528a26f39122b24ef35dd0209151e89acb749f11cb0d7201d33ada31330f858becc049d11790229cadcaa306bcc4
|
||||
SHA512 (virt-v2v-2.9.6.tar.gz.sig) = 28199a3d7d38148b16033831c5b26f3e5013d47d769dbd7e5571deb64e4bf094e31c8df62f5c55a0bae621b19a5011b209917d671e7c34531e6b95d304d88aaf
|
||||
SHA512 (virt-v2v-2.9.8.tar.gz) = b8f07f8fe451375aa6500861566c6d80dbcc38226ce8319444838087c433759274577303355b9445bfc09e9dcd51b809c599232f0f7ddb49fb33fbf8210f1031
|
||||
SHA512 (virt-v2v-2.9.8.tar.gz.sig) = 974568808749d78ad9120f262722feffec1aabec7817473fc63565750dfdf9d9eda96ef3cc6ab8de2f1490fba7a2e296b0e6ef908abff0384df24ec4f4bada15
|
||||
|
||||
@ -44,8 +44,8 @@ ExclusiveArch: x86_64
|
||||
|
||||
Name: virt-v2v
|
||||
Epoch: 1
|
||||
Version: 2.9.6
|
||||
Release: 3%{?dist}
|
||||
Version: 2.9.8
|
||||
Release: 1%{?dist}
|
||||
Summary: Convert a virtual machine to run on KVM
|
||||
|
||||
License: GPL-2.0-or-later AND LGPL-2.0-or-later
|
||||
@ -65,20 +65,14 @@ Source3: copy-patches.sh
|
||||
# https://github.com/libguestfs/virt-v2v/commits/rhel-10.2
|
||||
|
||||
# Patches.
|
||||
Patch0001: 0001-convert-Look-for-GRUB-signature-first-to-identify-bo.patch
|
||||
Patch0002: 0002-vddk-Make-the-thumbprint-optional.patch
|
||||
Patch0003: 0003-convert-linux-Move-uninstall_packages-function-below.patch
|
||||
Patch0004: 0004-convert-Rename-uninstall_packages-to-indicate-it-is-.patch
|
||||
Patch0005: 0005-convert-linux-Ignore-etc-lvm-archive-.vg-files.patch
|
||||
Patch0006: 0006-RHEL-Fixes-for-libguestfs-winsupport.patch
|
||||
Patch0007: 0007-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
|
||||
Patch0008: 0008-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
|
||||
Patch0009: 0009-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
|
||||
Patch0010: 0010-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
|
||||
Patch0011: 0011-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
|
||||
Patch0012: 0012-RHEL-tests-Remove-btrfs-test.patch
|
||||
Patch0013: 0013-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
|
||||
Patch0014: 0014-Update-common-submodule.patch
|
||||
Patch0001: 0001-RHEL-Fixes-for-libguestfs-winsupport.patch
|
||||
Patch0002: 0002-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
|
||||
Patch0003: 0003-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
|
||||
Patch0004: 0004-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
|
||||
Patch0005: 0005-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
|
||||
Patch0006: 0006-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
|
||||
Patch0007: 0007-RHEL-tests-Remove-btrfs-test.patch
|
||||
Patch0008: 0008-RHEL-Add-warning-about-virt-v2v-in-place-not-being-s.patch
|
||||
|
||||
BuildRequires: autoconf, automake, libtool
|
||||
BuildRequires: make
|
||||
@ -383,8 +377,8 @@ done
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Sep 18 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.9.6-3
|
||||
- Rebase to virt-v2v 2.9.6
|
||||
* Mon Sep 22 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.9.8-1
|
||||
- Rebase to virt-v2v 2.9.8
|
||||
resolves: RHEL-111241
|
||||
- Tighten permissions on windows C:\Program Files\Guestfs
|
||||
resolves: RHEL-104352
|
||||
|
||||
Loading…
Reference in New Issue
Block a user