Turn live domain error into a warning

resolves: RHEL-88543
Remove usage of nbdkit-cacheextents-filter
resolves: RHEL-88857
Print better mountpoint stats in debug output
resolves: RHEL-88861
Add virt-v2v -io vddk-noextents=true so we can test noextents
resolves: RHEL-88863
Remove several ancient, deprecated options
resolves: RHEL-88866
This commit is contained in:
Richard W.M. Jones 2025-04-29 15:06:27 +01:00
parent 47ce2daa1e
commit 96cc493c74
11 changed files with 884 additions and 2 deletions

View File

@ -0,0 +1,24 @@
From 43dc900cee261bf5b090d63745b2ddcee6590583 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 28 Apr 2025 14:53:21 +0100
Subject: [PATCH] convert: flush output after printing debug information
Make sure this information gets into the log early.
(cherry picked from commit b0494befae461f1f34f5d40a4fb901befbc8e380)
---
convert/convert.ml | 1 +
1 file changed, 1 insertion(+)
diff --git a/convert/convert.ml b/convert/convert.ml
index 604902d1..7a27467b 100644
--- a/convert/convert.ml
+++ b/convert/convert.ml
@@ -301,6 +301,7 @@ and debug_info source inspect
target_nics;
eprintf "mountpoint stats:\n";
List.iter debug_mpstat mpstats;
+ flush Stdlib.stderr
and debug_mpstat { mp_dev = dev; mp_path = path;
mp_statvfs = s; mp_vfs = vfs } =

View File

@ -0,0 +1,69 @@
From d382827a7342a9ee9835d95ed86f864c960d8c71 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 28 Apr 2025 14:53:52 +0100
Subject: [PATCH] convert: Print more readable mountpoint stats
Print mountpoint stats which are more similar to what 'virt-df -h'
prints. This makes them easier to follow.
Before this change:
mountpoint stats:
mountpoint statvfs /dev/sda1 /boot/efi (vfat):
bsize=4096 blocks=65467 bfree=63058 bavail=63058
mountpoint statvfs /dev/sda2 /boot (xfs):
bsize=4096 blocks=130219 bfree=90268 bavail=90268
mountpoint statvfs /dev/vg00/lv_root / (xfs):
bsize=4096 blocks=24956001 bfree=22727257 bavail=22727257
After this change:
mountpoint stats:
Size Used Available Use%
/dev/sda1 /boot (ext4):
510873600 81379328 391917568
487.2M 77.6M 373.8M 15.9%
/dev/sda3 / (xfs): 4820303872 898846720 3921457152
4.5G 857.2M 3.7G 18.6%
(cherry picked from commit 9b786f36ddbb76b1c7857a94c53a8b8479c57ac4)
---
convert/convert.ml | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml
index 7a27467b..d4d28f68 100644
--- a/convert/convert.ml
+++ b/convert/convert.ml
@@ -300,11 +300,27 @@ and debug_info source inspect
List.iter (fun nic -> eprintf "%s\n" (string_of_source_nic nic))
target_nics;
eprintf "mountpoint stats:\n";
+ eprintf "%20s %-16s %-16s %-16s %s\n" "" "Size" "Used" "Available" "Use%";
List.iter debug_mpstat mpstats;
flush Stdlib.stderr
+(* The calculations here are similar to virt-df df/output.c *)
and debug_mpstat { mp_dev = dev; mp_path = path;
- mp_statvfs = s; mp_vfs = vfs } =
- eprintf " mountpoint statvfs %s %s (%s):\n" dev path vfs;
- eprintf " bsize=%Ld blocks=%Ld bfree=%Ld bavail=%Ld\n"
- s.Guestfs.bsize s.Guestfs.blocks s.Guestfs.bfree s.Guestfs.bavail
+ mp_statvfs = { G.bsize; G.blocks; G.bfree; G.bavail };
+ mp_vfs = vfs } =
+ let label = sprintf "%s %s (%s):" dev path vfs
+ and size = blocks *^ bsize
+ and used = (blocks -^ bfree) *^ bsize
+ and avail = bavail *^ bsize
+ and percent =
+ if blocks <> 0_L then
+ 100. -. 100. *. (Int64.to_float bfree /. Int64.to_float blocks)
+ else
+ 0. in
+ if String.length label > 20 then
+ eprintf "%s\n%20s " label ""
+ else
+ eprintf "%-20s " label;
+ eprintf "%-16Ld %-16Ld %-16Ld\n" size used avail;
+ eprintf "%20s %-16s %-16s %-16s %.1f%%\n"
+ "" (human_size size) (human_size used) (human_size avail) percent

View File

@ -0,0 +1,97 @@
From 212beda84cd9366b65f73d71664f1a2aaeafc9f8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 10:29:08 +0100
Subject: [PATCH] input: Remove usage of nbdkit-cacheextents-filter
The caching in this filter
(https://libguestfs.org/nbdkit-cacheextents-filter.1.html) is very
simple. It is basically designed so that if a client asks for one
extent at a time (using the NBD flag NBD_CMD_FLAG_REQ_ONE) then we ask
for all the extents that the underlying plugin will give us, and cache
those. However only a single contiguous set of extents is cached, and
any non-contiguous read will blow away the cache.
This was designed entirely to work around the buggy behaviour of
'qemu-img convert', which makes lots of req_one requests like this.
nbdcopy works completely differently, and doesn't have this problem.
nbdcopy also reads non-contiguous stretches of the input from multiple
threads. The filter in this case isn't effective (it doesn't do
anything bad since nbdcopy doesn't use the req_one flag).
In addition, the infamously slow QueryAllocatedBlocks API is only
called from the copy stage, and never (or maybe almost never) from the
conversion stage, so nothing that qemu does could justify caching
extents.
As this filter is essentially useless with current virt-v2v / nbdcopy,
remove its use completely.
(cherry picked from commit 48c4ce8e6cf6f1c390a48245ef0f99233f80cfe8)
---
README | 1 -
input/nbdkit_curl.ml | 5 -----
input/nbdkit_ssh.ml | 5 -----
input/nbdkit_vddk.ml | 5 -----
4 files changed, 16 deletions(-)
diff --git a/README b/README
index 4354754f..e4785166 100644
--- a/README
+++ b/README
@@ -69,7 +69,6 @@ REQUIREMENTS
+ nbdkit-ssh-plugin
+ nbdkit-vddk-plugin
- + nbdkit-cacheextents-filter
+ nbdkit-cow-filter
+ nbdkit-multi-conn-filter
+ nbdkit-rate-filter
diff --git a/input/nbdkit_curl.ml b/input/nbdkit_curl.ml
index 7e13c205..695f6d7c 100644
--- a/input/nbdkit_curl.ml
+++ b/input/nbdkit_curl.ml
@@ -71,11 +71,6 @@ let create_curl ?bandwidth ?cookie_script ?cookie_script_renew ?cor
*)
Nbdkit.add_filter_if_available cmd "retry";
- (* Caching extents speeds up qemu-img, especially its consecutive
- * block_status requests with req_one=1.
- *)
- Nbdkit.add_filter_if_available cmd "cacheextents";
-
(* IMPORTANT! Add the COW filter. It must be furthest away
* except for the rate filter.
*)
diff --git a/input/nbdkit_ssh.ml b/input/nbdkit_ssh.ml
index 1a2d2b56..4aba74f3 100644
--- a/input/nbdkit_ssh.ml
+++ b/input/nbdkit_ssh.ml
@@ -69,11 +69,6 @@ let create_ssh ?bandwidth ?cor ?(retry=true)
if retry then
Nbdkit.add_filter_if_available cmd "retry";
- (* Caching extents speeds up qemu-img, especially its consecutive
- * block_status requests with req_one=1.
- *)
- Nbdkit.add_filter_if_available cmd "cacheextents";
-
(* IMPORTANT! Add the COW filter. It must be furthest away
* except for the rate filter.
*)
diff --git a/input/nbdkit_vddk.ml b/input/nbdkit_vddk.ml
index 0cb45e89..b79c28cc 100644
--- a/input/nbdkit_vddk.ml
+++ b/input/nbdkit_vddk.ml
@@ -140,11 +140,6 @@ See also the virt-v2v-input-vmware(1) manual.") libNN
*)
Nbdkit.add_filter_if_available cmd "retry";
- (* Caching extents speeds up qemu-img, especially its consecutive
- * block_status requests with req_one=1.
- *)
- Nbdkit.add_filter_if_available cmd "cacheextents";
-
(* Split very large requests to avoid out of memory errors on the
* server. Since we're using this filter, also add minblock=512
* although it will make no difference.

View File

@ -0,0 +1,55 @@
From 65a9c8ed09f4cd04ae2176b48c4c9c1f69b08399 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 10:42:46 +0100
Subject: [PATCH] input: Document my findings with nbdkit-noextents-filter
This just adds a comment, so makes no change.
(cherry picked from commit 29fae7985eda1d1cf3e176f123a16b60cac2db53)
---
input/nbdkit_vddk.ml | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/input/nbdkit_vddk.ml b/input/nbdkit_vddk.ml
index b79c28cc..3ba00d55 100644
--- a/input/nbdkit_vddk.ml
+++ b/input/nbdkit_vddk.ml
@@ -140,6 +140,38 @@ See also the virt-v2v-input-vmware(1) manual.") libNN
*)
Nbdkit.add_filter_if_available cmd "retry";
+ (* VDDK's QueryAllocatedBlocks API is infamously slow. It appears
+ * to block all other requests while it is running. This API is
+ * also only called during the copy phase, not during conversion
+ * (or if it is, extremely rarely).
+ *
+ * If fstrim was successful, then trimmed blocks are stored in
+ * the COW filter (see below), and so requests for extents stop
+ * at that layer. However for areas of the disk that fstrim
+ * thinks contain data, we still have to go through to VDDK to
+ * fetch extents.
+ *
+ * We could therefore add nbdkit-noextents-filter here (below COW,
+ * above VDDK plugin) which stops extents requests from going
+ * to VDDK, which would stop QueryAllocatedBlocks ever being
+ * called. In my testing this is a moderate performance win.
+ *
+ * However ... in the case where fstrim failed, or for filesystems
+ * or partitions on the disk that we don't understand, doing this
+ * would mean that those are copied completely, as there would be
+ * no extent data (nbdcopy will still sparsify them on the target,
+ * but we'd have to copy all the bits from VMware). Because
+ * here we don't know if this is the case, be conservative and
+ * actually don't use this filter.
+ *
+ * If used, this filter should be close to the plugin and MUST
+ * be below the COW filter.
+ *
+ * XXX Add some kind of debugging flag so we can test how this
+ * works in production.
+ *)
+ (*Nbdkit.add_filter_if_available cmd "noextents";*)
+
(* Split very large requests to avoid out of memory errors on the
* server. Since we're using this filter, also add minblock=512
* although it will make no difference.

View File

@ -0,0 +1,95 @@
From 7ba9e7322e5828686fee9e71d7ffa17fe406c28a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 12:47:00 +0100
Subject: [PATCH] input: Add undocumented -io vddk-noextents=true option
This turns on the noextents filter, so that the slow VDDK API
QueryAllocatedBlocks will never be called. This is just so we can
test in production if this is effective or not.
(cherry picked from commit 191b8cf418076ae3766b134ffa96eee048c7eb9d)
---
input/input_vddk.ml | 8 +++++++-
input/nbdkit_vddk.ml | 8 +++-----
input/nbdkit_vddk.mli | 1 +
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/input/input_vddk.ml b/input/input_vddk.ml
index 6444ce18..2edd7294 100644
--- a/input/input_vddk.ml
+++ b/input/input_vddk.ml
@@ -52,6 +52,7 @@ All other settings are optional:
-io vddk-cookie=COOKIE VDDK cookie
-io vddk-libdir=LIBDIR VDDK library parent directory
-io vddk-nfchostport=PORT VDDK nfchostport
+ -io vddk-noextents=true Avoid slow VDDK QueryAllocatedBlocks API
-io vddk-port=PORT VDDK port
-io vddk-snapshot=SNAPSHOT-MOREF
VDDK snapshot moref
@@ -71,6 +72,7 @@ information on these settings.
"cookie";
"libdir";
"nfchostport";
+ "noextents";
"port";
"snapshot";
"thumbprint";
@@ -173,6 +175,9 @@ information on these settings.
try Some (List.assoc "libdir" io_options) with Not_found -> None in
let nfchostport =
try Some (List.assoc "nfchostport" io_options) with Not_found -> None in
+ let noextents =
+ try bool_of_string (List.assoc "noextents" io_options)
+ with Not_found -> false in
let port =
try Some (List.assoc "port" io_options) with Not_found -> None in
let snapshot =
@@ -204,7 +209,8 @@ information on these settings.
Nbdkit_vddk.create_vddk ?bandwidth:options.bandwidth
?config ?cookie ~cor
?libdir ~moref
- ?nfchostport ?password_file:options.input_password ?port
+ ?nfchostport ~noextents
+ ?password_file:options.input_password ?port
~server ?snapshot ~thumbprint ?transports ?user
path in
let _, pid = Nbdkit.run_unix socket nbdkit in
diff --git a/input/nbdkit_vddk.ml b/input/nbdkit_vddk.ml
index 3ba00d55..5c23efd1 100644
--- a/input/nbdkit_vddk.ml
+++ b/input/nbdkit_vddk.ml
@@ -51,7 +51,7 @@ let libNN = sprintf "lib%d" Sys.word_size
(* Create an nbdkit module specialized for reading from VDDK sources. *)
let create_vddk ?bandwidth ?config ?cookie ?cor ?libdir ~moref
- ?nfchostport ?password_file ?port
+ ?nfchostport ~noextents ?password_file ?port
~server ?snapshot ~thumbprint ?transports ?user path =
if not (Nbdkit.is_installed ()) then
error (f_"nbdkit is not installed or not working");
@@ -166,11 +166,9 @@ See also the virt-v2v-input-vmware(1) manual.") libNN
*
* If used, this filter should be close to the plugin and MUST
* be below the COW filter.
- *
- * XXX Add some kind of debugging flag so we can test how this
- * works in production.
*)
- (*Nbdkit.add_filter_if_available cmd "noextents";*)
+ if noextents then
+ Nbdkit.add_filter_if_available cmd "noextents";
(* Split very large requests to avoid out of memory errors on the
* server. Since we're using this filter, also add minblock=512
diff --git a/input/nbdkit_vddk.mli b/input/nbdkit_vddk.mli
index 2345e6e2..ef2082db 100644
--- a/input/nbdkit_vddk.mli
+++ b/input/nbdkit_vddk.mli
@@ -25,6 +25,7 @@ val create_vddk : ?bandwidth:Types.bandwidth ->
?libdir:string ->
moref:string ->
?nfchostport:string ->
+ noextents:bool ->
?password_file:string ->
?port:string ->
server:string ->

View File

@ -0,0 +1,136 @@
From 510f8a451723303d2af527e66c73ff18a03330e8 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 12:48:51 +0100
Subject: [PATCH] v2v: Remove --vddk-*, --vdsm-*, --compressed, --qemu-boot
compat options
These were deprecated in commit 0802485f2e ("v2v: Add general
mechanism for input and output options (-io/-oo).", March 2018), and
most of them haven't appeared in any documentation for a long time.
It's time to remove them now.
(cherry picked from commit 471607b01543debfb2f44d9a8aa0dc7a592f5c06)
---
docs/test-docs.sh | 14 --------------
docs/virt-v2v.pod | 4 ----
v2v/v2v.ml | 40 ++--------------------------------------
3 files changed, 2 insertions(+), 56 deletions(-)
diff --git a/docs/test-docs.sh b/docs/test-docs.sh
index 4537e774..59df4344 100755
--- a/docs/test-docs.sh
+++ b/docs/test-docs.sh
@@ -87,20 +87,6 @@ $srcdir/../podcheck.pl virt-v2v.pod virt-v2v \
--oo,\
--op,\
--os,\
---vddk-config,\
---vddk-cookie,\
---vddk-libdir,\
---vddk-nfchostport,\
---vddk-port,\
---vddk-snapshot,\
---vddk-thumbprint,\
---vddk-transports,\
---vdsm-compat,\
---vdsm-image-uuid,\
---vdsm-ovf-flavour,\
---vdsm-ovf-output,\
---vdsm-vm-uuid,\
---vdsm-vol-uuid,\
--vmtype,\
$virt_customize_options
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
index 216e617d..57714022 100644
--- a/docs/virt-v2v.pod
+++ b/docs/virt-v2v.pod
@@ -217,10 +217,6 @@ when the output is a tty. If the output of the program is redirected
to a file, ANSI colour sequences are disabled unless you use this
option.
-=item B<--compressed>
-
-This is the same as I<-oo compressed>.
-
=item B<--echo-keys>
When prompting for keys and passphrases, virt-v2v normally turns
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 10d24364..5f36be1c 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -55,27 +55,21 @@ let rec main () =
let input_options = ref [] in
let io_query = ref false in
- let set_input_option_compat k v =
- List.push_back input_options (k, v)
- in
let set_input_option option =
if option = "?" then io_query := true
else (
let k, v = String.split "=" option in
- set_input_option_compat k v
+ List.push_back input_options (k, v)
)
in
let output_options = ref [] in
let oo_query = ref false in
- let set_output_option_compat k v =
- List.push_back output_options (k, v)
- in
let set_output_option option =
if option = "?" then oo_query := true
else (
let k, v = String.split "=" option in
- set_output_option_compat k v
+ List.push_back output_options (k, v)
)
in
@@ -226,8 +220,6 @@ let rec main () =
s_"Set bandwidth dynamically from file";
[ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge),
s_"Map bridge in to out";
- [ L"compressed" ], Getopt.Unit (fun () -> set_output_option_compat "compressed" ""),
- s_"Compress output file (-of qcow2 only)";
[ S 'i' ], Getopt.String ("disk|libvirt|libvirtxml|ova|vmx", set_input_mode),
s_"Set input mode (default: libvirt)";
[ M"ic" ], Getopt.String ("uri", set_string_option_once "-ic" input_conn),
@@ -270,34 +262,6 @@ let rec main () =
s_"Print source and stop";
[ 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"),
- s_"Same as -io vddk-config=filename";
- [ L"vddk-cookie" ], Getopt.String ("cookie", set_input_option_compat "vddk-cookie"),
- s_"Same as -io vddk-cookie=filename";
- [ L"vddk-libdir" ], Getopt.String ("libdir", set_input_option_compat "vddk-libdir"),
- s_"Same as -io vddk-libdir=libdir";
- [ L"vddk-nfchostport" ], Getopt.String ("nfchostport", set_input_option_compat "vddk-nfchostport"),
- s_"Same as -io vddk-nfchostport=nfchostport";
- [ L"vddk-port" ], Getopt.String ("port", set_input_option_compat "vddk-port"),
- s_"Same as -io vddk-port=port";
- [ L"vddk-snapshot" ], Getopt.String ("snapshot-moref", set_input_option_compat "vddk-snapshot"),
- s_"Same as -io vddk-snapshot=snapshot-moref";
- [ L"vddk-thumbprint" ], Getopt.String ("thumbprint", set_input_option_compat "vddk-thumbprint"),
- s_"Same as -io vddk-thumbprint=thumbprint";
- [ L"vddk-transports" ], Getopt.String ("transports", set_input_option_compat "vddk-transports"),
- s_"Same as -io vddk-transports=transports";
- [ L"vdsm-compat" ], Getopt.String ("0.10|1.1", set_output_option_compat "vdsm-compat"),
- s_"Same as -oo vdsm-compat=0.10|1.1";
- [ L"vdsm-image-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-image-uuid"),
- s_"Same as -oo vdsm-image-uuid=uuid";
- [ L"vdsm-vol-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vol-uuid"),
- s_"Same as -oo vdsm-vol-uuid=uuid";
- [ L"vdsm-vm-uuid" ], Getopt.String ("uuid", set_output_option_compat "vdsm-vm-uuid"),
- s_"Same as -oo vdsm-vm-uuid=uuid";
- [ L"vdsm-ovf-output" ], Getopt.String ("dir", set_output_option_compat "vdsm-ovf-output"),
- s_"Same as -oo vdsm-ovf-output=dir";
- [ L"vdsm-ovf-flavour" ], Getopt.String ("ovirt|rhvexp", set_output_option_compat "vdsm-ovf-flavour"),
- s_"Same as -oo vdsm-ovf-flavour=flavour";
[ L"vmtype" ], Getopt.String ("-", vmtype_warning),
s_"Ignored for backwards compatibility";
] in

View File

@ -0,0 +1,87 @@
From 0fab89ac2c144dc521b9b2cd803801cdbb94fb5c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 12:57:29 +0100
Subject: [PATCH] v2v: Remove --no-trim and --vmtype options
These were removed and changed so the otions do nothing a long time ago:
Related: commit 740c5b10cb ("v2v: Remove --no-trim option.", Apr 2016)
Related: commit 6086c0ffcf ("v2v: Remove the --vmtype option.", Apr 2016)
(cherry picked from commit 3fe878c36f23889426ef9b032a7516a94c1f9af4)
---
bash/virt-v2v | 3 ---
docs/test-docs.sh | 2 --
v2v/v2v.ml | 12 ------------
3 files changed, 17 deletions(-)
diff --git a/bash/virt-v2v b/bash/virt-v2v
index cddd0739..1234134c 100644
--- a/bash/virt-v2v
+++ b/bash/virt-v2v
@@ -34,9 +34,6 @@ _virt_v2v ()
-oa)
COMPREPLY=( $( compgen -W "sparse preallocated" -- "$cur") )
return ;;
- --vmtype)
- COMPREPLY=( $( compgen -W "server desktop" -- "$cur") )
- return ;;
esac
case "$cur" in
diff --git a/docs/test-docs.sh b/docs/test-docs.sh
index 59df4344..1037bf7e 100755
--- a/docs/test-docs.sh
+++ b/docs/test-docs.sh
@@ -78,7 +78,6 @@ $srcdir/../podcheck.pl virt-v2v.pod virt-v2v \
--ip,\
--it,\
--in-place,\
---no-trim,\
--password-file,\
--oa,\
--oc,\
@@ -87,7 +86,6 @@ $srcdir/../podcheck.pl virt-v2v.pod virt-v2v \
--oo,\
--op,\
--os,\
---vmtype,\
$virt_customize_options
$srcdir/../podcheck.pl virt-v2v-in-place.pod virt-v2v-in-place \
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 5f36be1c..30f317ee 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -205,14 +205,6 @@ let rec main () =
error (f_"unknown -o option: %s") s
in
- (* Options that are ignored for backwards compatibility. *)
- let no_trim_warning _ =
- warning (f_"the --no-trim option has been removed and now does nothing")
- in
- let vmtype_warning _ =
- warning (f_"the --vmtype option has been removed and now does nothing")
- in
-
let argspec = [
[ L"bandwidth" ], Getopt.String ("bps", set_string_option_once "--bandwidth" bandwidth),
s_"Set bandwidth to bits per sec";
@@ -236,8 +228,6 @@ let rec main () =
s_"Map NIC to network or bridge or assign static IP";
[ S 'n'; L"network" ], Getopt.String ("in:out", add_network),
s_"Map network in to out";
- [ L"no-trim" ], Getopt.String ("-", no_trim_warning),
- s_"Ignored for backwards compatibility";
[ S 'o' ], Getopt.String ("kubevirt|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),
@@ -262,8 +252,6 @@ let rec main () =
s_"Print source and stop";
[ L"root" ], Getopt.String ("ask|... ", set_root_choice),
s_"How to choose root filesystem";
- [ L"vmtype" ], Getopt.String ("-", vmtype_warning),
- s_"Ignored for backwards compatibility";
] in
(* Append virt-customize options. *)

View File

@ -0,0 +1,49 @@
From ce1525716b247b0c8eec8a9f0adb2c4009dcdf23 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 13:53:01 +0100
Subject: [PATCH] v2v: Remove --password-file option
This was changed to '-ip' in commit eb508ba22d ("v2v: Use -ip to pass
input password (instead of --password-file).", June 2018). It also
now can be confused with the similar --password and --password-crypto
options, used by the virt-customize code.
(cherry picked from commit 21d914d6b2443d2f41ef62c7f185e188de4a1aab)
---
docs/test-docs.sh | 2 --
v2v/v2v.ml | 2 --
2 files changed, 4 deletions(-)
diff --git a/docs/test-docs.sh b/docs/test-docs.sh
index 1037bf7e..9a4c58ab 100755
--- a/docs/test-docs.sh
+++ b/docs/test-docs.sh
@@ -78,7 +78,6 @@ $srcdir/../podcheck.pl virt-v2v.pod virt-v2v \
--ip,\
--it,\
--in-place,\
---password-file,\
--oa,\
--oc,\
--of,\
@@ -96,7 +95,6 @@ $srcdir/../podcheck.pl virt-v2v-in-place.pod virt-v2v-in-place \
--io,\
--ip,\
--it,\
---password-file,\
--oa,\
--oc,\
--of,\
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 30f317ee..7f1d4352 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -244,8 +244,6 @@ let rec main () =
s_"Use password from file to connect to output hypervisor";
[ M"os" ], Getopt.String ("storage", set_string_option_once "-os" output_storage),
s_"Set output storage location";
- [ L"password-file" ], Getopt.String ("filename", set_string_option_once "-ip" input_password),
- s_"Same as -ip filename";
[ L"parallel" ], Getopt.Set_int ("N", parallel),
s_"Run up to N instances of nbdcopy in parallel";
[ L"print-source" ], Getopt.Set print_source,

View File

@ -0,0 +1,59 @@
From 63c3d929e947a3c7a37dafd6ba188f38ef8a2bd0 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 13:16:41 +0100
Subject: [PATCH] input/nbdkit_vddk.ml: Rename 'path' parameter to 'file'
The nbdkit parameter is called 'file'. There is no actual change here.
(cherry picked from commit 5acc67d454add0b75f6671c06979a0cc90562f7e)
---
input/input_vddk.ml | 4 ++--
input/nbdkit_vddk.ml | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/input/input_vddk.ml b/input/input_vddk.ml
index 2edd7294..659ff08f 100644
--- a/input/input_vddk.ml
+++ b/input/input_vddk.ml
@@ -198,7 +198,7 @@ information on these settings.
| BlockDev _ | NBD _ | HTTP _ -> (* These should never happen? *)
assert false
- | LocalFile path ->
+ | LocalFile file ->
(* The <source file=...> attribute returned by the libvirt
* VMX driver looks like "[datastore] path". We can use it
* directly as the nbdkit file= parameter, and it is passed
@@ -212,7 +212,7 @@ information on these settings.
?nfchostport ~noextents
?password_file:options.input_password ?port
~server ?snapshot ~thumbprint ?transports ?user
- path in
+ file in
let _, pid = Nbdkit.run_unix socket nbdkit in
On_exit.kill pid
) disks;
diff --git a/input/nbdkit_vddk.ml b/input/nbdkit_vddk.ml
index 5c23efd1..801182d1 100644
--- a/input/nbdkit_vddk.ml
+++ b/input/nbdkit_vddk.ml
@@ -51,8 +51,8 @@ let libNN = sprintf "lib%d" Sys.word_size
(* Create an nbdkit module specialized for reading from VDDK sources. *)
let create_vddk ?bandwidth ?config ?cookie ?cor ?libdir ~moref
- ?nfchostport ~noextents ?password_file ?port
- ~server ?snapshot ~thumbprint ?transports ?user path =
+ ?nfchostport ~noextents ?password_file ?port
+ ~server ?snapshot ~thumbprint ?transports ?user file =
if not (Nbdkit.is_installed ()) then
error (f_"nbdkit is not installed or not working");
@@ -114,7 +114,7 @@ See also the virt-v2v-input-vmware(1) manual.") libNN
Nbdkit.add_arg cmd "server" server;
Nbdkit.add_arg cmd "vm" (sprintf "moref=%s" moref);
- Nbdkit.add_arg cmd "file" path;
+ Nbdkit.add_arg cmd "file" file;
(* For VDDK we require some user. If it's not supplied, assume root. *)
let user = Option.value ~default:"root" user in

View File

@ -0,0 +1,193 @@
From fb8a4d851946677d5c79afb575267f17a8b649a5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 29 Apr 2025 13:44:07 +0100
Subject: [PATCH] input: Add -io vddk-file=... option
This option allows the file parameter of nbdkit-vddk-plugin to be
overridden. Useful for performing conversions of snapshots, since the
filename returned by libvirt may not be the correct snapshot filename.
This also updates the common submodule, pulling in:
Richard W.M. Jones (2):
mlstdutils: Implement String.implode
mlstdutils: Add List.make function
Suggested-by: Martin Necas
Fixes: https://issues.redhat.com/browse/RHEL-88543
(cherry picked from commit 5328142e6a9faae1db99c646991d27badc6efe91)
---
common | 2 +-
docs/virt-v2v-input-vmware.pod | 9 +++++----
input/input_vddk.ml | 35 ++++++++++++++++++++++++++--------
3 files changed, 33 insertions(+), 13 deletions(-)
Submodule common 57c2b3f0..3873d593:
diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml
index 212a1513..6880fce5 100644
--- a/common/mlstdutils/std_utils.ml
+++ b/common/mlstdutils/std_utils.ml
@@ -409,6 +409,14 @@ module List = struct
let push_back_list xsp xs = xsp := !xsp @ xs
let push_front_list xs xsp = xsp := xs @ !xsp
+
+ let make n x =
+ let rec loop acc = function
+ | 0 -> acc
+ | i when i > 0 -> loop (x :: acc) (i-1)
+ | _ -> invalid_arg "make"
+ in
+ loop [] n
end
let (//) = Filename.concat
diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli
index 72a2d44c..ae6004b2 100644
--- a/common/mlstdutils/std_utils.mli
+++ b/common/mlstdutils/std_utils.mli
@@ -291,6 +291,9 @@ module List : sig
[push_front_list] is like {!push_front} above, except it prepends
a list to the list reference. *)
+
+ val make : int -> 'a -> 'a list
+ (** [make n x] returns a list with [x] repeated [n] times. *)
end
(** Override the List module from stdlib. *)
diff --git a/common/mlstdutils/std_utils_tests.ml b/common/mlstdutils/std_utils_tests.ml
index 4e368152..5f8c1440 100644
--- a/common/mlstdutils/std_utils_tests.ml
+++ b/common/mlstdutils/std_utils_tests.ml
@@ -179,6 +179,12 @@ let test_which ctx =
end;
()
+(* Test List.make. *)
+let test_list_make ctx =
+ assert_equal_stringlist [] (List.make 0 "1");
+ assert_equal_stringlist ["1"; "1"; "1"] (List.make 3 "1");
+ assert_raises (Invalid_argument "make") (fun () -> List.make (-1) "1")
+
(* Suites declaration. *)
let suite =
"mllib Std_utils" >:::
@@ -195,6 +201,7 @@ let suite =
"strings.span" >:: test_string_span;
"strings.chomp" >:: test_string_chomp;
"which" >:: test_which;
+ "list.make" >:: test_list_make;
]
let () =
diff --git a/docs/virt-v2v-input-vmware.pod b/docs/virt-v2v-input-vmware.pod
index b28268c2..80ca560a 100644
--- a/docs/virt-v2v-input-vmware.pod
+++ b/docs/virt-v2v-input-vmware.pod
@@ -342,10 +342,11 @@ SSL thumbprint:
-o local -os /var/tmp
Other options that you might need to add in rare circumstances include
-I<-io vddk-config>, I<-io vddk-cookie>, 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.
+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.
=head2 VDDK: Debugging VDDK failures
diff --git a/input/input_vddk.ml b/input/input_vddk.ml
index 659ff08f..316fe5f8 100644
--- a/input/input_vddk.ml
+++ b/input/input_vddk.ml
@@ -50,6 +50,7 @@ All other settings are optional:
-io vddk-config=FILE VDDK configuration file
-io vddk-cookie=COOKIE VDDK cookie
+ -io vddk-file=FILE Override nbdkit-vddk-plugin file= parameter
-io vddk-libdir=LIBDIR VDDK library parent directory
-io vddk-nfchostport=PORT VDDK nfchostport
-io vddk-noextents=true Avoid slow VDDK QueryAllocatedBlocks API
@@ -70,6 +71,7 @@ information on these settings.
let vddk_option_keys =
[ "config";
"cookie";
+ "file";
"libdir";
"nfchostport";
"noextents";
@@ -90,11 +92,6 @@ information on these settings.
(key, value)
) options.input_options in
- (* Check no option appears more than once. *)
- let keys = List.map fst io_options in
- if List.length keys <> List.length (List.sort_uniq compare keys) then
- error (f_"-it vddk: duplicate -io options on the command line");
-
(* thumbprint is mandatory. *)
if not (List.mem_assoc "thumbprint" io_options) then
error (f_"You must pass the -io vddk-thumbprint option with the \
@@ -137,6 +134,7 @@ information on these settings.
(* Parse the libvirt XML. *)
let source, disks, xml = parse_libvirt_domain conn guest in
+ let nr_disks = List.length disks in
(* Find the <vmware:moref> element from the XML. This was added
* in libvirt >= 3.7 and is required.
@@ -188,9 +186,27 @@ information on these settings.
let transports =
try Some (List.assoc "transports" io_options) with Not_found -> None in
+ (* If -io vddk-file was given, there must be exactly one per guest
+ * disk. Get the list of file overrides.
+ *)
+ let file_overrides =
+ if List.mem_assoc "file" io_options then (
+ let fos =
+ List.filter_map (function ("file",b) -> Some (Some b) | _ -> None)
+ io_options in
+ if List.length fos <> nr_disks then
+ error (f_"-io vddk-file= must be used exactly %d times") nr_disks;
+ fos
+ )
+ else (
+ (* List of no overrides. *)
+ List.make nr_disks None
+ ) in
+
(* Create an nbdkit instance for each disk. *)
+ List.combine disks file_overrides |>
List.iteri (
- fun i { d_format = format; d_type } ->
+ fun i ({ d_format = format; d_type }, file_override) ->
let socket = sprintf "%s/in%d" dir i in
On_exit.unlink socket;
@@ -198,7 +214,10 @@ information on these settings.
| BlockDev _ | NBD _ | HTTP _ -> (* These should never happen? *)
assert false
- | LocalFile file ->
+ | LocalFile orig_file ->
+ (* If -io vddk-file, override it here. *)
+ let file = Option.value file_override ~default:orig_file in
+
(* The <source file=...> attribute returned by the libvirt
* VMX driver looks like "[datastore] path". We can use it
* directly as the nbdkit file= parameter, and it is passed
@@ -215,7 +234,7 @@ information on these settings.
file in
let _, pid = Nbdkit.run_unix socket nbdkit in
On_exit.kill pid
- ) disks;
+ );
source
end

View File

@ -8,7 +8,7 @@
Name: virt-v2v
Epoch: 1
Version: 2.7.1
Release: 9%{?dist}
Release: 10%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPL-2.0-or-later AND LGPL-2.0-or-later
@ -67,6 +67,16 @@ Patch0036: 0036-build-Use-nbdcopy-and-nbdinfo-from-.-configure.patch
Patch0037: 0037-v2v-Use-nbdcopy-blkhash-in-verbose-mode.patch
Patch0038: 0038-v2v-Print-nbdcopy-command-in-debug-output.patch
Patch0039: 0039-lib-libvirt_utils.ml-Turn-live-domain-error-into-a-w.patch
Patch0040: 0040-convert-flush-output-after-printing-debug-informatio.patch
Patch0041: 0041-convert-Print-more-readable-mountpoint-stats.patch
Patch0042: 0042-input-Remove-usage-of-nbdkit-cacheextents-filter.patch
Patch0043: 0043-input-Document-my-findings-with-nbdkit-noextents-fil.patch
Patch0044: 0044-input-Add-undocumented-io-vddk-noextents-true-option.patch
Patch0045: 0045-v2v-Remove-vddk-vdsm-compressed-qemu-boot-compat-opt.patch
Patch0046: 0046-v2v-Remove-no-trim-and-vmtype-options.patch
Patch0047: 0047-v2v-Remove-password-file-option.patch
Patch0048: 0048-input-nbdkit_vddk.ml-Rename-path-parameter-to-file.patch
Patch0049: 0049-input-Add-io-vddk-file-.-option.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -368,7 +378,7 @@ make -C tests TESTS=test-fedora-luks-on-lvm-conversion.sh check
%changelog
* Fri Apr 25 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-9
* Tue Apr 29 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-10
- mlcustomize: Remove dnf --verbose option
resolves: RHEL-83289
- Print blkhash of converted image in virt-v2v debugging output
@ -377,6 +387,14 @@ make -C tests TESTS=test-fedora-luks-on-lvm-conversion.sh check
resolves: RHEL-86022
- Turn live domain error into a warning
resolves: RHEL-88543
- Remove usage of nbdkit-cacheextents-filter
resolves: RHEL-88857
- Print better mountpoint stats in debug output
resolves: RHEL-88861
- Add virt-v2v -io vddk-noextents=true so we can test noextents
resolves: RHEL-88863
- Remove several ancient, deprecated options
resolves: RHEL-88866
* Tue Feb 25 2025 Richard W.M. Jones <rjones@redhat.com> - 1:2.7.1-5
- Rebase to upstream development version 2.7.1