summaryrefslogtreecommitdiffstats
path: root/lib/misc/lvm-globals.c
diff options
context:
space:
mode:
authorAlasdair G Kergon <agk@redhat.com>2012-08-25 20:35:48 +0100
committerAlasdair G Kergon <agk@redhat.com>2012-08-25 20:35:48 +0100
commit438e0050dfed1f8f2d74670a5f7c5e8c8819c777 (patch)
tree72488758b931b28d8a7f4294c9059a6fdd9db379 /lib/misc/lvm-globals.c
parent4047e4dfb16175daec348bf44032c02181bd4c70 (diff)
downloadlvm2-438e0050dfed1f8f2d74670a5f7c5e8c8819c777.tar.gz
lvm2-438e0050dfed1f8f2d74670a5f7c5e8c8819c777.tar.xz
lvm2-438e0050dfed1f8f2d74670a5f7c5e8c8819c777.zip
config: add silent mode
Accept -q as the short form of --quiet. Suppress non-essential standard output if -q is given twice. Treat log/silent in lvm.conf as equivalent to -qq. Review all log_print messages and change some to log_print_unless_silent. When silent, the following commands still produce output: dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay, pvs, version, vgcfgrestore -l, vgdisplay, vgs. [Needs checking.] Non-essential messages are shifted from log level 4 to log level 5 for syslog and lvm2_log_fn purposes.
Diffstat (limited to 'lib/misc/lvm-globals.c')
-rw-r--r--lib/misc/lvm-globals.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 1c72f85a..fe380089 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -23,6 +23,7 @@
#include <stdarg.h>
static int _verbose_level = VERBOSE_BASE_LEVEL;
+static int _silent = 0;
static int _test = 0;
static int _md_filtering = 0;
static int _pvmove = 0;
@@ -54,10 +55,15 @@ void init_verbose(int level)
_verbose_level = level;
}
+void init_silent(int silent)
+{
+ _silent = silent;
+}
+
void init_test(int level)
{
if (!_test && level)
- log_print("Test mode: Metadata will NOT be updated and volumes will not be (de)activated.");
+ log_warn("TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.");
_test = level;
}
@@ -267,6 +273,11 @@ int debug_level(void)
return _debug_level;
}
+int silent_mode(void)
+{
+ return _silent;
+}
+
unsigned is_static(void)
{
return _is_static;