Merge the 'path count' cli command with 'show status'. 0.4.9 upstream/0.4.9
authorChristophe Varoqui <christophe.varoqui@opensvc.com>
Sat, 22 May 2010 12:01:58 +0000 (14:01 +0200)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Sat, 22 May 2010 12:01:58 +0000 (14:01 +0200)
Document 'show status' in the multipathd manpage.

libmultipath/print.c
multipathd/cli.c
multipathd/cli.h
multipathd/cli_handlers.c
multipathd/cli_handlers.h
multipathd/main.c
multipathd/multipathd.8

index 9753fe2d78fe6022551f7ad95b8ab107b5c4cd5b..4279fe9dbf21a1d557b91fdc9543d72fd47e8a1e 100644 (file)
@@ -23,6 +23,7 @@
 #include "blacklist.h"
 #include "switchgroup.h"
 #include "devmapper.h"
+#include "uevent.h"
 
 #define MAX(x,y) (x > y) ? x : y
 #define TAIL     (line + len - 1 - c)
@@ -1236,6 +1237,14 @@ snprint_status (char * buff, int len, struct vectors *vecs)
                                checker_state_name(i), count[i]);
        }
 
+        int monitored_count = 0;
+
+        vector_foreach_slot(vecs->pathvec, pp, i)
+                if (pp->fd != -1)
+                        monitored_count++;
+        fwd += snprintf(buff + fwd, len - fwd, "\npaths: %d\nbusy: %s\n",
+                       monitored_count, is_uevent_busy()? "True" : "False");
+
        if (fwd > len)
                return len;
        return fwd;
index 741e3d6f695c39f86fcd6e006ecd695768b989f9..208a0ade6848d005bf5124490fcba32e65c43c63 100644 (file)
@@ -174,7 +174,6 @@ load_keys (void)
        r += add_key(keys, "devices", DEVICES, 0);
        r += add_key(keys, "format", FMT, 1);
        r += add_key(keys, "wildcards", WILDCARDS, 0);
-       r += add_key(keys, "count", COUNT, 0);
        r += add_key(keys, "quit", QUIT, 0);
        r += add_key(keys, "exit", QUIT, 0);
 
@@ -444,7 +443,6 @@ cli_init (void) {
        add_handler(RESTOREQ+MAPS, NULL);
        add_handler(REINSTATE+PATH, NULL);
        add_handler(FAIL+PATH, NULL);
-       add_handler(COUNT+PATHS, NULL);
        add_handler(QUIT, NULL);
 
        return 0;
index 05de4e31a370062eba302709a4d02f2f1e6e3626..1a19e4ce92a400c24c4077ee9424d3b3f3d41750 100644 (file)
@@ -23,7 +23,6 @@ enum {
        __BLACKLIST,
        __DEVICES,
        __FMT,
-       __COUNT,
        __WILDCARDS,
        __QUIT,
 };
index 0542fdee846c26c407a67f815cf5bf0ebc24b7c8..71a73ff973ca114cc19921707d45afe6abdb5683 100644 (file)
 
 #include "main.h"
 #include "cli.h"
-#include "uevent.h"
-
-int
-count_paths(char  **r, int *l, struct vectors *vecs)
-{
-       int i, len;
-       struct path *pp;
-       char * reply;
-       unsigned int maxlen = INITIAL_REPLY_LEN;
-       int monitored_count = 0;
-
-       reply = MALLOC(maxlen);
-       if (!reply)
-               return 1;
-       vector_foreach_slot(vecs->pathvec, pp, i)
-               if (pp->fd != -1)
-                       monitored_count++;
-       len = sprintf(reply, "Paths: %d\nBusy: %s\n", monitored_count,
-                   is_uevent_busy()? "True" : "False");
-       *r = reply;
-       *l = len + 1;
-       return 0;
-}
 
 int
 show_paths (char ** r, int * len, struct vectors * vecs, char * style)
@@ -198,16 +175,6 @@ cli_list_config (void * v, char ** reply, int * len, void * data)
        return show_config(reply, len);
 }
 
-int
-cli_count_paths (void * v, char ** reply, int * len, void * data)
-{
-       struct vectors * vecs = (struct vectors *)data;
-
-       condlog(3, "count paths (operator)");
-
-       return count_paths(reply, len, vecs);
-}
-
 int
 cli_list_paths (void * v, char ** reply, int * len, void * data)
 {
index 71009b7080daefa460f790248fc8a1646294066c..b3ad3770bdbeb77e6ee299a92a1c305678903e08 100644 (file)
@@ -25,6 +25,5 @@ int cli_restore_all_queueing(void * v, char ** reply, int * len, void * data);
 int cli_suspend(void * v, char ** reply, int * len, void * data);
 int cli_resume(void * v, char ** reply, int * len, void * data);
 int cli_reinstate(void * v, char ** reply, int * len, void * data);
-int cli_count_paths(void * v, char ** reply, int * len, void * data);
 int cli_fail(void * v, char ** reply, int * len, void * data);
 int cli_quit(void * v, char ** reply, int * len, void * data);
index 3d9ff31e7ac4df7362d96b4cafb5ec235475a803..6ee790305b6039893d20c95995afa6c6f0e142d9 100644 (file)
@@ -783,7 +783,6 @@ uxlsnrloop (void * ap)
        set_handler_callback(RESTOREQ+MAP, cli_restore_queueing);
        set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing);
        set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing);
-       set_handler_callback(COUNT+PATHS, cli_count_paths);
        set_handler_callback(QUIT, cli_quit);
 
        umask(077);
index 5ab7330e63bef4ec159f36c28f191b97505cd4bd..c63185c121aa9b417129dc8b64a54ac8ccd9228d 100644 (file)
@@ -63,16 +63,15 @@ Show the currently used blacklist rules, derived from default values and values
 .B list|show devices
 Show all available block devices by name including the information if they are blacklisted or not.
 .TP
+.B list|show status
+Show the number of path checkers in each possible state, the number of monitored paths, and whether multipathd is currently handling a uevent.
+.TP
 .B add path $path
 Add a path to the list of monitored paths. $path is as listed in /sys/block (e.g. sda).
 .TP 
 .B remove|del path $path
 Stop monitoring a path. $path is as listed in /sys/block (e.g. sda).
 .TP
-.B count paths
-Show the number of monitored paths, and whether multipathd is currently
-handling a uevent.
-.TP
 .B add map $map
 Add a multipath device to the list of monitored devices. $map can either be a device-mapper device as listed in /sys/block (e.g. dm-0) or it can be the alias for the multipath device (e.g. mpath1) or the uid of the multipath device (e.g. 36005076303ffc56200000000000010aa). 
 .TP