diff options
author | Christophe Varoqui <christophe.varoqui@free.fr> | 2008-11-13 23:52:20 +0100 |
---|---|---|
committer | Christophe Varoqui <christophe.varoqui@free.fr> | 2008-11-13 23:52:20 +0100 |
commit | 3484274184cc4be889718c97ebe0536623043fa8 (patch) | |
tree | 25b603372b63e7ab2fe7807a9c8fe76abe7c2098 /multipathd | |
parent | 2dfa39b49d9ca80d95881adde895b429bebdc6b0 (diff) | |
download | multipath-tools-3484274184cc4be889718c97ebe0536623043fa8.tar.gz multipath-tools-3484274184cc4be889718c97ebe0536623043fa8.tar.bz2 multipath-tools-3484274184cc4be889718c97ebe0536623043fa8.zip |
[multipathd] add "show maps format ..." cli command
Just like "show paths format ...", it gives users more control
over the report format of multipaths information.
Example:
$ sudo multipathd -k'show maps format "%n %s %S %d %t %r %Q %N"'
name vend/prod/rev size sysfs dm-st write_prot queueing paths
353333330000007d0 Linux,scsi_debug 8.0M dm-1 active rw - 2
353333330000007d1 Linux,scsi_debug 8.0M dm-2 active rw - 2
35333333000000bb8 Linux,scsi_debug 8.0M dm-3 active rw - 2
35333333000000bb9 Linux,scsi_debug 8.0M dm-4 active rw - 2
Diffstat (limited to 'multipathd')
-rw-r--r-- | multipathd/cli.c | 1 | ||||
-rw-r--r-- | multipathd/cli_handlers.c | 11 | ||||
-rw-r--r-- | multipathd/cli_handlers.h | 1 | ||||
-rw-r--r-- | multipathd/main.c | 1 |
4 files changed, 14 insertions, 0 deletions
diff --git a/multipathd/cli.c b/multipathd/cli.c index b4b4d1e..c93aa83 100644 --- a/multipathd/cli.c +++ b/multipathd/cli.c @@ -413,6 +413,7 @@ cli_init (void) { add_handler(LIST+MAPS, NULL); add_handler(LIST+MAPS+STATUS, NULL); add_handler(LIST+MAPS+STATS, NULL); + add_handler(LIST+MAPS+FMT, NULL); add_handler(LIST+MAPS+TOPOLOGY, NULL); add_handler(LIST+TOPOLOGY, NULL); add_handler(LIST+MAP+TOPOLOGY, NULL); diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c index e453220..6cf232a 100644 --- a/multipathd/cli_handlers.c +++ b/multipathd/cli_handlers.c @@ -297,6 +297,17 @@ show_maps (char ** r, int *len, struct vectors * vecs, char * style) } int +cli_list_maps_fmt (void * v, char ** reply, int * len, void * data) +{ + struct vectors * vecs = (struct vectors *)data; + char * fmt = get_keyparam(v, FMT); + + condlog(3, "list maps (operator)"); + + return show_maps(reply, len, vecs, fmt); +} + +int cli_list_maps (void * v, char ** reply, int * len, void * data) { struct vectors * vecs = (struct vectors *)data; diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h index cef9864..f57a160 100644 --- a/multipathd/cli_handlers.h +++ b/multipathd/cli_handlers.h @@ -2,6 +2,7 @@ int cli_list_paths (void * v, char ** reply, int * len, void * data); int cli_list_paths_fmt (void * v, char ** reply, int * len, void * data); int cli_list_status (void * v, char ** reply, int * len, void * data); int cli_list_maps (void * v, char ** reply, int * len, void * data); +int cli_list_maps_fmt (void * v, char ** reply, int * len, void * data); int cli_list_maps_status (void * v, char ** reply, int * len, void * data); int cli_list_maps_stats (void * v, char ** reply, int * len, void * data); int cli_list_map_topology (void * v, char ** reply, int * len, void * data); diff --git a/multipathd/main.c b/multipathd/main.c index 0d4c355..25fc41e 100644 --- a/multipathd/main.c +++ b/multipathd/main.c @@ -697,6 +697,7 @@ uxlsnrloop (void * ap) set_handler_callback(LIST+STATUS, cli_list_status); set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status); set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats); + set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt); set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology); set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology); set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology); |