Skip to content

Commit

Permalink
v2v: nbdkit: Reduce message verbosity and log sizes (RHBZ#1782853).
Browse files Browse the repository at this point in the history
nbdkit >= 1.17.4 supports the -D nbdkit.backend.datapath=0 and
-D vddk.datapath=0 debug flags which suppress ordinary data path
messages (for things like pread operations).  This can be used to
greatly reduce log sizes.
  • Loading branch information
rwmjones committed Feb 19, 2020
1 parent 62656a9 commit 74a69a1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
6 changes: 6 additions & 0 deletions v2v/nbdkit.ml
Expand Up @@ -134,6 +134,12 @@ let run_unix cmd =
add_arg "--pidfile"; add_arg pidfile;
add_arg "--unix"; add_arg sock;

(* Reduce verbosity in nbdkit >= 1.17.4. *)
let version = version (config ()) in
if version >= (1, 17, 4) then (
add_arg "-D"; add_arg "nbdkit.backend.datapath=0"
);

List.iter (
fun (name, value) ->
add_arg "-D"; add_arg (sprintf "%s=%s" name value)
Expand Down
16 changes: 14 additions & 2 deletions v2v/nbdkit_sources.ml
Expand Up @@ -58,7 +58,7 @@ let error_unless_nbdkit_compiled_with_selinux config =
error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.")
)

let common_create ?bandwidth ?extra_env plugin_name plugin_args =
let common_create ?bandwidth ?extra_debug ?extra_env plugin_name plugin_args =
error_unless_nbdkit_working ();
let config = Nbdkit.config () in
error_unless_nbdkit_min_version config;
Expand All @@ -75,6 +75,13 @@ let common_create ?bandwidth ?extra_env plugin_name plugin_args =
| None -> cmd
| Some (name, value) -> Nbdkit.add_env cmd name value in

(* Debug flags. *)
let cmd =
match extra_debug with
| None -> cmd
| Some (n, v) -> Nbdkit.add_debug_flag cmd n v in

(* Other flags. *)
let cmd = Nbdkit.set_verbose cmd (verbose ()) in
let cmd = Nbdkit.set_readonly cmd true in (* important! readonly mode *)
let cmd = Nbdkit.set_exportname cmd "/" in
Expand Down Expand Up @@ -236,7 +243,12 @@ See also the virt-v2v-input-vmware(1) manual.") libNN
add_arg ("thumbprint", thumbprint);
Option.may (fun s -> add_arg ("transports", s)) transports;

common_create ?bandwidth ?extra_env:env "vddk" (get_args ())
(* If nbdkit >= 1.17.10 then we can suppress datapath messages. *)
let debug_flag =
if version >= (1, 17, 10) then Some ("vddk.datapath", "0") else None in

common_create ?bandwidth ?extra_debug:debug_flag ?extra_env:env
"vddk" (get_args ())

(* Create an nbdkit module specialized for reading from SSH sources. *)
let create_ssh ?bandwidth ~password ?port ~server ?user path =
Expand Down

0 comments on commit 74a69a1

Please sign in to comment.