Pick the nbdcopy --requests parameter to target an implicit buffer
size of 64M inside nbdcopy. However don't set nbdcopy --request < 64.
If request_size == 256K (the default) => requests = 256
If request_size == 8M => requests = 64 (buffer size 512M)
---
v2v/v2v.ml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index cadf864d5c..7bd47c1e7e 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -641,14 +641,27 @@ and nbdcopy ?request_size output_alloc input_uri output_uri =
*)
let cmd = ref [] in
List.push_back_list cmd [ "nbdcopy"; input_uri; output_uri ];
+
(match request_size with
| None -> ()
| Some size -> List.push_back cmd (sprintf "--request-size=%d" size)
);
+ (* Choose max requests to target an implicit buffer size of 64M. *)
+ let requests =
+ let target_buffer_size = 64 * 1024 * 1024 in
+ let request_size =
+ match request_size with
+ | None -> 256 * 1024 (* default in nbdcopy 1.10+ *)
+ | Some size -> size in
+ min 64 (target_buffer_size / request_size) in
+ List.push_back cmd (sprintf "--requests=%d" requests);
+
List.push_back cmd "--flush";
(*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";
+
let cmd = !cmd in
if run_command cmd <> 0 then
--
2.35.1