mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
v2v: Be careful to send all debug messages to stderr.
The debug() function is already sending these to stderr, but in a few places we were using printf. Change those to eprintf, except for one informational message which should have been using info().
This commit is contained in:
@@ -254,11 +254,11 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
|
||||
) inspect.i_apps in
|
||||
|
||||
if verbose () then (
|
||||
printf "installed kernel packages in this guest:\n";
|
||||
eprintf "installed kernel packages in this guest:\n";
|
||||
List.iter (
|
||||
fun kernel -> printf "\t%s\n" (string_of_kernel_info kernel)
|
||||
fun kernel -> eprintf "\t%s\n" (string_of_kernel_info kernel)
|
||||
) installed_kernels;
|
||||
flush stdout
|
||||
flush stderr
|
||||
);
|
||||
|
||||
if installed_kernels = [] then
|
||||
@@ -374,11 +374,11 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
|
||||
) vmlinuzes in
|
||||
|
||||
if verbose () then (
|
||||
printf "grub kernels in this guest (first in list is default):\n";
|
||||
eprintf "grub kernels in this guest (first in list is default):\n";
|
||||
List.iter (
|
||||
fun kernel -> printf "\t%s\n" (string_of_kernel_info kernel)
|
||||
fun kernel -> eprintf "\t%s\n" (string_of_kernel_info kernel)
|
||||
) grub_kernels;
|
||||
flush stdout
|
||||
flush stderr
|
||||
);
|
||||
|
||||
if grub_kernels = [] then
|
||||
@@ -1301,12 +1301,12 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
|
||||
) source.s_disks in
|
||||
|
||||
if verbose () then (
|
||||
printf "block device map:\n";
|
||||
eprintf "block device map:\n";
|
||||
List.iter (
|
||||
fun (source_dev, target_dev) ->
|
||||
printf "\t%s\t-> %s\n" source_dev target_dev
|
||||
eprintf "\t%s\t-> %s\n" source_dev target_dev
|
||||
) (List.sort (fun (a,_) (b,_) -> compare a b) map);
|
||||
flush stdout
|
||||
flush stderr
|
||||
);
|
||||
|
||||
(* Possible Augeas paths to search for device names. *)
|
||||
|
||||
12
v2v/linux.ml
12
v2v/linux.ml
@@ -72,28 +72,28 @@ and augeas_debug_errors g =
|
||||
|
||||
List.iter (
|
||||
fun filename ->
|
||||
printf "augeas failed to parse %s:\n" filename;
|
||||
eprintf "augeas failed to parse %s:\n" filename;
|
||||
let fmap = StringMap.find filename map in
|
||||
(try
|
||||
let msg = StringMap.find "message" fmap in
|
||||
printf " error \"%s\"" msg
|
||||
eprintf " error \"%s\"" msg
|
||||
with Not_found -> ()
|
||||
);
|
||||
(try
|
||||
let line = StringMap.find "line" fmap
|
||||
and char = StringMap.find "char" fmap in
|
||||
printf " at line %s char %s" line char
|
||||
eprintf " at line %s char %s" line char
|
||||
with Not_found -> ()
|
||||
);
|
||||
(try
|
||||
let lens = StringMap.find "lens" fmap in
|
||||
printf " in lens %s" lens
|
||||
eprintf " in lens %s" lens
|
||||
with Not_found -> ()
|
||||
);
|
||||
printf "\n"
|
||||
eprintf "\n"
|
||||
) filenames;
|
||||
|
||||
flush stdout
|
||||
flush stderr
|
||||
with
|
||||
Guestfs.Error msg -> eprintf "%s: augeas: %s (ignored)\n" prog msg
|
||||
|
||||
|
||||
@@ -127,11 +127,11 @@ object
|
||||
if run_command cmd <> 0 then (
|
||||
warning (f_"glance: failed to set image properties (ignored)");
|
||||
(* Dump out the image properties so the user can set them. *)
|
||||
printf "Image properties:\n";
|
||||
printf " --min-ram %Ld\n" min_ram;
|
||||
eprintf "Image properties:\n";
|
||||
eprintf " --min-ram %Ld\n" min_ram;
|
||||
List.iter (
|
||||
fun (k, v) ->
|
||||
printf " --property %s=%s" (quote k) (quote v)
|
||||
eprintf " --property %s=%s" (quote k) (quote v)
|
||||
) properties
|
||||
)
|
||||
) targets
|
||||
|
||||
18
v2v/v2v.ml
18
v2v/v2v.ml
@@ -322,8 +322,8 @@ and get_mpstats g =
|
||||
|
||||
if verbose () then (
|
||||
(* This is useful for debugging speed / fstrim issues. *)
|
||||
printf "mpstats:\n";
|
||||
List.iter (print_mpstat Pervasives.stdout) mpstats
|
||||
eprintf "mpstats:\n";
|
||||
List.iter (print_mpstat Pervasives.stderr) mpstats
|
||||
);
|
||||
|
||||
mpstats
|
||||
@@ -654,14 +654,14 @@ and copy_targets cmdline targets input output =
|
||||
Int64.to_float size /. 1024. /. 1024. *. 10. /. time
|
||||
in
|
||||
|
||||
printf "virtual copying rate: %.1f M bits/sec\n%!"
|
||||
eprintf "virtual copying rate: %.1f M bits/sec\n%!"
|
||||
(mbps t.target_overlay.ov_virtual_size elapsed_time);
|
||||
|
||||
match t.target_actual_size with
|
||||
| None -> ()
|
||||
| Some actual ->
|
||||
printf "real copying rate: %.1f M bits/sec\n%!"
|
||||
(mbps actual elapsed_time)
|
||||
eprintf "real copying rate: %.1f M bits/sec\n%!"
|
||||
(mbps actual elapsed_time)
|
||||
);
|
||||
|
||||
(* If verbose, find out how close the estimate was. This is
|
||||
@@ -675,13 +675,13 @@ and copy_targets cmdline targets input output =
|
||||
let pc =
|
||||
100. *. Int64.to_float estimate /. Int64.to_float actual
|
||||
-. 100. in
|
||||
printf "%s: estimate %Ld (%s) versus actual %Ld (%s): %.1f%%"
|
||||
eprintf "%s: estimate %Ld (%s) versus actual %Ld (%s): %.1f%%"
|
||||
t.target_overlay.ov_sd
|
||||
estimate (human_size estimate)
|
||||
actual (human_size actual)
|
||||
pc;
|
||||
if pc < 0. then printf " ! ESTIMATE TOO LOW !";
|
||||
printf "\n%!";
|
||||
if pc < 0. then eprintf " ! ESTIMATE TOO LOW !";
|
||||
eprintf "\n%!";
|
||||
);
|
||||
|
||||
t
|
||||
@@ -703,7 +703,7 @@ and preserve_overlays overlays src_name =
|
||||
let saved_filename =
|
||||
sprintf "%s/%s-%s.qcow2" overlay_dir src_name ov.ov_sd in
|
||||
rename ov.ov_overlay_file saved_filename;
|
||||
printf (f_"Overlay saved as %s [--debug-overlays]\n") saved_filename
|
||||
info (f_"Overlay saved as %s [--debug-overlays]") saved_filename
|
||||
) overlays
|
||||
|
||||
(* Request guest caps based on source configuration. *)
|
||||
|
||||
Reference in New Issue
Block a user