1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvmetad: use -l for logging level not -d

This commit is contained in:
Alasdair G Kergon 2012-10-15 10:44:43 +01:00
parent 3ed2c32e0a
commit 78dafcba99
5 changed files with 16 additions and 16 deletions

View File

@ -65,7 +65,7 @@ Version 2.02.98 -
Use proper condition to check for unsupported discards settings. Use proper condition to check for unsupported discards settings.
Update lvs manpage with discards (2.02.97). Update lvs manpage with discards (2.02.97).
Add support for lvcreate --discards. Add support for lvcreate --discards.
Change lvmetad logging syntax from -ddd to -d {all|wire|debug}. Change lvmetad logging syntax from -ddd to -l {all|wire|debug}.
Add new libdaemon logging infrastructure. Add new libdaemon logging infrastructure.
Version 2.02.97 - 7th August 2012 Version 2.02.97 - 7th August 2012

View File

@ -28,7 +28,7 @@
typedef struct { typedef struct {
log_state *log; /* convenience */ log_state *log; /* convenience */
const char *debug_config; const char *log_config;
struct dm_hash_table *pvid_to_pvmeta; struct dm_hash_table *pvid_to_pvmeta;
struct dm_hash_table *device_to_pvid; /* shares locks with above */ struct dm_hash_table *device_to_pvid; /* shares locks with above */
@ -1097,8 +1097,8 @@ static int init(daemon_state *s)
ls->lock.vg = dm_hash_create(32); ls->lock.vg = dm_hash_create(32);
ls->token[0] = 0; ls->token[0] = 0;
/* Set up stderr logging depending on the -d option. */ /* Set up stderr logging depending on the -l option. */
if (!daemon_log_parse(ls->log, DAEMON_LOG_OUTLET_STDERR, ls->debug_config, 1)) if (!daemon_log_parse(ls->log, DAEMON_LOG_OUTLET_STDERR, ls->log_config, 1))
return 0; return 0;
DEBUG(s, "initialised state: vgid_to_metadata = %p", ls->vgid_to_metadata); DEBUG(s, "initialised state: vgid_to_metadata = %p", ls->vgid_to_metadata);
@ -1135,11 +1135,11 @@ static int fini(daemon_state *s)
static void usage(char *prog, FILE *file) static void usage(char *prog, FILE *file)
{ {
fprintf(file, "Usage:\n" fprintf(file, "Usage:\n"
"%s [-V] [-h] [-d {all|wire|debug}] [-f] [-s path]\n\n" "%s [-V] [-h] [-f] [-l {all|wire|debug}] [-s path]\n\n"
" -V Show version of lvmetad\n" " -V Show version of lvmetad\n"
" -h Show this help information\n" " -h Show this help information\n"
" -d Log messages to stderr (-d {all|wire|debug})\n"
" -f Don't fork, run in the foreground\n" " -f Don't fork, run in the foreground\n"
" -l Logging message level (-l {all|wire|debug})\n"
" -s Set path to the socket to listen on\n\n", prog); " -s Set path to the socket to listen on\n\n", prog);
} }
@ -1163,10 +1163,10 @@ int main(int argc, char *argv[])
s.pidfile = LVMETAD_PIDFILE; s.pidfile = LVMETAD_PIDFILE;
s.protocol = "lvmetad"; s.protocol = "lvmetad";
s.protocol_version = 1; s.protocol_version = 1;
ls.debug_config = ""; ls.log_config = "";
// use getopt_long // use getopt_long
while ((opt = getopt(argc, argv, "?fhVd:s:")) != EOF) { while ((opt = getopt(argc, argv, "?fhVl:s:")) != EOF) {
switch (opt) { switch (opt) {
case 'h': case 'h':
usage(argv[0], stdout); usage(argv[0], stdout);
@ -1177,8 +1177,8 @@ int main(int argc, char *argv[])
case 'f': case 'f':
s.foreground = 1; s.foreground = 1;
break; break;
case 'd': case 'l':
ls.debug_config = optarg; ls.log_config = optarg;
break; break;
case 's': // --socket case 's': // --socket
s.socket_path = optarg; s.socket_path = optarg;

View File

@ -151,7 +151,7 @@ void daemon_log_enable(log_state *s, int outlet, int type, int enable);
/* /*
* Set up logging on a given outlet using a list of message types (comma * Set up logging on a given outlet using a list of message types (comma
* separated) to log using that outlet. The list is expected to look like this, * separated) to log using that outlet. The list is expected to look like this,
* "info,wire,debug". Returns 0 upon encountering an unknown message type. * "all,wire,debug". Returns 0 upon encountering an unknown message type.
*/ */
int daemon_log_parse(log_state *s, int outlet, const char *types, int enable); int daemon_log_parse(log_state *s, int outlet, const char *types, int enable);

View File

@ -3,7 +3,7 @@
lvmetad \- LVM metadata cache daemon lvmetad \- LVM metadata cache daemon
.SH SYNOPSIS .SH SYNOPSIS
.B lvmetad .B lvmetad
.RB [ \-d .RB [ \-l
.RI {all|wire|debug} .RI {all|wire|debug}
.RB ] .RB ]
.RB [ \-s .RB [ \-s
@ -22,14 +22,14 @@ consistent image of the volume groups available in the system.
By default, lvmetad, even if running, is not used by LVM. See \fBlvm.conf\fP(5). By default, lvmetad, even if running, is not used by LVM. See \fBlvm.conf\fP(5).
.SH OPTIONS .SH OPTIONS
.TP .TP
.BR \-d " {" \fIall | \fIwire | \fIdebug } .BR \-l " {" \fIall | \fIwire | \fIdebug }
Select the type of log messages to generate. Select the type of log messages to generate.
Messages are logged by syslog. Messages are logged by syslog.
Additionally, when -f is given they are also sent to standard error. Additionally, when -f is given they are also sent to standard error.
Since release 2.02.98, there are two classes of messages: wire and debug. Since release 2.02.98, there are two classes of messages: wire and debug.
Selecting 'all' supplies both and is equivalent to a comma-separated list Selecting 'all' supplies both and is equivalent to a comma-separated list
-d wire,debug. -l wire,debug.
Prior to release 2.02.98, repeating from 1 to 3 times, viz. -d, -dd, -ddd, Prior to release 2.02.98, repeating -d from 1 to 3 times, viz. -d, -dd, -ddd,
increased the detail of messages. increased the detail of messages.
.TP .TP
.B \-f .B \-f

View File

@ -77,7 +77,7 @@ prepare_lvmetad() {
test -z "$LVM_VALGRIND_LVMETAD" || run_valgrind="run_valgrind" test -z "$LVM_VALGRIND_LVMETAD" || run_valgrind="run_valgrind"
echo "preparing lvmetad..." echo "preparing lvmetad..."
$run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" -d wire,debug & $run_valgrind lvmetad -f "$@" -s "$TESTDIR/lvmetad.socket" -l wire,debug &
echo $! > LOCAL_LVMETAD echo $! > LOCAL_LVMETAD
while ! test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket while ! test -e "$TESTDIR/lvmetad.socket"; do echo -n .; sleep .1; done # wait for the socket
echo ok echo ok