virt-v2v/0001-input-output-Use-Option.may-for-some-Nbdkit-calls.patch
Richard W.M. Jones 8190ec8540 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
2021-12-18 13:51:11 +00:00

73 lines
2.6 KiB
Diff

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