summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Varoqui <christophe.varoqui@opensvc.com>2010-05-22 14:01:58 +0200
committerChristophe Varoqui <christophe.varoqui@opensvc.com>2010-05-22 14:01:58 +0200
commit17f14138e13b3ecbb37b86199739072f2c44c1a2 (patch)
tree27175fc6db2e89b0c6770e665820a2217d99addf
parent1098120a420ad7f892abab2801872d70c87ac3a3 (diff)
downloadmultipath-tools-17f14138e13b3ecbb37b86199739072f2c44c1a2.tar.gz
multipath-tools-17f14138e13b3ecbb37b86199739072f2c44c1a2.tar.bz2
multipath-tools-17f14138e13b3ecbb37b86199739072f2c44c1a2.zip
Merge the 'path count' cli command with 'show status'.upstream/0.4.90.4.9
Document 'show status' in the multipathd manpage.
-rw-r--r--libmultipath/print.c9
-rw-r--r--multipathd/cli.c2
-rw-r--r--multipathd/cli.h1
-rw-r--r--multipathd/cli_handlers.c33
-rw-r--r--multipathd/cli_handlers.h1
-rw-r--r--multipathd/main.c1
-rw-r--r--multipathd/multipathd.87
7 files changed, 12 insertions, 42 deletions
diff --git a/libmultipath/print.c b/libmultipath/print.c
index 9753fe2..4279fe9 100644
--- a/libmultipath/print.c
+++ b/libmultipath/print.c
@@ -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;
diff --git a/multipathd/cli.c b/multipathd/cli.c
index 741e3d6..208a0ad 100644
--- a/multipathd/cli.c
+++ b/multipathd/cli.c
@@ -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;
diff --git a/multipathd/cli.h b/multipathd/cli.h
index 05de4e3..1a19e4c 100644
--- a/multipathd/cli.h
+++ b/multipathd/cli.h
@@ -23,7 +23,6 @@ enum {
__BLACKLIST,
__DEVICES,
__FMT,
- __COUNT,
__WILDCARDS,
__QUIT,
};
diff --git a/multipathd/cli_handlers.c b/multipathd/cli_handlers.c
index 0542fde..71a73ff 100644
--- a/multipathd/cli_handlers.c
+++ b/multipathd/cli_handlers.c
@@ -18,29 +18,6 @@
#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)
@@ -199,16 +176,6 @@ cli_list_config (void * v, char ** reply, int * len, void * data)
}
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)
{
struct vectors * vecs = (struct vectors *)data;
diff --git a/multipathd/cli_handlers.h b/multipathd/cli_handlers.h
index 71009b7..b3ad377 100644
--- a/multipathd/cli_handlers.h
+++ b/multipathd/cli_handlers.h
@@ -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);
diff --git a/multipathd/main.c b/multipathd/main.c
index 3d9ff31..6ee7903 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -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);
diff --git a/multipathd/multipathd.8 b/multipathd/multipathd.8
index 5ab7330..c63185c 100644
--- a/multipathd/multipathd.8
+++ b/multipathd/multipathd.8
@@ -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