Blob Blame History Raw
---
 multipathd/cli.c          |    2 ++
 multipathd/cli_handlers.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
 multipathd/cli_handlers.h |    2 ++
 multipathd/main.c         |    2 ++
 4 files changed, 50 insertions(+)

Index: multipath-tools-130222/multipathd/cli.c
===================================================================
--- multipath-tools-130222.orig/multipathd/cli.c
+++ multipath-tools-130222/multipathd/cli.c
@@ -482,6 +482,8 @@ cli_init (void) {
 	add_handler(LIST+BLACKLIST, NULL);
 	add_handler(LIST+DEVICES, NULL);
 	add_handler(LIST+WILDCARDS, NULL);
+	add_handler(RESET+MAPS+STATS, NULL);
+	add_handler(RESET+MAP+STATS, NULL);
 	add_handler(ADD+PATH, NULL);
 	add_handler(DEL+PATH, NULL);
 	add_handler(ADD+MAP, NULL);
Index: multipath-tools-130222/multipathd/cli_handlers.c
===================================================================
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
+++ multipath-tools-130222/multipathd/cli_handlers.c
@@ -233,6 +233,17 @@ show_config (char ** r, int * len)
 	return 0;
 }
 
+void
+reset_stats(struct multipath * mpp)
+{
+	mpp->stat_switchgroup = 0;
+	mpp->stat_path_failures = 0;
+	mpp->stat_map_loads = 0;
+	mpp->stat_total_queueing_time = 0;
+	mpp->stat_queueing_timeouts = 0;
+	mpp->stat_map_failures = 0;
+}
+
 int
 cli_list_config (void * v, char ** reply, int * len, void * data)
 {
@@ -501,6 +512,39 @@ cli_list_daemon (void * v, char ** reply
 }
 
 int
+cli_reset_maps_stats (void * v, char ** reply, int * len, void * data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+	int i;
+	struct multipath * mpp;
+
+	condlog(3, "reset multipaths stats (operator)");
+
+	vector_foreach_slot(vecs->mpvec, mpp, i) {
+		reset_stats(mpp);
+	}
+	return 0;
+}
+
+int
+cli_reset_map_stats (void * v, char ** reply, int * len, void * data)
+{
+	struct vectors * vecs = (struct vectors *)data;
+	struct multipath * mpp;
+	char * param = get_keyparam(v, MAP);
+
+	param = convert_dev(param, 0);
+	mpp = find_mp_by_str(vecs->mpvec, param);
+
+	if (!mpp)
+		return 1;
+
+	condlog(3, "reset multipath %s stats (operator)", param);
+	reset_stats(mpp);
+	return 0;
+}
+
+int
 cli_add_path (void * v, char ** reply, int * len, void * data)
 {
 	struct vectors * vecs = (struct vectors *)data;
Index: multipath-tools-130222/multipathd/cli_handlers.h
===================================================================
--- multipath-tools-130222.orig/multipathd/cli_handlers.h
+++ multipath-tools-130222/multipathd/cli_handlers.h
@@ -16,6 +16,8 @@ int cli_list_config (void * v, char ** r
 int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
 int cli_list_devices (void * v, char ** reply, int * len, void * data);
 int cli_list_wildcards (void * v, char ** reply, int * len, void * data);
+int cli_reset_maps_stats (void * v, char ** reply, int * len, void * data);
+int cli_reset_map_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);
Index: multipath-tools-130222/multipathd/main.c
===================================================================
--- multipath-tools-130222.orig/multipathd/main.c
+++ multipath-tools-130222/multipathd/main.c
@@ -1011,6 +1011,8 @@ uxlsnrloop (void * ap)
 	set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
 	set_handler_callback(LIST+DEVICES, cli_list_devices);
 	set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
+	set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats);
+	set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats);
 	set_handler_callback(ADD+PATH, cli_add_path);
 	set_handler_callback(DEL+PATH, cli_del_path);
 	set_handler_callback(ADD+MAP, cli_add_map);