[multipathd] add "show maps format ..." cli command
authorChristophe Varoqui <christophe.varoqui@free.fr>
Thu, 13 Nov 2008 22:52:20 +0000 (23:52 +0100)
committerChristophe Varoqui <christophe.varoqui@free.fr>
Thu, 13 Nov 2008 22:52:20 +0000 (23:52 +0100)
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

multipathd/cli.c
multipathd/cli_handlers.c
multipathd/cli_handlers.h
multipathd/main.c

index b4b4d1e..c93aa83 100644 (file)
@@ -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);
index e453220..6cf232a 100644 (file)
@@ -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;
index cef9864..f57a160 100644 (file)
@@ -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);
index 0d4c355..25fc41e 100644 (file)
@@ -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);