dm_switchgroup(mpp->alias, mpp->bestpg);
print_mp(mpp, conf->verbosity);
#else
+ mpp->stat_map_loads++;
condlog(2, "%s: load table [0 %llu %s %s]", mpp->alias,
mpp->size, DEFAULT_TARGET, mpp->params);
#endif
PRINT(c, TAIL, "dm-st");
PAD(7);
break;
+ case '0':
+ PRINT(c, TAIL, "path_fails");
+ PAD(10);
+ break;
+ case '1':
+ PRINT(c, TAIL, "switch_group");
+ PAD(12);
+ break;
+ case '2':
+ PRINT(c, TAIL, "map_loads");
+ PAD(9);
+ break;
+ case '3':
+ PRINT(c, TAIL, "total_queue_time");
+ PAD(16);
+ break;
+ case '4':
+ PRINT(c, TAIL, "queueing_tmo");
+ PAD(12);
+ break;
default:
break;
}
}
PAD(7);
break;
+ case '0':
+ PRINT(c, TAIL, "%i", mpp->stat_path_failures);
+ PAD(10);
+ break;
+ case '1':
+ PRINT(c, TAIL, "%i", mpp->stat_switchgroup);
+ PAD(12);
+ break;
+ case '2':
+ PRINT(c, TAIL, "%i", mpp->stat_map_loads);
+ PAD(9);
+ break;
+ case '3':
+ PRINT(c, TAIL, "%i", mpp->stat_total_queueing_time);
+ PAD(16);
+ break;
+ case '4':
+ PRINT(c, TAIL, "%i", mpp->stat_queueing_timeouts);
+ PAD(12);
+ break;
default:
break;
}
}
extern void
+print_multipath (struct multipath * mpp, char * style)
+{
+ char line[MAX_LINE_LEN];
+
+ snprint_map(&line[0], MAX_LINE_LEN, style, mpp);
+ printf("%s", line);
+}
+
+extern void
print_map (struct multipath * mpp)
{
if (mpp->size && mpp->params)
* %Q : queueing policy changer countdown (no_path_retry)
* %n : number of active paths
* %t : device mapper map status
+ * %0 : stat_path_failures
+ * %1 : stat_switchgroup
+ * %2 : stat_map_loads
+ * %3 : stat_total_queueing_time
+ * %4 : stat_queueing_timeouts
*/
#define PRINT_PATH_LONG "%w %i %d %D %p %t%T %s"
#define PRINT_PATH_INDENT " \\_ %i %d %D %t%T"
#define PRINT_PATH_CHECKER "%i %d %D %p %t%T %C"
#define PRINT_MAP_FAILBACK "%w %d %F %Q %n %t"
+#define PRINT_MAP_STATS "%w %d %0 %1 %2 %3 %4"
#define MAX_LINE_LEN 80
#define PROGRESS_LEN 10
void print_mp (struct multipath * mpp, int verbosity);
void print_path (struct path * pp, char * style);
+void print_multipath (struct multipath * mpp, char * style);
void print_map (struct multipath * mpp);
void print_all_paths (vector pathvec, int banner);
/* daemon store a data blob for DM event waiter threads */
void * waiter;
+
+ /* stats */
+ unsigned int stat_switchgroup;
+ unsigned int stat_path_failures;
+ unsigned int stat_map_loads;
+ unsigned int stat_total_queueing_time;
+ unsigned int stat_queueing_timeouts;
};
struct pathgroup {
r += add_key(keys, "dump", DUMP, 0);
r += add_key(keys, "pathvec", PATHVEC, 0);
r += add_key(keys, "reconfigure", RECONFIGURE, 0);
+ r += add_key(keys, "stats", STATS, 0);
if (r) {
free_keys(keys);
__GROUP,
__DUMP,
__PATHVEC,
- __RECONFIGURE
+ __RECONFIGURE,
+ __STATS,
};
#define LIST (1 << __LIST)
#define DUMP (1 << __DUMP)
#define PATHVEC (1 << __PATHVEC)
#define RECONFIGURE (1 << __RECONFIGURE)
+#define STATS (1 << __STATS)
#define INITIAL_REPLY_LEN 1000
#include <configure.h>
#include <blacklist.h>
#include <debug.h>
+#include <print.h>
#include "main.h"
#include "cli.h"
condlog(3, "list paths (operator)");
- return show_paths(reply, len, vecs);
+ return show_paths(reply, len, vecs, PRINT_PATH_CHECKER);
}
int
condlog(3, "list maps (operator)");
- return show_maps(reply, len, vecs);
+ return show_maps(reply, len, vecs, PRINT_MAP_FAILBACK);
+}
+
+int
+cli_list_maps_stats (void * v, char ** reply, int * len, void * data)
+{
+ struct vectors * vecs = (struct vectors *)data;
+
+ condlog(3, "list maps (operator)");
+
+ return show_maps(reply, len, vecs, PRINT_MAP_STATS);
}
int
int cli_list_paths (void * v, char ** reply, int * len, void * data);
int cli_list_maps (void * v, char ** reply, int * len, void * data);
+int cli_list_maps_stats (void * v, char ** reply, int * len, void * data);
int cli_add_path (void * v, char ** reply, int * len, void * data);
int cli_del_path (void * v, char ** reply, int * len, void * data);
int cli_add_map (void * v, char ** reply, int * len, void * data);
* meaning of +1: retry_tick may be decremented in
* checkerloop before starting retry.
*/
+ mpp->stat_queueing_timeouts++;
mpp->retry_tick = mpp->no_path_retry * conf->checkint + 1;
condlog(1, "%s: Entering recovery mode: max_retries=%d",
mpp->alias, mpp->no_path_retry);
static void
switch_pathgroup (struct multipath * mpp)
{
+ mpp->stat_switchgroup++;
dm_switchgroup(mpp->alias, mpp->bestpg);
condlog(2, "%s: switch to path group #%i",
mpp->alias, mpp->bestpg);
if (pp->state != PATH_DOWN) {
condlog(2, "%s: mark as failed", pp->dev_t);
+ mpp->stat_path_failures++;
pp->state = PATH_DOWN;
update_queue_mode_del_path(mpp);
}
int
-show_paths (char ** r, int * len, struct vectors * vecs)
+show_paths (char ** r, int * len, struct vectors * vecs, char * style)
{
int i;
struct path * pp;
if (VECTOR_SIZE(vecs->pathvec) > 0)
c += snprint_path_header(c, reply + maxlen - c,
- PRINT_PATH_CHECKER);
+ style);
vector_foreach_slot(vecs->pathvec, pp, i)
c += snprint_path(c, reply + maxlen - c,
- PRINT_PATH_CHECKER, pp);
+ style, pp);
again = ((c - reply) == (maxlen - 1));
}
int
-show_maps (char ** r, int *len, struct vectors * vecs)
+show_maps (char ** r, int *len, struct vectors * vecs, char * style)
{
int i;
struct multipath * mpp;
c = reply;
if (VECTOR_SIZE(vecs->mpvec) > 0)
c += snprint_map_header(c, reply + maxlen - c,
- PRINT_MAP_FAILBACK);
+ style);
vector_foreach_slot(vecs->mpvec, mpp, i)
c += snprint_map(c, reply + maxlen - c,
- PRINT_MAP_FAILBACK, mpp);
+ style, mpp);
again = ((c - reply) == (maxlen - 1));
add_handler(LIST+PATHS, cli_list_paths);
add_handler(LIST+MAPS, cli_list_maps);
+ add_handler(LIST+MAPS+STATS, cli_list_maps_stats);
add_handler(ADD+PATH, cli_add_path);
add_handler(DEL+PATH, cli_del_path);
add_handler(ADD+MAP, cli_add_map);
vector_foreach_slot (mpvec, mpp, i) {
if (mpp->retry_tick) {
+ mpp->stat_total_queueing_time++;
condlog(4, "%s: Retrying.. No active path", mpp->alias);
if(--mpp->retry_tick == 0) {
dm_queue_if_no_path(mpp->alias, 0);
*/
pp->mpp->failback_tick = 0;
+ pp->mpp->stat_path_failures++;
continue;
}
#define MAX_CHECKINT CHECKINT << 2
int reconfigure (struct vectors *);
-int show_paths (char **, int *, struct vectors *);
-int show_maps (char **, int *, struct vectors *);
+int show_paths (char **, int *, struct vectors *, char *);
+int show_maps (char **, int *, struct vectors *, char *);
int dump_pathvec (char **, int *, struct vectors *);
int ev_add_path (char *, struct vectors *);
int ev_remove_path (char *, struct vectors *);