[Pkg-libvirt-commits] [libguestfs] 12/17: ocaml tools: Use global variable to store quiet (--quiet) flag.
Hilko Bengen
bengen at moszumanska.debian.org
Sun Nov 1 17:12:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag upstream/1.29.43
in repository libguestfs.
commit 59228c39b1a4a6cf89fc767075415a5b6ed1ec86
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Fri May 15 10:31:26 2015 +0100
ocaml tools: Use global variable to store quiet (--quiet) flag.
Don't pass this flag to dozens of functions.
This change is analogous to the change made in
commit 79fc6074a7e60b4b59efca7d5d58bb2a6768e4bb for the -v & -x flags.
---
builder/builder.ml | 35 ++++++-------
builder/cmdline.ml | 7 +--
customize/customize_main.ml | 14 ++---
customize/customize_run.ml | 61 ++++++++++------------
customize/customize_run.mli | 2 +-
mllib/common_utils.ml | 39 ++++++++------
mllib/common_utils.mli | 13 +++--
resize/resize.ml | 33 +++++-------
sparsify/cmdline.ml | 9 ++--
sparsify/copying.ml | 27 +++++-----
sparsify/in_place.ml | 18 +++----
sparsify/sparsify.ml | 7 ++-
sysprep/main.ml | 17 +++---
sysprep/sysprep_operation.ml | 18 +++----
sysprep/sysprep_operation.mli | 8 +--
sysprep/sysprep_operation_abrt_data.ml | 2 +-
sysprep/sysprep_operation_bash_history.ml | 2 +-
sysprep/sysprep_operation_blkid_tab.ml | 2 +-
sysprep/sysprep_operation_ca_certificates.ml | 2 +-
sysprep/sysprep_operation_crash_data.ml | 2 +-
sysprep/sysprep_operation_cron_spool.ml | 2 +-
sysprep/sysprep_operation_customize.ml | 4 +-
sysprep/sysprep_operation_dhcp_client_state.ml | 2 +-
sysprep/sysprep_operation_dhcp_server_state.ml | 2 +-
sysprep/sysprep_operation_dovecot_data.ml | 2 +-
sysprep/sysprep_operation_firewall_rules.ml | 2 +-
sysprep/sysprep_operation_flag_reconfiguration.ml | 2 +-
sysprep/sysprep_operation_fs_uuids.ml | 2 +-
sysprep/sysprep_operation_kerberos_data.ml | 2 +-
sysprep/sysprep_operation_logfiles.ml | 2 +-
sysprep/sysprep_operation_lvm_uuids.ml | 2 +-
sysprep/sysprep_operation_machine_id.ml | 2 +-
sysprep/sysprep_operation_mail_spool.ml | 2 +-
sysprep/sysprep_operation_net_hostname.ml | 2 +-
sysprep/sysprep_operation_net_hwaddr.ml | 2 +-
sysprep/sysprep_operation_pacct_log.ml | 2 +-
sysprep/sysprep_operation_package_manager_cache.ml | 2 +-
sysprep/sysprep_operation_pam_data.ml | 2 +-
sysprep/sysprep_operation_puppet_data_log.ml | 2 +-
.../sysprep_operation_rh_subscription_manager.ml | 2 +-
sysprep/sysprep_operation_rhn_systemid.ml | 2 +-
sysprep/sysprep_operation_rpm_db.ml | 2 +-
sysprep/sysprep_operation_samba_db_log.ml | 2 +-
sysprep/sysprep_operation_script.ml | 2 +-
sysprep/sysprep_operation_smolt_uuid.ml | 2 +-
sysprep/sysprep_operation_ssh_hostkeys.ml | 2 +-
sysprep/sysprep_operation_ssh_userdir.ml | 2 +-
sysprep/sysprep_operation_sssd_db_log.ml | 2 +-
sysprep/sysprep_operation_tmp_files.ml | 2 +-
sysprep/sysprep_operation_udev_persistent_net.ml | 2 +-
sysprep/sysprep_operation_user_account.ml | 2 +-
sysprep/sysprep_operation_utmp.ml | 2 +-
sysprep/sysprep_operation_yum_uuid.ml | 2 +-
v2v/cmdline.ml | 8 ++-
v2v/v2v.ml | 37 ++++++-------
55 files changed, 202 insertions(+), 229 deletions(-)
diff --git a/builder/builder.ml b/builder/builder.ml
index 663aeef..3d39005 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -73,12 +73,9 @@ let main () =
let mode, arg,
arch, attach, cache, check_signature, curl,
delete_on_failure, format, gpg, list_format, memsize,
- network, ops, output, quiet, size, smp, sources, sync =
+ network, ops, output, size, smp, sources, sync =
parse_cmdline () in
- (* Timestamped messages in ordinary, non-debug non-quiet mode. *)
- let msg fs = make_message_function ~quiet fs in
-
(* If debugging, echo the command line arguments and the sources. *)
if verbose () then (
printf "command line:";
@@ -100,7 +97,7 @@ let main () =
| `Delete_cache -> (* --delete-cache *)
(match cache with
| Some cachedir ->
- msg "Deleting: %s" cachedir;
+ message "Deleting: %s" cachedir;
Cache.clean_cachedir cachedir;
exit 0
| None ->
@@ -201,8 +198,8 @@ let main () =
{ Index_parser.revision = revision; file_uri = file_uri;
proxy = proxy }) ->
let template = name, arch, revision in
- msg (f_"Downloading: %s") file_uri;
- let progress_bar = not quiet in
+ message (f_"Downloading: %s") file_uri;
+ let progress_bar = not (quiet ()) in
ignore (Downloader.download downloader ~template ~progress_bar
~proxy file_uri)
) index;
@@ -259,8 +256,8 @@ let main () =
let { Index_parser.revision = revision; file_uri = file_uri;
proxy = proxy } = entry in
let template = arg, arch, revision in
- msg (f_"Downloading: %s") file_uri;
- let progress_bar = not quiet in
+ message (f_"Downloading: %s") file_uri;
+ let progress_bar = not (quiet ()) in
Downloader.download downloader ~template ~progress_bar ~proxy
file_uri in
if delete_on_exit then unlink_on_exit template;
@@ -457,7 +454,7 @@ let main () =
in
(* Plan how to create the disk image. *)
- msg (f_"Planning how to build this image");
+ message (f_"Planning how to build this image");
let plan =
try plan ~max_depth:5 transitions itags goal
with
@@ -520,7 +517,7 @@ let main () =
| itags, `Copy, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
- msg (f_"Copying");
+ message (f_"Copying");
let cmd = sprintf "cp %s %s" (quote ifile) (quote ofile) in
if verbose () then printf "%s\n%!" cmd;
if Sys.command cmd <> 0 then exit 1
@@ -535,7 +532,7 @@ let main () =
| itags, `Pxzcat, otags ->
let ifile = List.assoc `Filename itags in
let ofile = List.assoc `Filename otags in
- msg (f_"Uncompressing");
+ message (f_"Uncompressing");
Pxzcat.pxzcat ifile ofile
| itags, `Virt_resize, otags ->
@@ -547,7 +544,7 @@ let main () =
let osize = roundup64 osize 512L in
let oformat = List.assoc `Format otags in
let { Index_parser.expand = expand; lvexpand = lvexpand } = entry in
- msg (f_"Resizing (using virt-resize) to expand the disk to %s")
+ message (f_"Resizing (using virt-resize) to expand the disk to %s")
(human_size osize);
let preallocation = if oformat = "qcow2" then Some "metadata" else None in
let () =
@@ -577,7 +574,7 @@ let main () =
let ofile = List.assoc `Filename otags in
let osize = Int64.of_string (List.assoc `Size otags) in
let osize = roundup64 osize 512L in
- msg (f_"Resizing container (but not filesystems) to expand the disk to %s")
+ message (f_"Resizing container (but not filesystems) to expand the disk to %s")
(human_size osize);
let cmd = sprintf "qemu-img resize %s %Ld%s"
(quote ofile) osize (if verbose () then "" else " >/dev/null") in
@@ -590,7 +587,7 @@ let main () =
try Some (List.assoc `Format itags) with Not_found -> None in
let ofile = List.assoc `Filename otags in
let oformat = List.assoc `Format otags in
- msg (f_"Converting %s to %s")
+ message (f_"Converting %s to %s")
(match iformat with None -> "auto" | Some f -> f) oformat;
let cmd = sprintf "qemu-img convert%s %s -O %s %s%s"
(match iformat with
@@ -603,7 +600,7 @@ let main () =
) plan;
(* Now mount the output disk so we can make changes. *)
- msg (f_"Opening the new disk");
+ message (f_"Opening the new disk");
let g =
let g = new G.guestfs () in
if trace () then g#set_trace true;
@@ -650,7 +647,7 @@ let main () =
error (f_"no guest operating systems or multiboot OS found in this disk image\nThis is a failure of the source repository. Use -v for more information.")
in
- Customize_run.run ~quiet g root ops;
+ Customize_run.run g root ops;
(* Collect some stats about the final output file.
* Notes:
@@ -658,7 +655,7 @@ let main () =
* - Never fail here.
*)
let stats =
- if not quiet then (
+ if not (quiet ()) then (
try
(* Calculate the free space (in bytes) across all mounted
* filesystems in the guest.
@@ -692,7 +689,7 @@ let main () =
else None in
(* Unmount everything and we're done! *)
- msg (f_"Finishing off");
+ message (f_"Finishing off");
g#umount_all ();
g#shutdown ();
diff --git a/builder/cmdline.ml b/builder/cmdline.ml
index 67a279d..eca8c89 100644
--- a/builder/cmdline.ml
+++ b/builder/cmdline.ml
@@ -82,8 +82,6 @@ let parse_cmdline () =
let network = ref true in
let output = ref "" in
- let quiet = ref false in
-
let size = ref None in
let set_size arg = size := Some (parse_size arg) in
@@ -140,7 +138,7 @@ let parse_cmdline () =
"--output", Arg.Set_string output, "file" ^ " " ^ s_"Set output filename";
"--print-cache", Arg.Unit print_cache_mode,
" " ^ s_"Print info about template cache";
- "--quiet", Arg.Set quiet, " " ^ s_"No progress messages";
+ "--quiet", Arg.Unit set_quiet, " " ^ s_"No progress messages";
"--size", Arg.String set_size, "size" ^ " " ^ s_"Set output disk size";
"--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
"--source", Arg.String add_source, "URL" ^ " " ^ s_"Set source URL";
@@ -204,7 +202,6 @@ read the man page virt-builder(1).
let network = !network in
let ops = get_customize_ops () in
let output = match !output with "" -> None | s -> Some s in
- let quiet = !quiet in
let size = !size in
let smp = !smp in
let sources = List.rev !sources in
@@ -315,4 +312,4 @@ read the man page virt-builder(1).
mode, arg,
arch, attach, cache, check_signature, curl,
delete_on_failure, format, gpg, list_format, memsize,
- network, ops, output, quiet, size, smp, sources, sync
+ network, ops, output, size, smp, sources, sync
diff --git a/customize/customize_main.ml b/customize/customize_main.ml
index 9d44ce4..fa55c90 100644
--- a/customize/customize_main.ml
+++ b/customize/customize_main.ml
@@ -53,7 +53,6 @@ let main () =
let memsize = ref None in
let set_memsize arg = memsize := Some arg in
let network = ref true in
- let quiet = ref false in
let smp = ref None in
let set_smp arg = smp := Some arg in
@@ -93,8 +92,8 @@ let main () =
"--memsize", Arg.Int set_memsize, "mb" ^ " " ^ s_"Set memory size";
"--network", Arg.Set network, " " ^ s_"Enable appliance network (default)";
"--no-network", Arg.Clear network, " " ^ s_"Disable appliance network";
- "-q", Arg.Set quiet, " " ^ s_"Don't print log messages";
- "--quiet", Arg.Set quiet, " " ^ s_"Don't print log messages";
+ "-q", Arg.Unit set_quiet, " " ^ s_"Don't print log messages";
+ "--quiet", Arg.Unit set_quiet, " " ^ s_"Don't print log messages";
"--smp", Arg.Int set_smp, "vcpus" ^ " " ^ s_"Set number of vCPUs";
"-v", Arg.Unit set_verbose, " " ^ s_"Enable debugging messages";
"--verbose", Arg.Unit set_verbose, " " ^ s_"Enable debugging messages";
@@ -179,14 +178,11 @@ read the man page virt-customize(1).
let dryrun = !dryrun in
let memsize = !memsize in
let network = !network in
- let quiet = !quiet in
let smp = !smp in
let ops = get_customize_ops () in
- let msg fs = make_message_function ~quiet fs in
-
- msg (f_"Examining the guest ...");
+ message (f_"Examining the guest ...");
(* Connect to libguestfs. *)
let g =
@@ -235,13 +231,13 @@ read the man page virt-customize(1).
) mps;
(* Do the customization. *)
- Customize_run.run ~quiet g root ops;
+ Customize_run.run g root ops;
g#umount_all ();
) roots;
);
- msg (f_"Finishing off");
+ message (f_"Finishing off");
g#shutdown ();
g#close ();
diff --git a/customize/customize_run.ml b/customize/customize_run.ml
index e44f198..5a7e209 100644
--- a/customize/customize_run.ml
+++ b/customize/customize_run.ml
@@ -26,10 +26,7 @@ open Customize_utils
open Customize_cmdline
open Password
-let run ~quiet (g : Guestfs.guestfs) root (ops : ops) =
- (* Timestamped messages in ordinary, non-debug non-quiet mode. *)
- let msg fs = make_message_function ~quiet fs in
-
+let run (g : Guestfs.guestfs) root (ops : ops) =
(* Is the host_cpu compatible with the guest arch? ie. Can we
* run commands in this guest?
*)
@@ -149,7 +146,7 @@ exec >>%s 2>&1
in
(* Set the random seed. *)
- msg (f_"Setting a random seed");
+ message (f_"Setting a random seed");
if not (Random_seed.set_random_seed g root) then
warning (f_"random seed could not be set for this type of guest");
@@ -165,7 +162,7 @@ exec >>%s 2>&1
List.iter (
function
| `Chmod (mode, path) ->
- msg (f_"Changing permissions of %s to %s") path mode;
+ message (f_"Changing permissions of %s to %s") path mode;
(* If the mode string is octal, add the OCaml prefix for octal values
* so it is properly converted as octal integer.
*)
@@ -173,7 +170,7 @@ exec >>%s 2>&1
g#chmod (int_of_string mode) path
| `Command cmd ->
- msg (f_"Running: %s") cmd;
+ message (f_"Running: %s") cmd;
do_run ~display:cmd cmd
| `CommandsFromFile _ ->
@@ -182,19 +179,19 @@ exec >>%s 2>&1
()
| `Copy (src, dest) ->
- msg (f_"Copying (in image): %s to %s") src dest;
+ message (f_"Copying (in image): %s to %s") src dest;
g#cp_a src dest
| `CopyIn (localpath, remotedir) ->
- msg (f_"Copying: %s to %s") localpath remotedir;
+ message (f_"Copying: %s to %s") localpath remotedir;
g#copy_in localpath remotedir
| `Delete path ->
- msg (f_"Deleting: %s") path;
+ message (f_"Deleting: %s") path;
g#rm_rf path
| `Edit (path, expr) ->
- msg (f_"Editing: %s") path;
+ message (f_"Editing: %s") path;
if not (g#is_file path) then
error (f_"%s is not a regular file in the guest") path;
@@ -202,44 +199,44 @@ exec >>%s 2>&1
Perl_edit.edit_file g#ocaml_handle path expr
| `FirstbootCommand cmd ->
- msg (f_"Installing firstboot command: %s") cmd;
+ message (f_"Installing firstboot command: %s") cmd;
Firstboot.add_firstboot_script g root cmd cmd
| `FirstbootPackages pkgs ->
- msg (f_"Installing firstboot packages: %s")
+ message (f_"Installing firstboot packages: %s")
(String.concat " " pkgs);
let cmd = guest_install_command pkgs in
let name = String.concat " " ("install" :: pkgs) in
Firstboot.add_firstboot_script g root name cmd
| `FirstbootScript script ->
- msg (f_"Installing firstboot script: %s") script;
+ message (f_"Installing firstboot script: %s") script;
let cmd = read_whole_file script in
Firstboot.add_firstboot_script g root script cmd
| `Hostname hostname ->
- msg (f_"Setting the hostname: %s") hostname;
+ message (f_"Setting the hostname: %s") hostname;
if not (Hostname.set_hostname g root hostname) then
warning (f_"hostname could not be set for this type of guest")
| `InstallPackages pkgs ->
- msg (f_"Installing packages: %s") (String.concat " " pkgs);
+ message (f_"Installing packages: %s") (String.concat " " pkgs);
let cmd = guest_install_command pkgs in
do_run ~display:cmd cmd
| `Link (target, links) ->
List.iter (
fun link ->
- msg (f_"Linking: %s -> %s") link target;
+ message (f_"Linking: %s -> %s") link target;
g#ln_sf target link
) links
| `Mkdir dir ->
- msg (f_"Making directory: %s") dir;
+ message (f_"Making directory: %s") dir;
g#mkdir_p dir
| `Move (src, dest) ->
- msg (f_"Moving: %s -> %s") src dest;
+ message (f_"Moving: %s -> %s") src dest;
g#mv src dest
| `Password (user, pw) ->
@@ -249,46 +246,46 @@ exec >>%s 2>&1
set_password "root" pw
| `Script script ->
- msg (f_"Running: %s") script;
+ message (f_"Running: %s") script;
let cmd = read_whole_file script in
do_run ~display:script cmd
| `Scrub path ->
- msg (f_"Scrubbing: %s") path;
+ message (f_"Scrubbing: %s") path;
g#scrub_file path
| `SSHInject (user, selector) ->
(match g#inspect_get_type root with
| "linux" | "freebsd" | "netbsd" | "openbsd" | "hurd" ->
- msg (f_"SSH key inject: %s") user;
+ message (f_"SSH key inject: %s") user;
Ssh_key.do_ssh_inject_unix g user selector
| _ ->
warning (f_"SSH key could be injected for this type of guest"))
| `Truncate path ->
- msg (f_"Truncating: %s") path;
+ message (f_"Truncating: %s") path;
g#truncate path
| `TruncateRecursive path ->
- msg (f_"Recursively truncating: %s") path;
+ message (f_"Recursively truncating: %s") path;
truncate_recursive g path
| `Timezone tz ->
- msg (f_"Setting the timezone: %s") tz;
+ message (f_"Setting the timezone: %s") tz;
if not (Timezone.set_timezone g root tz) then
warning (f_"timezone could not be set for this type of guest")
| `Touch path ->
- msg (f_"Running touch: %s") path;
+ message (f_"Running touch: %s") path;
g#touch path
| `Update ->
- msg (f_"Updating core packages");
+ message (f_"Updating core packages");
let cmd = guest_update_command () in
do_run ~display:cmd cmd
| `Upload (path, dest) ->
- msg (f_"Uploading: %s to %s") path dest;
+ message (f_"Uploading: %s to %s") path dest;
let dest =
if g#is_dir ~followsymlinks:true dest then
dest ^ "/" ^ Filename.basename path
@@ -313,7 +310,7 @@ exec >>%s 2>&1
chown ()
| `Write (path, content) ->
- msg (f_"Writing: %s") path;
+ message (f_"Writing: %s") path;
g#write path content
) ops.ops;
@@ -321,7 +318,7 @@ exec >>%s 2>&1
if Hashtbl.length passwords > 0 then (
match g#inspect_get_type root with
| "linux" ->
- msg (f_"Setting passwords");
+ message (f_"Setting passwords");
let password_crypto = ops.flags.password_crypto in
set_linux_passwords ?password_crypto g root passwords
@@ -330,7 +327,7 @@ exec >>%s 2>&1
);
if ops.flags.selinux_relabel then (
- msg (f_"SELinux relabelling");
+ message (f_"SELinux relabelling");
if guest_arch_compatible then (
let cmd = sprintf "
if load_policy && fixfiles restore; then
@@ -353,7 +350,7 @@ exec >>%s 2>&1
*)
if verbose () then debug_logfile ();
if ops.flags.scrub_logfile && g#exists logfile then (
- msg (f_"Scrubbing the log file");
+ message (f_"Scrubbing the log file");
(* Try various methods with decreasing complexity. *)
try g#scrub_file logfile
diff --git a/customize/customize_run.mli b/customize/customize_run.mli
index c330f9f..854119a 100644
--- a/customize/customize_run.mli
+++ b/customize/customize_run.mli
@@ -23,4 +23,4 @@
* filesystems must be mounted up.
*)
-val run : quiet:bool -> Guestfs.guestfs -> string -> Customize_cmdline.ops -> unit
+val run : Guestfs.guestfs -> string -> Customize_cmdline.ops -> unit
diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
index d61335b..8dcd41f 100644
--- a/mllib/common_utils.ml
+++ b/mllib/common_utils.ml
@@ -261,13 +261,31 @@ let ansi_magenta ?(chan = stdout) () =
let ansi_restore ?(chan = stdout) () =
if istty chan then output_string chan "\x1b[0m"
+(* Program name. *)
+let prog = Filename.basename Sys.executable_name
+
+(* Stores the quiet (--quiet), trace (-x) and verbose (-v) flags in a
+ * global variable.
+ *)
+let quiet = ref false
+let set_quiet () = quiet := true
+let quiet () = !quiet
+
+let trace = ref false
+let set_trace () = trace := true
+let trace () = !trace
+
+let verbose = ref false
+let set_verbose () = verbose := true
+let verbose () = !verbose
+
(* Timestamped progress messages, used for ordinary messages when not
* --quiet.
*)
let start_t = Unix.time ()
-let make_message_function ~quiet fs =
- let p str =
- if not quiet then (
+let message fs =
+ let display str =
+ if not (quiet ()) then (
let t = sprintf "%.1f" (Unix.time () -. start_t) in
printf "[%6s] " t;
ansi_green ();
@@ -276,20 +294,7 @@ let make_message_function ~quiet fs =
print_newline ()
)
in
- ksprintf p fs
-
-
-(* Program name. *)
-let prog = Filename.basename Sys.executable_name
-
-(* Stores the trace (-x) and verbose (-v) flags in a global variable. *)
-let trace = ref false
-let set_trace () = trace := true
-let trace () = !trace
-
-let verbose = ref false
-let set_verbose () = verbose := true
-let verbose () = !verbose
+ ksprintf display fs
(* Error messages etc. *)
let error ?(exit_code = 1) fs =
diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
index ff00218..228ed9a 100644
--- a/mllib/common_utils.mli
+++ b/mllib/common_utils.mli
@@ -62,18 +62,21 @@ val assoc : ?cmp:('a -> 'a -> int) -> default:'b -> 'a -> ('a * 'b) list -> 'b
(** Like {!List.assoc} but with a user-defined comparison function, and
instead of raising [Not_found], it returns the [~default] value. *)
-val make_message_function : quiet:bool -> ('a, unit, string, unit) format4 -> 'a
-(** Timestamped progress messages. Used for ordinary messages when
- not [--quiet]. *)
-
val prog : string
(** The program name (derived from {!Sys.executable_name}). *)
+val set_quiet : unit -> unit
+val quiet : unit -> bool
val set_trace : unit -> unit
val trace : unit -> bool
val set_verbose : unit -> unit
val verbose : unit -> bool
-(** Stores the trace ([-x]) and verbose ([-v]) flags in a global variable. *)
+(** Stores the quiet ([--quiet]), trace ([-x]) and verbose ([-v]) flags in a
+ global variable. *)
+
+val message : ('a, unit, string, unit) format4 -> 'a
+(** Timestamped progress messages. Used for ordinary messages when
+ not [--quiet]. *)
val error : ?exit_code:int -> ('a, unit, string, 'b) format4 -> 'a
(** Standard error function. *)
diff --git a/resize/resize.ml b/resize/resize.ml
index b3185a3..4e58e84 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -154,7 +154,7 @@ let main () =
debug_gc, deletes,
dryrun, expand, expand_content, extra_partition, format, ignores,
lv_expands, machine_readable, ntfsresize_force, output_format,
- quiet, resizes, resizes_force, shrink, sparse =
+ resizes, resizes_force, shrink, sparse =
let add xs s = xs := s :: !xs in
@@ -178,7 +178,6 @@ let main () =
let machine_readable = ref false in
let ntfsresize_force = ref false in
let output_format = ref "" in
- let quiet = ref false in
let resizes = ref [] in
let resizes_force = ref [] in
let shrink = ref "" in
@@ -215,8 +214,8 @@ let main () =
"--dry-run", Arg.Set dryrun, ditto;
"--ntfsresize-force", Arg.Set ntfsresize_force, " " ^ s_"Force ntfsresize";
"--output-format", Arg.Set_string output_format, s_"format" ^ " " ^ s_"Format of output disk";
- "-q", Arg.Set quiet, " " ^ s_"Don't print the summary";
- "--quiet", Arg.Set quiet, ditto;
+ "-q", Arg.Unit set_quiet, " " ^ s_"Don't print the summary";
+ "--quiet", Arg.Unit set_quiet, ditto;
"--resize", Arg.String (add resizes), s_"part=size" ^ " " ^ s_"Resize partition";
"--resize-force", Arg.String (add resizes_force), s_"part=size" ^ " " ^ s_"Forcefully resize partition";
"--shrink", Arg.String set_shrink, s_"part" ^ " " ^ s_"Shrink partition";
@@ -262,7 +261,6 @@ read the man page virt-resize(1).
let machine_readable = !machine_readable in
let ntfsresize_force = !ntfsresize_force in
let output_format = match !output_format with "" -> None | str -> Some str in
- let quiet = !quiet in
let resizes = List.rev !resizes in
let resizes_force = List.rev !resizes_force in
let shrink = match !shrink with "" -> None | str -> Some str in
@@ -329,10 +327,7 @@ read the man page virt-resize(1).
debug_gc, deletes,
dryrun, expand, expand_content, extra_partition, format, ignores,
lv_expands, machine_readable, ntfsresize_force, output_format,
- quiet, resizes, resizes_force, shrink, sparse in
-
- (* Timestamped messages. *)
- let msg fs = make_message_function ~quiet fs in
+ resizes, resizes_force, shrink, sparse in
(* Default to true, since NTFS/btrfs/XFS support are usually available. *)
let ntfs_available = ref true in
@@ -351,7 +346,7 @@ read the man page virt-resize(1).
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive ?format:output_format ~readonly:false ~cachemode:"unsafe"
outfile;
- if not quiet then Progress.set_up_progress_bar ~machine_readable g;
+ if not (quiet ()) then Progress.set_up_progress_bar ~machine_readable g;
g#launch ();
(* Set the filter to /dev/sda, in case there are any rogue
@@ -368,7 +363,7 @@ read the man page virt-resize(1).
in
let g =
- msg (f_"Examining %s") (fst infile);
+ message (f_"Examining %s") (fst infile);
let g = connect_both_disks () in
g in
@@ -845,7 +840,7 @@ read the man page virt-resize(1).
(* Print a summary of what we will do. *)
flush stderr;
- if not quiet then (
+ if not (quiet ()) then (
printf "**********\n\n";
printf "Summary of changes:\n\n";
@@ -934,7 +929,7 @@ read the man page virt-resize(1).
(* Try hard to initialize the partition table. This might involve
* relaunching another handle.
*)
- msg (f_"Setting up initial partition table on %s") outfile;
+ message (f_"Setting up initial partition table on %s") outfile;
let last_error = ref "" in
let rec initialize_partition_table g attempts =
@@ -1153,7 +1148,7 @@ read the man page virt-resize(1).
let source = p.p_name in
let target = sprintf "/dev/sdb%d" p.p_target_partnum in
- msg (f_"Copying %s") source;
+ message (f_"Copying %s") source;
(match p.p_type with
| ContentUnknown | ContentPV _ | ContentFS _ ->
@@ -1226,7 +1221,7 @@ read the man page virt-resize(1).
if magic <> "NTFS " then
warning (f_"first partition is NTFS but does not contain NTFS boot loader magic")
else (
- msg (f_"Fixing first NTFS partition boot record");
+ message (f_"Fixing first NTFS partition boot record");
if verbose () then (
let old_hidden = int_of_le32 (g#pread_device target 4 0x1c_L) in
@@ -1275,7 +1270,7 @@ read the man page virt-resize(1).
(* The output disk is being created, so use cache=unsafe here. *)
g#add_drive ?format:output_format ~readonly:false ~cachemode:"unsafe"
outfile;
- if not quiet then Progress.set_up_progress_bar ~machine_readable g;
+ if not (quiet ()) then Progress.set_up_progress_bar ~machine_readable g;
g#launch ();
g (* Return new handle. *)
@@ -1308,7 +1303,7 @@ read the man page virt-resize(1).
let target = sprintf "/dev/sda%d" p.p_target_partnum in
let meth = expand_content_method p.p_type in
- msg (f_"Expanding %s%s using the '%s' method")
+ message (f_"Expanding %s%s using the '%s' method")
source
(if source <> target then sprintf " (now %s)" target else "")
(string_of_expand_content_method meth);
@@ -1327,7 +1322,7 @@ read the man page virt-resize(1).
let name = lv.lv_name in
let meth = expand_content_method lv.lv_type in
- msg (f_"Expanding %s using the '%s' method")
+ message (f_"Expanding %s using the '%s' method")
name (string_of_expand_content_method meth);
(* First expand the LV itself to maximum size. *)
@@ -1351,7 +1346,7 @@ read the man page virt-resize(1).
*)
Fsync.file outfile;
- if not quiet then (
+ if not (quiet ()) then (
print_newline ();
wrap (s_"Resize operation completed with no errors. Before deleting the old disk, carefully check that the resized disk boots and works correctly.\n");
);
diff --git a/sparsify/cmdline.ml b/sparsify/cmdline.ml
index 8e62748..fe388f8 100644
--- a/sparsify/cmdline.ml
+++ b/sparsify/cmdline.ml
@@ -52,7 +52,6 @@ let parse_cmdline () =
let in_place = ref false in
let machine_readable = ref false in
let option = ref "" in
- let quiet = ref false in
let tmp = ref "" in
let zeroes = ref [] in
@@ -70,8 +69,8 @@ let parse_cmdline () =
"--long-options", Arg.Unit display_long_options, " " ^ s_"List long options";
"--machine-readable", Arg.Set machine_readable, " " ^ s_"Make output machine readable";
"-o", Arg.Set_string option, s_"option" ^ " " ^ s_"Add qemu-img options";
- "-q", Arg.Set quiet, " " ^ s_"Quiet output";
- "--quiet", Arg.Set quiet, ditto;
+ "-q", Arg.Unit set_quiet, " " ^ s_"Quiet output";
+ "--quiet", Arg.Unit set_quiet, ditto;
"--tmp", Arg.Set_string tmp, s_"block|dir|prebuilt:file" ^ " " ^ s_"Set temporary block device, directory or prebuilt file";
"-v", Arg.Unit set_verbose, " " ^ s_"Enable debugging messages";
"--verbose", Arg.Unit set_verbose, ditto;
@@ -108,7 +107,6 @@ read the man page virt-sparsify(1).
let in_place = !in_place in
let machine_readable = !machine_readable in
let option = match !option with "" -> None | str -> Some str in
- let quiet = !quiet in
let tmp = match !tmp with "" -> None | str -> Some str in
let zeroes = List.rev !zeroes in
@@ -190,5 +188,4 @@ read the man page virt-sparsify(1).
else
Mode_in_place in
- indisk, debug_gc, format, ignores, machine_readable,
- quiet, zeroes, mode
+ indisk, debug_gc, format, ignores, machine_readable, zeroes, mode
diff --git a/sparsify/copying.ml b/sparsify/copying.ml
index 9f20fa3..6b15471 100644
--- a/sparsify/copying.ml
+++ b/sparsify/copying.ml
@@ -38,8 +38,7 @@ type tmp_place =
| Directory of string | Block_device of string | Prebuilt_file of string
let run indisk outdisk check_tmpdir compress convert
- format ignores machine_readable option tmp_param
- quiet zeroes =
+ format ignores machine_readable option tmp_param zeroes =
(* Once we have got past argument parsing and start to create
* temporary files (including the potentially massive overlay file), we
@@ -99,7 +98,7 @@ let run indisk outdisk check_tmpdir compress convert
| Directory tmpdir ->
(* Get virtual size of the input disk. *)
let virtual_size = (new G.guestfs ())#disk_virtual_size indisk in
- if not quiet then
+ if not (quiet ()) then
printf (f_"Input disk virtual size = %Ld bytes (%s)\n%!")
virtual_size (human_size virtual_size);
@@ -143,7 +142,7 @@ You can ignore this warning or change it to a hard failure using the
(* Create the temporary overlay file. *)
let overlaydisk =
- if not quiet then (
+ if not (quiet ()) then (
match tmp_place with
| Directory tmpdir ->
printf (f_"Create overlay file in %s to protect source disk ...\n%!")
@@ -180,7 +179,7 @@ You can ignore this warning or change it to a hard failure using the
(* Don't create anything, use the prebuilt file as overlay. *)
file in
- if not quiet then
+ if not (quiet ()) then
printf (f_"Examine source disk ...\n%!");
(* Connect to libguestfs. *)
@@ -192,7 +191,7 @@ You can ignore this warning or change it to a hard failure using the
(* Note that the temporary overlay disk is always qcow2 format. *)
g#add_drive ~format:"qcow2" ~readonly:false ~cachemode:"unsafe" overlaydisk;
- if not quiet then Progress.set_up_progress_bar ~machine_readable g;
+ if not (quiet ()) then Progress.set_up_progress_bar ~machine_readable g;
g#launch ();
g in
@@ -246,7 +245,7 @@ You can ignore this warning or change it to a hard failure using the
fun fs ->
if not (is_ignored fs) && not (is_read_only_lv fs) then (
if List.mem fs zeroes then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Zeroing %s ...\n%!") fs;
g#zero_device fs
@@ -257,13 +256,13 @@ You can ignore this warning or change it to a hard failure using the
if mounted then (
if is_readonly_btrfs_snapshot fs "/" then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Skipping %s, as it is a read-only btrfs snapshot.\n%!") fs;
) else if is_readonly_device "/" then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Skipping %s, as it is a read-only device.\n%!") fs;
) else (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Fill free space in %s with zero ...\n%!") fs;
g#zero_free_space "/"
@@ -280,7 +279,7 @@ You can ignore this warning or change it to a hard failure using the
with _ -> false in
if is_linux_x86_swap then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Clearing Linux swap on %s ...\n%!") fs;
(* Don't use mkswap. Just preserve the header containing
@@ -314,7 +313,7 @@ You can ignore this warning or change it to a hard failure using the
with _ -> false in
if created then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Fill free space in volgroup %s with zero ...\n%!") vg;
g#zero_device lvdev;
@@ -335,7 +334,7 @@ You can ignore this warning or change it to a hard failure using the
(* Now run qemu-img convert which copies the overlay to the
* destination and automatically does sparsification.
*)
- if not quiet then
+ if not (quiet ()) then
printf (f_"Copy to destination and make sparse ...\n%!");
let cmd =
@@ -352,7 +351,7 @@ You can ignore this warning or change it to a hard failure using the
error (f_"external command failed: %s") cmd;
(* Finished. *)
- if not quiet then (
+ if not (quiet ()) then (
print_newline ();
wrap (s_"Sparsify operation completed with no errors. Before deleting the old disk, carefully check that the target disk boots and works correctly.\n");
)
diff --git a/sparsify/in_place.ml b/sparsify/in_place.ml
index 9cd2982..0a62a3d 100644
--- a/sparsify/in_place.ml
+++ b/sparsify/in_place.ml
@@ -29,14 +29,14 @@ open Cmdline
module G = Guestfs
-let rec run disk format ignores machine_readable quiet zeroes =
+let rec run disk format ignores machine_readable zeroes =
(* Connect to libguestfs. *)
let g = new G.guestfs () in
if trace () then g#set_trace true;
if verbose () then g#set_verbose true;
try
- perform g disk format ignores machine_readable quiet zeroes
+ perform g disk format ignores machine_readable zeroes
with
G.Error msg as exn ->
if g#last_errno () = G.Errno.errno_ENOTSUP then (
@@ -45,7 +45,7 @@ let rec run disk format ignores machine_readable quiet zeroes =
)
else raise exn
-and perform g disk format ignores machine_readable quiet zeroes =
+and perform g disk format ignores machine_readable zeroes =
(* XXX Current limitation of the API. Can remove this hunk in future. *)
let format =
match format with
@@ -54,7 +54,7 @@ and perform g disk format ignores machine_readable quiet zeroes =
g#add_drive ?format ~discard:"enable" disk;
- if not quiet then Progress.set_up_progress_bar ~machine_readable g;
+ if not (quiet ()) then Progress.set_up_progress_bar ~machine_readable g;
g#launch ();
(* Discard non-ignored filesystems that we are able to mount, and
@@ -75,7 +75,7 @@ and perform g disk format ignores machine_readable quiet zeroes =
fun fs ->
if not (is_ignored fs) && not (is_read_only_lv fs) then (
if List.mem fs zeroes then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Zeroing %s ...\n%!") fs;
if not (g#blkdiscardzeroes fs) then
@@ -87,7 +87,7 @@ and perform g disk format ignores machine_readable quiet zeroes =
with _ -> false in
if mounted then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Trimming %s ...\n%!") fs;
g#fstrim "/"
@@ -103,7 +103,7 @@ and perform g disk format ignores machine_readable quiet zeroes =
with _ -> false in
if is_linux_x86_swap then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Clearing Linux swap on %s ...\n%!") fs;
(* Don't use mkswap. Just preserve the header containing
@@ -137,7 +137,7 @@ and perform g disk format ignores machine_readable quiet zeroes =
with _ -> false in
if created then (
- if not quiet then
+ if not (quiet ()) then
printf (f_"Discard space in volgroup %s ...\n%!") vg;
g#blkdiscard lvdev;
@@ -151,7 +151,7 @@ and perform g disk format ignores machine_readable quiet zeroes =
g#close ();
(* Finished. *)
- if not quiet then (
+ if not (quiet ()) then (
print_newline ();
wrap (s_"Sparsify in-place operation completed with no errors.\n");
)
diff --git a/sparsify/sparsify.ml b/sparsify/sparsify.ml
index 9362f36..1f631d8 100644
--- a/sparsify/sparsify.ml
+++ b/sparsify/sparsify.ml
@@ -30,16 +30,15 @@ module G = Guestfs
let () = Random.self_init ()
let rec main () =
- let indisk, debug_gc, format, ignores, machine_readable,
- quiet, zeroes, mode =
+ let indisk, debug_gc, format, ignores, machine_readable, zeroes, mode =
parse_cmdline () in
(match mode with
| Mode_copying (outdisk, check_tmpdir, compress, convert, option, tmp) ->
Copying.run indisk outdisk check_tmpdir compress convert
- format ignores machine_readable option tmp quiet zeroes
+ format ignores machine_readable option tmp zeroes
| Mode_in_place ->
- In_place.run indisk format ignores machine_readable quiet zeroes
+ In_place.run indisk format ignores machine_readable zeroes
);
if debug_gc then
diff --git a/sysprep/main.ml b/sysprep/main.ml
index 5a6af14..da3dfd2 100644
--- a/sysprep/main.ml
+++ b/sysprep/main.ml
@@ -34,12 +34,11 @@ let () = Sysprep_operation.bake ()
let () = Random.self_init ()
let main () =
- let debug_gc, operations, g, quiet, mount_opts =
+ let debug_gc, operations, g, mount_opts =
let debug_gc = ref false in
let domain = ref None in
let dryrun = ref false in
let files = ref [] in
- let quiet = ref false in
let libvirturi = ref "" in
let mount_opts = ref "" in
let operations = ref None in
@@ -140,8 +139,8 @@ let main () =
" " ^ s_"Compatibility option, does nothing";
"--operation", Arg.String set_operations, " " ^ s_"Enable/disable specific operations";
"--operations", Arg.String set_operations, " " ^ s_"Enable/disable specific operations";
- "-q", Arg.Set quiet, " " ^ s_"Don't print log messages";
- "--quiet", Arg.Set quiet, " " ^ s_"Don't print log messages";
+ "-q", Arg.Unit set_quiet, " " ^ s_"Don't print log messages";
+ "--quiet", Arg.Unit set_quiet, " " ^ s_"Don't print log messages";
"-v", Arg.Unit set_verbose, " " ^ s_"Enable debugging messages";
"--verbose", Arg.Unit set_verbose, " " ^ s_"Enable debugging messages";
"-V", Arg.Unit print_version_and_exit,
@@ -211,7 +210,6 @@ read the man page virt-sysprep(1).
let debug_gc = !debug_gc in
let dryrun = !dryrun in
let operations = !operations in
- let quiet = !quiet in
(* At this point we know which operations are enabled. So call the
* not_enabled_check_args method of all *disabled* operations, so
@@ -227,8 +225,7 @@ read the man page virt-sysprep(1).
List.map (string_split ":") (string_nsplit ";" mount_opts) in
let mount_opts mp = assoc ~default:"" mp mount_opts in
- let msg fs = make_message_function ~quiet fs in
- msg (f_"Examining the guest ...");
+ message (f_"Examining the guest ...");
(* Connect to libguestfs. *)
let g = new G.guestfs () in
@@ -237,7 +234,7 @@ read the man page virt-sysprep(1).
add g dryrun;
g#launch ();
- debug_gc, operations, g, quiet, mount_opts in
+ debug_gc, operations, g, mount_opts in
(* Inspection. *)
(match Array.to_list (g#inspect_os ()) with
@@ -265,7 +262,7 @@ read the man page virt-sysprep(1).
(* Perform the filesystem operations. *)
Sysprep_operation.perform_operations_on_filesystems
- ?operations ~quiet g root side_effects;
+ ?operations g root side_effects;
(* Unmount everything in this guest. *)
g#umount_all ();
@@ -274,7 +271,7 @@ read the man page virt-sysprep(1).
(* Perform the block device operations. *)
Sysprep_operation.perform_operations_on_devices
- ?operations ~quiet g root side_effects;
+ ?operations g root side_effects;
) roots
);
diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml
index 88eaee5..5ead3ce 100644
--- a/sysprep/sysprep_operation.ml
+++ b/sysprep/sysprep_operation.ml
@@ -34,7 +34,7 @@ end
class device_side_effects = object end
-type 'a callback = quiet:bool -> Guestfs.guestfs -> string -> 'a -> unit
+type 'a callback = Guestfs.guestfs -> string -> 'a -> unit
type operation = {
order : int;
@@ -269,12 +269,10 @@ let compare_operations { order = o1; name = n1 } { order = o2; name = n2 } =
let i = compare o1 o2 in
if i <> 0 then i else compare n1 n2
-let perform_operations_on_filesystems ?operations ~quiet g root
+let perform_operations_on_filesystems ?operations g root
side_effects =
assert !baked;
- let msg fs = make_message_function ~quiet fs in
-
let ops =
match operations with
| None -> !enabled_by_default_operations
@@ -287,17 +285,15 @@ let perform_operations_on_filesystems ?operations ~quiet g root
List.iter (
function
| { name = name; perform_on_filesystems = Some fn } ->
- msg "Performing %S ..." name;
- fn ~quiet g root side_effects
+ message "Performing %S ..." name;
+ fn g root side_effects
| { perform_on_filesystems = None } -> ()
) ops
-let perform_operations_on_devices ?operations ~quiet g root
+let perform_operations_on_devices ?operations g root
side_effects =
assert !baked;
- let msg fs = make_message_function ~quiet fs in
-
let ops =
match operations with
| None -> !enabled_by_default_operations
@@ -310,7 +306,7 @@ let perform_operations_on_devices ?operations ~quiet g root
List.iter (
function
| { name = name; perform_on_devices = Some fn } ->
- msg "Performing %S ..." name;
- fn ~quiet g root side_effects
+ message "Performing %S ..." name;
+ fn g root side_effects
| { perform_on_devices = None } -> ()
) ops
diff --git a/sysprep/sysprep_operation.mli b/sysprep/sysprep_operation.mli
index 4bdfcb9..f532a8c 100644
--- a/sysprep/sysprep_operation.mli
+++ b/sysprep/sysprep_operation.mli
@@ -30,8 +30,8 @@ end
class device_side_effects : object end
(** There are currently no device side-effects. For future use. *)
-type 'side_effects callback = quiet:bool -> Guestfs.guestfs -> string -> 'side_effects -> unit
-(** [callback ~quiet g root side_effects] is called to do work.
+type 'side_effects callback = Guestfs.guestfs -> string -> 'side_effects -> unit
+(** [callback g root side_effects] is called to do work.
If the operation has side effects such as creating files, it
should indicate that by calling the [side_effects] object. *)
@@ -178,8 +178,8 @@ val not_enabled_check_args : ?operations:set -> unit -> unit
(** Call [not_enabled_check_args] on all operations in the set
which are {i not} enabled. *)
-val perform_operations_on_filesystems : ?operations:set -> quiet:bool -> Guestfs.guestfs -> string -> filesystem_side_effects -> unit
+val perform_operations_on_filesystems : ?operations:set -> Guestfs.guestfs -> string -> filesystem_side_effects -> unit
(** Perform all operations, or the subset listed in the [operations] set. *)
-val perform_operations_on_devices : ?operations:set -> quiet:bool -> Guestfs.guestfs -> string -> device_side_effects -> unit
+val perform_operations_on_devices : ?operations:set -> Guestfs.guestfs -> string -> device_side_effects -> unit
(** Perform all operations, or the subset listed in the [operations] set. *)
diff --git a/sysprep/sysprep_operation_abrt_data.ml b/sysprep/sysprep_operation_abrt_data.ml
index df80a79..d950270 100644
--- a/sysprep/sysprep_operation_abrt_data.ml
+++ b/sysprep/sysprep_operation_abrt_data.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let abrt_data_perform ~quiet g root side_effects =
+let abrt_data_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = g#glob_expand "/var/spool/abrt/*" in
diff --git a/sysprep/sysprep_operation_bash_history.ml b/sysprep/sysprep_operation_bash_history.ml
index e88dc5c..67eb4e3 100644
--- a/sysprep/sysprep_operation_bash_history.ml
+++ b/sysprep/sysprep_operation_bash_history.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let bash_history_perform ~quiet g root side_effects =
+let bash_history_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let files = g#glob_expand "/home/*/.bash_history" in
diff --git a/sysprep/sysprep_operation_blkid_tab.ml b/sysprep/sysprep_operation_blkid_tab.ml
index 7599612..9c239b7 100644
--- a/sysprep/sysprep_operation_blkid_tab.ml
+++ b/sysprep/sysprep_operation_blkid_tab.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let blkid_tab_perform ~quiet g root side_effects =
+let blkid_tab_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let files = [ "/var/run/blkid.tab";
diff --git a/sysprep/sysprep_operation_ca_certificates.ml b/sysprep/sysprep_operation_ca_certificates.ml
index 7077e43..213f4ac 100644
--- a/sysprep/sysprep_operation_ca_certificates.ml
+++ b/sysprep/sysprep_operation_ca_certificates.ml
@@ -22,7 +22,7 @@ open Common_gettext.Gettext
module StringSet = Set.Make (String)
module G = Guestfs
-let ca_certificates_perform ~quiet g root side_effects =
+let ca_certificates_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = [ "/etc/pki/CA/certs/*.crt";
diff --git a/sysprep/sysprep_operation_crash_data.ml b/sysprep/sysprep_operation_crash_data.ml
index 8c41eb6..79f3d7f 100644
--- a/sysprep/sysprep_operation_crash_data.ml
+++ b/sysprep/sysprep_operation_crash_data.ml
@@ -26,7 +26,7 @@ let globs = [
"/var/log/dump/*";
]
-let crash_data_perform ~quiet g root side_effects =
+let crash_data_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ = "linux" then (
List.iter (fun glob -> Array.iter g#rm_rf (g#glob_expand glob)) globs
diff --git a/sysprep/sysprep_operation_cron_spool.ml b/sysprep/sysprep_operation_cron_spool.ml
index c6cf60e..687a7e9 100644
--- a/sysprep/sysprep_operation_cron_spool.ml
+++ b/sysprep/sysprep_operation_cron_spool.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let cron_spool_perform ~quiet (g : Guestfs.guestfs) root side_effects =
+let cron_spool_perform (g : Guestfs.guestfs) root side_effects =
Array.iter g#rm_rf (g#glob_expand "/var/spool/cron/*");
Array.iter g#rm (g#glob_expand "/var/spool/atjobs/*");
Array.iter g#rm (g#glob_expand "/var/spool/atjobs/.SEQ");
diff --git a/sysprep/sysprep_operation_customize.ml b/sysprep/sysprep_operation_customize.ml
index be90e4a..1cebd38 100644
--- a/sysprep/sysprep_operation_customize.ml
+++ b/sysprep/sysprep_operation_customize.ml
@@ -30,9 +30,9 @@ let customize_args, get_ops =
) args in
args, get_ops
-let customize_perform ~quiet g root side_effects =
+let customize_perform g root side_effects =
let ops = get_ops () in
- Customize_run.run ~quiet g root ops;
+ Customize_run.run g root ops;
side_effects#created_file () (* XXX Did we? *)
let op = {
diff --git a/sysprep/sysprep_operation_dhcp_client_state.ml b/sysprep/sysprep_operation_dhcp_client_state.ml
index 846a317..3ee91df 100644
--- a/sysprep/sysprep_operation_dhcp_client_state.ml
+++ b/sysprep/sysprep_operation_dhcp_client_state.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let dhcp_client_state_perform ~quiet g root side_effects =
+let dhcp_client_state_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ = "linux" then (
List.iter (
diff --git a/sysprep/sysprep_operation_dhcp_server_state.ml b/sysprep/sysprep_operation_dhcp_server_state.ml
index 72775bd..dfc71b2 100644
--- a/sysprep/sysprep_operation_dhcp_server_state.ml
+++ b/sysprep/sysprep_operation_dhcp_server_state.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let dhcp_server_state_perform ~quiet g root side_effects =
+let dhcp_server_state_perform g root side_effects =
Array.iter g#rm_rf (g#glob_expand "/var/lib/dhcpd/*")
let op = {
diff --git a/sysprep/sysprep_operation_dovecot_data.ml b/sysprep/sysprep_operation_dovecot_data.ml
index 9820a7c..976d483 100644
--- a/sysprep/sysprep_operation_dovecot_data.ml
+++ b/sysprep/sysprep_operation_dovecot_data.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let dovecot_data_perform ~quiet g root side_effects =
+let dovecot_data_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let files = g#glob_expand "/var/lib/dovecot/*" in
diff --git a/sysprep/sysprep_operation_firewall_rules.ml b/sysprep/sysprep_operation_firewall_rules.ml
index 5c97648..f5967fc 100644
--- a/sysprep/sysprep_operation_firewall_rules.ml
+++ b/sysprep/sysprep_operation_firewall_rules.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let firewall_rules_perform ~quiet g root side_effects =
+let firewall_rules_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = [ "/etc/sysconfig/iptables";
diff --git a/sysprep/sysprep_operation_flag_reconfiguration.ml b/sysprep/sysprep_operation_flag_reconfiguration.ml
index 20d5923..00ee79d 100644
--- a/sysprep/sysprep_operation_flag_reconfiguration.ml
+++ b/sysprep/sysprep_operation_flag_reconfiguration.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let flag_reconfiguration ~quiet g root side_effects =
+let flag_reconfiguration g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
g#touch "/.unconfigured";
diff --git a/sysprep/sysprep_operation_fs_uuids.ml b/sysprep/sysprep_operation_fs_uuids.ml
index c5cbcfc..ed4e81a 100644
--- a/sysprep/sysprep_operation_fs_uuids.ml
+++ b/sysprep/sysprep_operation_fs_uuids.ml
@@ -25,7 +25,7 @@ open Sysprep_operation
module G = Guestfs
-let rec fs_uuids_perform ~quiet g root side_effects =
+let rec fs_uuids_perform g root side_effects =
let fses = g#list_filesystems () in
List.iter (function
| _, "unknown" -> ()
diff --git a/sysprep/sysprep_operation_kerberos_data.ml b/sysprep/sysprep_operation_kerberos_data.ml
index c410331..449d604 100644
--- a/sysprep/sysprep_operation_kerberos_data.ml
+++ b/sysprep/sysprep_operation_kerberos_data.ml
@@ -22,7 +22,7 @@ open Common_gettext.Gettext
module StringSet = Set.Make (String)
module G = Guestfs
-let kerberos_data_perform ~quiet g root side_effects =
+let kerberos_data_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let excepts = [ "/var/kerberos/krb5kdc/kadm5.acl";
diff --git a/sysprep/sysprep_operation_logfiles.ml b/sysprep/sysprep_operation_logfiles.ml
index ba09cc5..7b81959 100644
--- a/sysprep/sysprep_operation_logfiles.ml
+++ b/sysprep/sysprep_operation_logfiles.ml
@@ -132,7 +132,7 @@ let globs = List.sort compare [
]
let globs_as_pod = String.concat "\n" (List.map ((^) " ") globs)
-let logfiles_perform ~quiet g root side_effects =
+let logfiles_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ = "linux" then (
List.iter (fun glob -> Array.iter g#rm_rf (g#glob_expand glob)) globs
diff --git a/sysprep/sysprep_operation_lvm_uuids.ml b/sysprep/sysprep_operation_lvm_uuids.ml
index 32497b7..c67b214 100644
--- a/sysprep/sysprep_operation_lvm_uuids.ml
+++ b/sysprep/sysprep_operation_lvm_uuids.ml
@@ -23,7 +23,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let rec lvm_uuids_perform ~quiet g root side_effects =
+let rec lvm_uuids_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ = "linux" then (
let has_lvm2_feature =
diff --git a/sysprep/sysprep_operation_machine_id.ml b/sysprep/sysprep_operation_machine_id.ml
index 0345da0..fbcc692 100644
--- a/sysprep/sysprep_operation_machine_id.ml
+++ b/sysprep/sysprep_operation_machine_id.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let machine_id_perform ~quiet g root side_effects =
+let machine_id_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let path = "/etc/machine-id" in
diff --git a/sysprep/sysprep_operation_mail_spool.ml b/sysprep/sysprep_operation_mail_spool.ml
index 691a0dc..0db831c 100644
--- a/sysprep/sysprep_operation_mail_spool.ml
+++ b/sysprep/sysprep_operation_mail_spool.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let mail_spool_perform ~quiet g root side_effects =
+let mail_spool_perform g root side_effects =
List.iter (
fun glob -> Array.iter g#rm_rf (g#glob_expand glob)
) [
diff --git a/sysprep/sysprep_operation_net_hostname.ml b/sysprep/sysprep_operation_net_hostname.ml
index 558b228..bc99662 100644
--- a/sysprep/sysprep_operation_net_hostname.ml
+++ b/sysprep/sysprep_operation_net_hostname.ml
@@ -22,7 +22,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let net_hostname_perform ~quiet g root side_effects =
+let net_hostname_perform g root side_effects =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
diff --git a/sysprep/sysprep_operation_net_hwaddr.ml b/sysprep/sysprep_operation_net_hwaddr.ml
index fe30345..fbf0a33 100644
--- a/sysprep/sysprep_operation_net_hwaddr.ml
+++ b/sysprep/sysprep_operation_net_hwaddr.ml
@@ -22,7 +22,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let net_hwaddr_perform ~quiet g root side_effects =
+let net_hwaddr_perform g root side_effects =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
diff --git a/sysprep/sysprep_operation_pacct_log.ml b/sysprep/sysprep_operation_pacct_log.ml
index 87bc8d0..355198d 100644
--- a/sysprep/sysprep_operation_pacct_log.ml
+++ b/sysprep/sysprep_operation_pacct_log.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let pacct_log_perform ~quiet g root side_effects =
+let pacct_log_perform g root side_effects =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
match typ, distro with
diff --git a/sysprep/sysprep_operation_package_manager_cache.ml b/sysprep/sysprep_operation_package_manager_cache.ml
index ff549ed..5eb0453 100644
--- a/sysprep/sysprep_operation_package_manager_cache.ml
+++ b/sysprep/sysprep_operation_package_manager_cache.ml
@@ -22,7 +22,7 @@ open Common_utils
module G = Guestfs
-let package_manager_cache_perform ~quiet g root side_effects =
+let package_manager_cache_perform g root side_effects =
let packager = g#inspect_get_package_management root in
let cache_dirs =
match packager with
diff --git a/sysprep/sysprep_operation_pam_data.ml b/sysprep/sysprep_operation_pam_data.ml
index 93292b7..c3b988f 100644
--- a/sysprep/sysprep_operation_pam_data.ml
+++ b/sysprep/sysprep_operation_pam_data.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let pam_data_perform ~quiet g root side_effects =
+let pam_data_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = [ "/var/run/console/*";
diff --git a/sysprep/sysprep_operation_puppet_data_log.ml b/sysprep/sysprep_operation_puppet_data_log.ml
index 22bcf47..f00e4a9 100644
--- a/sysprep/sysprep_operation_puppet_data_log.ml
+++ b/sysprep/sysprep_operation_puppet_data_log.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let puppet_data_log_perform ~quiet g root side_effects =
+let puppet_data_log_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = [ "/var/log/puppet/*";
diff --git a/sysprep/sysprep_operation_rh_subscription_manager.ml b/sysprep/sysprep_operation_rh_subscription_manager.ml
index b1bb972..d6c38b2 100644
--- a/sysprep/sysprep_operation_rh_subscription_manager.ml
+++ b/sysprep/sysprep_operation_rh_subscription_manager.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let rh_subscription_manager_perform ~quiet g root side_effects =
+let rh_subscription_manager_perform g root side_effects =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
diff --git a/sysprep/sysprep_operation_rhn_systemid.ml b/sysprep/sysprep_operation_rhn_systemid.ml
index e144998..21aace5 100644
--- a/sysprep/sysprep_operation_rhn_systemid.ml
+++ b/sysprep/sysprep_operation_rhn_systemid.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let rhn_systemid_perform ~quiet g root side_effects =
+let rhn_systemid_perform g root side_effects =
let typ = g#inspect_get_type root in
let distro = g#inspect_get_distro root in
diff --git a/sysprep/sysprep_operation_rpm_db.ml b/sysprep/sysprep_operation_rpm_db.ml
index 94bdc2d..55e50fe 100644
--- a/sysprep/sysprep_operation_rpm_db.ml
+++ b/sysprep/sysprep_operation_rpm_db.ml
@@ -22,7 +22,7 @@ open Common_gettext.Gettext
module StringSet = Set.Make (String)
module G = Guestfs
-let rpm_db_perform ~quiet g root side_effects =
+let rpm_db_perform g root side_effects =
let pf = g#inspect_get_package_format root in
if pf = "rpm" then (
let paths = g#glob_expand "/var/lib/rpm/__db.*" in
diff --git a/sysprep/sysprep_operation_samba_db_log.ml b/sysprep/sysprep_operation_samba_db_log.ml
index c02b81e..126a7ac 100644
--- a/sysprep/sysprep_operation_samba_db_log.ml
+++ b/sysprep/sysprep_operation_samba_db_log.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let samba_db_log_perform ~quiet g root side_effects =
+let samba_db_log_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = [ "/var/log/samba/old/*";
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index 459eace..140225c 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -35,7 +35,7 @@ let set_scriptdir dir =
let scripts = ref []
let add_script script = scripts := script :: !scripts
-let rec script_perform ~quiet (g : Guestfs.guestfs) root side_effects =
+let rec script_perform (g : Guestfs.guestfs) root side_effects =
let scripts = List.rev !scripts in
if scripts <> [] then (
(* Create a temporary directory? *)
diff --git a/sysprep/sysprep_operation_smolt_uuid.ml b/sysprep/sysprep_operation_smolt_uuid.ml
index 00d6ac3..dd80c1d 100644
--- a/sysprep/sysprep_operation_smolt_uuid.ml
+++ b/sysprep/sysprep_operation_smolt_uuid.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let smolt_uuid_perform ~quiet g root side_effects =
+let smolt_uuid_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ = "linux" then (
let files = [ "/etc/sysconfig/hw-uuid";
diff --git a/sysprep/sysprep_operation_ssh_hostkeys.ml b/sysprep/sysprep_operation_ssh_hostkeys.ml
index 7668236..417e792 100644
--- a/sysprep/sysprep_operation_ssh_hostkeys.ml
+++ b/sysprep/sysprep_operation_ssh_hostkeys.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let ssh_hostkeys_perform ~quiet g root side_effects =
+let ssh_hostkeys_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let files = g#glob_expand "/etc/ssh/*_host_*" in
diff --git a/sysprep/sysprep_operation_ssh_userdir.ml b/sysprep/sysprep_operation_ssh_userdir.ml
index bec1d56..19f8890 100644
--- a/sysprep/sysprep_operation_ssh_userdir.ml
+++ b/sysprep/sysprep_operation_ssh_userdir.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let ssh_userdir_perform ~quiet g root side_effects =
+let ssh_userdir_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let dirs = g#glob_expand "/home/*/.ssh" in
diff --git a/sysprep/sysprep_operation_sssd_db_log.ml b/sysprep/sysprep_operation_sssd_db_log.ml
index 91a7765..8f1bc88 100644
--- a/sysprep/sysprep_operation_sssd_db_log.ml
+++ b/sysprep/sysprep_operation_sssd_db_log.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let sssd_db_log_perform ~quiet g root side_effects =
+let sssd_db_log_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = [ "/var/log/sssd/*";
diff --git a/sysprep/sysprep_operation_tmp_files.ml b/sysprep/sysprep_operation_tmp_files.ml
index 3b9e58f..af600db 100644
--- a/sysprep/sysprep_operation_tmp_files.ml
+++ b/sysprep/sysprep_operation_tmp_files.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let tmp_files_perform ~quiet g root side_effects =
+let tmp_files_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
let paths = [ "/tmp";
diff --git a/sysprep/sysprep_operation_udev_persistent_net.ml b/sysprep/sysprep_operation_udev_persistent_net.ml
index 2ceeef5..d0ddd53 100644
--- a/sysprep/sysprep_operation_udev_persistent_net.ml
+++ b/sysprep/sysprep_operation_udev_persistent_net.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let udev_persistent_net_perform ~quiet g root side_effects =
+let udev_persistent_net_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ = "linux" then (
try g#rm "/etc/udev/rules.d/70-persistent-net.rules"
diff --git a/sysprep/sysprep_operation_user_account.ml b/sysprep/sysprep_operation_user_account.ml
index 0f676ec..3f3b142 100644
--- a/sysprep/sysprep_operation_user_account.ml
+++ b/sysprep/sysprep_operation_user_account.ml
@@ -53,7 +53,7 @@ let check_remove_user user =
else
false
-let user_account_perform ~quiet g root side_effects =
+let user_account_perform g root side_effects =
let typ = g#inspect_get_type root in
let changed = ref false in
if typ <> "windows" then (
diff --git a/sysprep/sysprep_operation_utmp.ml b/sysprep/sysprep_operation_utmp.ml
index 6c1ac41..3c9c6de 100644
--- a/sysprep/sysprep_operation_utmp.ml
+++ b/sysprep/sysprep_operation_utmp.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let utmp_perform ~quiet g root side_effects =
+let utmp_perform g root side_effects =
let typ = g#inspect_get_type root in
if typ <> "windows" then (
try g#rm "/var/run/utmp"
diff --git a/sysprep/sysprep_operation_yum_uuid.ml b/sysprep/sysprep_operation_yum_uuid.ml
index ed52929..045970c 100644
--- a/sysprep/sysprep_operation_yum_uuid.ml
+++ b/sysprep/sysprep_operation_yum_uuid.ml
@@ -21,7 +21,7 @@ open Common_gettext.Gettext
module G = Guestfs
-let yum_uuid_perform ~quiet g root side_effects =
+let yum_uuid_perform g root side_effects =
let packager = g#inspect_get_package_management root in
if packager = "yum" then (
try g#rm "/var/lib/yum/uuid" with G.Error _ -> ()
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
index c0f6617..705051f 100644
--- a/v2v/cmdline.ml
+++ b/v2v/cmdline.ml
@@ -40,7 +40,6 @@ let parse_cmdline () =
let password_file = ref "" in
let print_source = ref false in
let qemu_boot = ref false in
- let quiet = ref false in
let vdsm_vm_uuid = ref "" in
let vdsm_ovf_output = ref "." in
let vmtype = ref "" in
@@ -164,8 +163,8 @@ let parse_cmdline () =
"--password-file", Arg.Set_string password_file, "file " ^ s_"Use password from file";
"--print-source", Arg.Set print_source, " " ^ s_"Print source and stop";
"--qemu-boot", Arg.Set qemu_boot, " " ^ s_"Boot in qemu (-o qemu only)";
- "-q", Arg.Set quiet, " " ^ s_"Quiet output";
- "--quiet", Arg.Set quiet, ditto;
+ "-q", Arg.Unit set_quiet, " " ^ s_"Quiet output";
+ "--quiet", Arg.Unit set_quiet, ditto;
"--root", Arg.String set_root_choice,"ask|... " ^ s_"How to choose root filesystem";
"--vdsm-image-uuid",
Arg.String add_vdsm_image_uuid, "uuid " ^ s_"Output image UUID(s)";
@@ -230,7 +229,6 @@ read the man page virt-v2v(1).
let password_file = match !password_file with "" -> None | s -> Some s in
let print_source = !print_source in
let qemu_boot = !qemu_boot in
- let quiet = !quiet in
let root_choice = !root_choice in
let vdsm_image_uuids = List.rev !vdsm_image_uuids in
let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
@@ -389,4 +387,4 @@ read the man page virt-v2v(1).
input, output,
debug_gc, debug_overlays, do_copy, network_map, no_trim,
output_alloc, output_format, output_name,
- print_source, quiet, root_choice
+ print_source, root_choice
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
index d93366a..14dc69a 100644
--- a/v2v/v2v.ml
+++ b/v2v/v2v.ml
@@ -47,18 +47,15 @@ let rec main () =
(* Handle the command line. *)
let input, output,
debug_gc, debug_overlays, do_copy, network_map, no_trim,
- output_alloc, output_format, output_name,
- print_source, quiet, root_choice =
+ output_alloc, output_format, output_name, print_source, root_choice =
Cmdline.parse_cmdline () in
- let msg fs = make_message_function ~quiet fs in
-
(* Print the version, easier than asking users to tell us. *)
if verbose () then
printf "%s: %s %s (%s)\n%!"
prog Config.package_name Config.package_version Config.host_cpu;
- msg (f_"Opening the source %s") input#as_options;
+ message (f_"Opening the source %s") input#as_options;
let source = input#source () in
(* Print source and stop. *)
@@ -127,7 +124,7 @@ let rec main () =
* to fstrim/blkdiscard and avoid copying significant parts of the
* data over the wire.
*)
- msg (f_"Creating an overlay to protect the source from being modified");
+ message (f_"Creating an overlay to protect the source from being modified");
let overlay_dir = (new Guestfs.guestfs ())#get_cachedir () in
let overlays =
List.map (
@@ -155,7 +152,7 @@ let rec main () =
) source.s_disks in
(* Open the guestfs handle. *)
- msg (f_"Opening the overlay");
+ message (f_"Opening the overlay");
let g = new G.guestfs () in
if trace () then g#set_trace true;
if verbose () then g#set_verbose true;
@@ -187,7 +184,7 @@ let rec main () =
* just so we can display errors to the user before doing too much
* work.
*)
- msg (f_"Initializing the target %s") output#as_options;
+ message (f_"Initializing the target %s") output#as_options;
let targets =
List.map (
fun ov ->
@@ -221,7 +218,7 @@ let rec main () =
let targets = output#prepare_targets source targets in
(* Inspection - this also mounts up the filesystems. *)
- msg (f_"Inspecting the overlay");
+ message (f_"Inspecting the overlay");
let inspect = inspect_source g root_choice in
(* Does the guest require UEFI on the target? *)
@@ -259,11 +256,11 @@ let rec main () =
);
(* Check there is enough free space to perform conversion. *)
- msg (f_"Checking for sufficient free disk space in the guest");
+ message (f_"Checking for sufficient free disk space in the guest");
check_free_space mpstats;
(* Estimate space required on target for each disk. Note this is a max. *)
- msg (f_"Estimating space required on target for each disk");
+ message (f_"Estimating space required on target for each disk");
let targets = estimate_target_size mpstats targets in
output#check_target_free_space source targets;
@@ -272,9 +269,9 @@ let rec main () =
let guestcaps =
(match inspect.i_product_name with
| "unknown" ->
- msg (f_"Converting the guest to run on KVM")
+ message (f_"Converting the guest to run on KVM")
| prod ->
- msg (f_"Converting %s to run on KVM") prod
+ message (f_"Converting %s to run on KVM") prod
);
(* RHEV doesn't support serial console so remove any on conversion. *)
@@ -291,7 +288,7 @@ let rec main () =
guestcaps in
(* Did we manage to install virtio drivers? *)
- if not quiet then (
+ if not (quiet ()) then (
if guestcaps.gcaps_block_bus = Virtio_blk then
info (f_"This guest has virtio drivers installed.")
else
@@ -305,11 +302,11 @@ let rec main () =
* because unused blocks are marked in the overlay and thus do
* not have to be copied.
*)
- msg (f_"Mapping filesystem data to avoid copying unused and blank areas");
+ message (f_"Mapping filesystem data to avoid copying unused and blank areas");
do_fstrim g no_trim inspect;
);
- msg (f_"Closing the overlay");
+ message (f_"Closing the overlay");
g#umount_all ();
g#shutdown ();
g#close ();
@@ -330,7 +327,7 @@ let rec main () =
let nr_disks = List.length targets in
mapi (
fun i t ->
- msg (f_"Copying disk %d/%d to %s (%s)")
+ message (f_"Copying disk %d/%d to %s (%s)")
(i+1) nr_disks t.target_file t.target_format;
if verbose () then printf "%s%!" (string_of_target t);
@@ -377,7 +374,7 @@ let rec main () =
let cmd =
sprintf "qemu-img convert%s -n -f qcow2 -O %s %s %s"
- (if not quiet then " -p" else "")
+ (if not (quiet ()) then " -p" else "")
(quote t.target_format) (quote overlay_file)
(quote t.target_file) in
if verbose () then printf "%s\n%!" cmd;
@@ -433,7 +430,7 @@ let rec main () =
) (* do_copy *) in
(* Create output metadata. *)
- msg (f_"Creating output metadata");
+ message (f_"Creating output metadata");
output#create_metadata source targets guestcaps inspect target_firmware;
(* Save overlays if --debug-overlays option was used. *)
@@ -447,7 +444,7 @@ let rec main () =
) overlays
);
- msg (f_"Finishing off");
+ message (f_"Finishing off");
delete_target_on_exit := false; (* Don't delete target on exit. *)
if debug_gc then
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list