Include a few experimental non-upstream patches

These two patches fix potential issues.  Best to get them tested over
Christmas and New Year.

    v2v: Swap over the output and conversion stages

    In old virt-v2v, we did (approximately, since the steps were not as
    clear):

      Input -> Convert -> Output -> Copy -> Finalize

    After modularizing virt-v2v we changed this to:

      Input -> Output -> Convert -> Copy -> Finalize

    However this has a (sort of) problem.  For -o rhv-upload when we start
    the nbdkit rhv-upload-plugin machinery, it obtains a time-limited
    ticket from imageio.  This ticket could expire if the conversion step
    takes longer than a certain time (60 seconds by default, may be
    increased in a future version of oVirt).

    I believe this is really a problem in imageio or that the
    rhv-upload-plugin should really renew this ticket automatically, but
    it does not, instead failing.  (The ticket *is* renewed automatically
    whenever a request is sent to imageio, but in this case no requests
    are being sent).

    Anyway the easiest thing is to switch the ordering back to how it was
    in old virt-v2v (at top).  It doesn't make a difference for any other
    output modes.

    Reported-by: Nir Soffer

and:

    v2v: Remove nbdcopy --request-size=4M flag

    This was added when we were setting the cow-block-size to 1M.  However
    since commit 351d61f768 ("input: -it vddk: Reduce cow-block-size to 4K")
    we stopped doing that so this is no longer needed.

    Reverts: commit 08e764959ec9dadd71a95d22d3d88d647a18d165

Related: rhbz#2011713
This commit is contained in:
Richard W.M. Jones 2021-12-18 13:51:11 +00:00
parent 7f5895afd1
commit 8190ec8540
14 changed files with 252 additions and 23 deletions

View File

@ -0,0 +1,72 @@
From 24fdb088b1856abec0974a428c424fe598597079 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Dec 2021 12:01:19 +0000
Subject: [PATCH] input, output: Use Option.may for some Nbdkit calls
Option.may (Nbdkit.add_arg cmd "port") port;
is completely equivalent to:
(match port with
| Some s -> Nbdkit.add_arg cmd "port" s
| None -> ());
Updates: commit d50966c2a480bda033f6e63bb797f86c13d576bd
---
input/nbdkit_curl.ml | 4 +---
input/nbdkit_ssh.ml | 8 ++------
output/output_rhv_upload.ml | 4 +---
3 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/input/nbdkit_curl.ml b/input/nbdkit_curl.ml
index d6793b22..081c598e 100644
--- a/input/nbdkit_curl.ml
+++ b/input/nbdkit_curl.ml
@@ -57,9 +57,7 @@ let create_curl ?bandwidth ?cookie_script ?cookie_script_renew ?cor
(* https://bugzilla.redhat.com/show_bug.cgi?id=1146007#c10 *)
Nbdkit.add_arg cmd "timeout" "2000";
- (match cookie_script with
- | Some s -> Nbdkit.add_arg cmd "cookie-script" s
- | None -> ());
+ Option.may (Nbdkit.add_arg cmd "cookie-script") cookie_script;
(match cookie_script_renew with
| Some i -> Nbdkit.add_arg cmd "cookie-script-renew" (string_of_int i)
| None -> ());
diff --git a/input/nbdkit_ssh.ml b/input/nbdkit_ssh.ml
index ce972d7d..0a6d8425 100644
--- a/input/nbdkit_ssh.ml
+++ b/input/nbdkit_ssh.ml
@@ -61,12 +61,8 @@ let create_ssh ?bandwidth ?cor ~password ?port ~server ?user path =
let cmd = Nbdkit.create "ssh" in
Nbdkit.add_arg cmd "host" server;
Nbdkit.add_arg cmd "path" path;
- (match port with
- | Some s -> Nbdkit.add_arg cmd "port" s
- | None -> ());
- (match user with
- | Some s -> Nbdkit.add_arg cmd "user" s
- | None -> ());
+ Option.may (Nbdkit.add_arg cmd "port") port;
+ Option.may (Nbdkit.add_arg cmd "user") user;
(* Retry filter (if it exists) can be used to get around brief
* interruptions in service. It must be closest to the plugin.
diff --git a/output/output_rhv_upload.ml b/output/output_rhv_upload.ml
index 7cedfff9..91e7be45 100644
--- a/output/output_rhv_upload.ml
+++ b/output/output_rhv_upload.ml
@@ -345,9 +345,7 @@ e command line has to match the number of guest disk images (for this guest: %d)
(* Create the nbdkit instance. *)
Nbdkit.add_arg cmd "size" (Int64.to_string size);
Nbdkit.add_arg cmd "url" destination_url;
- (match rhv_cafile with
- | None -> ()
- | Some cafile -> Nbdkit.add_arg cmd "cafile" cafile);
+ Option.may (Nbdkit.add_arg cmd "cafile") rhv_cafile;
if not rhv_verifypeer then
Nbdkit.add_arg cmd "insecure" "true";
if is_ovirt_host then
--
2.31.1

View File

@ -0,0 +1,26 @@
From 702a511b7f3379102ec5d267a7a43bdd47f3e594 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Dec 2021 13:22:48 +0000
Subject: [PATCH] input/nbdkit_curl.ml: Fix typo in commented code
Fixes: commit 255722cbf39afc0b012e2ac00d16fa6ba2f8c21f
---
input/nbdkit_curl.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/input/nbdkit_curl.ml b/input/nbdkit_curl.ml
index 081c598e..aacedb78 100644
--- a/input/nbdkit_curl.ml
+++ b/input/nbdkit_curl.ml
@@ -65,7 +65,7 @@ let create_curl ?bandwidth ?cookie_script ?cookie_script_renew ?cor
(* For lots of extra debugging, uncomment one or both lines. *)
(* Nbdkit.add_arg cmd "--debug" "curl.verbose=1"; *)
- (* Nbdkit.add_arg cnd "--debug" "curl.scripts=1"; *)
+ (* Nbdkit.add_arg cmd "--debug" "curl.scripts=1"; *)
(* Retry filter (if it exists) can be used to get around brief
* interruptions in service. It must be closest to the plugin.
--
2.31.1

View File

@ -0,0 +1,66 @@
From 235e3ea926bc1138b481f9200b1880f368cf0f27 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Dec 2021 13:42:56 +0000
Subject: [PATCH] v2v: Swap over the output and conversion stages
In old virt-v2v, we did (approximately, since the steps were not as
clear):
Input -> Convert -> Output -> Copy -> Finalize
After modularizing virt-v2v we changed this to:
Input -> Output -> Convert -> Copy -> Finalize
However this has a (sort of) problem. For -o rhv-upload when we start
the nbdkit rhv-upload-plugin machinery, it obtains a time-limited
ticket from imageio. This ticket could expire if the conversion step
takes longer than a certain time (60 seconds by default, may be
increased in a future version of oVirt).
I believe this is really a problem in imageio or that the
rhv-upload-plugin should really renew this ticket automatically, but
it does not, instead failing. (The ticket *is* renewed automatically
whenever a request is sent to imageio, but in this case no requests
are being sent).
Anyway the easiest thing is to switch the ordering back to how it was
in old virt-v2v (at top). It doesn't make a difference for any other
output modes.
Reported-by: Nir Soffer
---
v2v/v2v.ml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index a2414598..1db0c233 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -542,6 +542,11 @@ read the man page virt-v2v(1).
exit 0
);
+ (* Do the conversion. *)
+ with_open_out (tmpdir // "convert") (fun _ -> ());
+ let inspect, target_meta = Convert.convert tmpdir conv_options source in
+ unlink (tmpdir // "convert");
+
(* Start the output module (runs an NBD server in the background). *)
let output_t = Output_module.setup tmpdir output_options source in
@@ -551,11 +556,6 @@ read the man page virt-v2v(1).
ignore (Sys.command cmd)
);
- (* Do the conversion. *)
- with_open_out (tmpdir // "convert") (fun _ -> ());
- let inspect, target_meta = Convert.convert tmpdir conv_options source in
- unlink (tmpdir // "convert");
-
(* Do the copy. *)
with_open_out (tmpdir // "copy") (fun _ -> ());
--
2.31.1

View File

@ -0,0 +1,61 @@
From b57ce6a2cd0dd4941b6d0bc88428487103688ec5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 18 Dec 2021 13:40:08 +0000
Subject: [PATCH] XXX v2v: Remove nbdcopy --request-size=4M flag
XXX NEEDS BENCHMARKING XXX
This was added when we were setting the cow-block-size to 1M. However
since commit 351d61f768 ("input: -it vddk: Reduce cow-block-size to 4K")
we stopped doing that so this is no longer needed.
Reverts: commit 08e764959ec9dadd71a95d22d3d88d647a18d165
---
v2v/v2v.ml | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 1db0c233..47e6e937 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -587,17 +587,7 @@ read the man page virt-v2v(1).
nbdinfo ~content:false output_uri
);
- (* At the moment, unconditionally set nbdcopy --request-size
- * to 4M (up from the default of 256K). With nbdkit + vddk +
- * cow + cow-block-size=1M this is necessary because requests
- * must be larger than the cow filter block size to avoid
- * breaking up reads. It probably doesn't affect other
- * modes, but in future consider setting this only for
- * specific input modes that adjust cow-block-size.
- *)
- let request_size = Some (4*1024*1024) in
-
- nbdcopy ?request_size output_alloc input_uri output_uri
+ nbdcopy output_alloc input_uri output_uri
) disks;
(* End of copying phase. *)
@@ -616,17 +606,13 @@ read the man page virt-v2v(1).
*)
with_open_out (tmpdir // "done") (fun _ -> ())
-and nbdcopy ?request_size output_alloc input_uri output_uri =
+and nbdcopy output_alloc input_uri output_uri =
(* XXX It's possible that some output modes know whether
* --target-is-zero which would be a useful optimization.
*)
let cmd = ref [] in
List.push_back_list cmd [ "nbdcopy"; input_uri; output_uri ];
List.push_back cmd "--flush";
- (match request_size with
- | None -> ()
- | Some size -> List.push_back cmd (sprintf "--request-size=%d" size)
- );
(*List.push_back cmd "--verbose";*)
if not (quiet ()) then List.push_back cmd "--progress";
if output_alloc = Types.Preallocated then List.push_back cmd "--allocated";
--
2.31.1

View File

@ -1,4 +1,4 @@
From 218bef64ae44c8256028ae8b53e4b6ac62e40668 Mon Sep 17 00:00:00 2001
From 1945253e1e51a48585c5d595795caba54751b250 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

View File

@ -1,4 +1,4 @@
From ab9ef03b330e4d222c69655911404c73a75796b6 Mon Sep 17 00:00:00 2001
From 0888b1586f975aa7e1eb3c99f44b2016a4fb01f0 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
@ -95,7 +95,7 @@ index c4265703..822e4c72 100644
let output_storage =
match options.output_storage with
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index a2414598..5bbcc9e9 100644
index 47e6e937..503dfb55 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -277,8 +277,6 @@ let rec main () =

View File

@ -1,4 +1,4 @@
From 4e0eb0a0ea5d888c5074c04e4c1ffdd1efffc070 Mon Sep 17 00:00:00 2001
From fb4b10147dad17d7d530741884b01841f7e8c47d 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

View File

@ -1,4 +1,4 @@
From fb1a9d9c2070397209c938d207e4995725797d0c Mon Sep 17 00:00:00 2001
From f48329ef521f909ba8f480cd04c03b3b69acbd97 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.

View File

@ -1,4 +1,4 @@
From da2dbc6437368a25553616097b57120b88da425e Mon Sep 17 00:00:00 2001
From 86e3b39167e3dc050c36d4bcc39fc748041f9d2c 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)

View File

@ -1,4 +1,4 @@
From ac212c850b8f6f926f7fce4d6f9cd326524440f4 Mon Sep 17 00:00:00 2001
From 9377a144e20aba2b8b31d5d0cb169299d50678b2 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Wed, 8 Mar 2017 11:03:40 +0100
Subject: [PATCH] RHEL: v2v: do not mention SUSE Xen hosts (RHBZ#1430203)

View File

@ -1,4 +1,4 @@
From 3fe67ae802e810910350e6b77647f2573b8d41d5 Mon Sep 17 00:00:00 2001
From 078a21ee965b6b8f092161ab11bf09ecf5ab2788 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

View File

@ -1,4 +1,4 @@
From 854aeda3efc4befaec21a7854e2ce02e30d34b92 Mon Sep 17 00:00:00 2001
From 6819cc91b463ac9e480b90ce4cd0f5c20e261b1c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Wed, 30 Jun 2021 11:15:52 +0100
Subject: [PATCH] RHEL: Disable -o glance
@ -169,7 +169,7 @@ index c0db9115..074b5e16 100755
set -e
set -x
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 5bbcc9e9..335c3171 100644
index 503dfb55..39fef0fa 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -205,7 +205,6 @@ let rec main () =

View File

@ -1,4 +1,4 @@
From 43e0bcece9e257e7ca55cefa34aba856918b629d Mon Sep 17 00:00:00 2001
From c9e36c617bd4e035b261e09637e40b77f3ff4d46 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 2 Dec 2021 11:56:05 +0000
Subject: [PATCH] RHEL: Remove the --in-place option
@ -101,7 +101,7 @@ index 7c101513..4f89d2b2 100644
The I<--machine-readable> option can be used to make the output more
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index 335c3171..89e432c3 100644
index 39fef0fa..a1143b68 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -183,7 +183,6 @@ let rec main () =

View File

@ -15,7 +15,7 @@
Name: virt-v2v
Epoch: 1
Version: 1.45.95
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -51,15 +51,19 @@ ExclusiveArch: x86_64
# Downstream (RHEL-only) patches.
%if 0%{?rhel}
# Patches.
Patch0001: 0001-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0002: 0002-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0003: 0003-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0004: 0004-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0005: 0005-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0006: 0006-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0007: 0007-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0008: 0008-RHEL-Disable-o-glance.patch
Patch0009: 0009-RHEL-Remove-the-in-place-option.patch
Patch0001: 0001-input-output-Use-Option.may-for-some-Nbdkit-calls.patch
Patch0002: 0002-input-nbdkit_curl.ml-Fix-typo-in-commented-code.patch
Patch0003: 0003-v2v-Swap-over-the-output-and-conversion-stages.patch
Patch0004: 0004-XXX-v2v-Remove-nbdcopy-request-size-4M-flag.patch
Patch0005: 0005-RHEL-v2v-Select-correct-qemu-binary-for-o-qemu-mode-.patch
Patch0006: 0006-RHEL-v2v-Disable-the-qemu-boot-oo-qemu-boot-option-R.patch
Patch0007: 0007-RHEL-Fix-list-of-supported-sound-cards-to-match-RHEL.patch
Patch0008: 0008-RHEL-Fixes-for-libguestfs-winsupport.patch
Patch0009: 0009-RHEL-v2v-i-disk-force-VNC-as-display-RHBZ-1372671.patch
Patch0010: 0010-RHEL-v2v-do-not-mention-SUSE-Xen-hosts-RHBZ-1430203.patch
Patch0011: 0011-RHEL-point-to-KB-for-supported-v2v-hypervisors-guest.patch
Patch0012: 0012-RHEL-Disable-o-glance.patch
Patch0013: 0013-RHEL-Remove-the-in-place-option.patch
%endif
%if 0%{patches_touch_autotools}
@ -300,7 +304,7 @@ popd
%changelog
* Sat Dec 18 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.45.95-1
* Sat Dec 18 2021 Richard W.M. Jones <rjones@redhat.com> - 1:1.45.95-2
- Rebase to upstream 1.45.95.
- Change video type to VGA (instead of QXL).
- Remove --in-place support properly.