@@ -425,6 +425,7 @@ cli_init (void) {
add_handler(LIST+PATHS, NULL);
add_handler(LIST+PATHS+FMT, NULL);
+ add_handler(LIST+PATH, NULL);
add_handler(LIST+STATUS, NULL);
add_handler(LIST+DAEMON, NULL);
add_handler(LIST+MAPS, NULL);
@@ -71,6 +71,35 @@ show_paths (char ** r, int * len, struct vectors * vecs, char * style)
}
int
+show_path (char ** r, int * len, struct vectors * vecs, struct path *pp,
+ char * style)
+{
+ char * c;
+ char * reply;
+ unsigned int maxlen = INITIAL_REPLY_LEN;
+ int again = 1;
+
+ get_path_layout(vecs->pathvec, 1);
+ reply = MALLOC(maxlen);
+
+ while (again) {
+ if (!reply)
+ return 1;
+
+ c = reply;
+
+ c += snprint_path(c, reply + maxlen - c, style, pp);
+
+ again = ((c - reply) == (maxlen - 1));
+
+ REALLOC_REPLY(reply, again, maxlen);
+ }
+ *r = reply;
+ *len = (int)(c - reply + 1);
+ return 0;
+}
+
+int
show_map_topology (char ** r, int * len, struct multipath * mpp,
struct vectors * vecs)
{
@@ -239,6 +268,21 @@ cli_list_paths_fmt (void * v, char ** reply, int * len, void * data)
}
int
+cli_list_path (void * v, char ** reply, int * len, void * data)
+{
+ struct vectors * vecs = (struct vectors *)data;
+ char * param = get_keyparam(v, PATH);
+ struct path *pp;
+
+ param = convert_dev(param, 1);
+ condlog(3, "%s: list path (operator)", param);
+
+ pp = find_path_by_dev(vecs->pathvec, param);
+
+ return show_path(reply, len, vecs, pp, "%o");
+}
+
+int
cli_list_map_topology (void * v, char ** reply, int * len, void * data)
{
struct multipath * mpp;
@@ -1,5 +1,6 @@
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_path (void * v, char ** reply, int * len, void * data);
int cli_list_status (void * v, char ** reply, int * len, void * data);
int cli_list_daemon (void * v, char ** reply, int * len, void * data);
int cli_list_maps (void * v, char ** reply, int * len, void * data);
@@ -886,6 +886,7 @@ uxlsnrloop (void * ap)
set_handler_callback(LIST+PATHS, cli_list_paths);
set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt);
+ set_handler_callback(LIST+PATH, cli_list_path);
set_handler_callback(LIST+MAPS, cli_list_maps);
set_handler_callback(LIST+STATUS, cli_list_status);
set_handler_callback(LIST+DAEMON, cli_list_daemon);
Implement CLI command for printing the status of a single path. Signed-off-by: Hannes Reinecke <hare@suse.de> --- multipathd/cli.c | 1 + multipathd/cli_handlers.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ multipathd/cli_handlers.h | 1 + multipathd/main.c | 1 + 4 files changed, 47 insertions(+)