Blame SOURCES/0205-RHBZ-1416569-reset-stats.patch

4728c8
---
4728c8
 multipathd/cli.c          |    2 ++
4728c8
 multipathd/cli_handlers.c |   44 ++++++++++++++++++++++++++++++++++++++++++++
4728c8
 multipathd/cli_handlers.h |    2 ++
4728c8
 multipathd/main.c         |    2 ++
4728c8
 multipathd/multipathd.8   |    6 ++++++
4728c8
 5 files changed, 56 insertions(+)
4728c8
4728c8
Index: multipath-tools-130222/multipathd/cli.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipathd/cli.c
4728c8
+++ multipath-tools-130222/multipathd/cli.c
4728c8
@@ -482,6 +482,8 @@ cli_init (void) {
4728c8
 	add_handler(LIST+BLACKLIST, NULL);
4728c8
 	add_handler(LIST+DEVICES, NULL);
4728c8
 	add_handler(LIST+WILDCARDS, NULL);
4728c8
+	add_handler(RESET+MAPS+STATS, NULL);
4728c8
+	add_handler(RESET+MAP+STATS, NULL);
4728c8
 	add_handler(ADD+PATH, NULL);
4728c8
 	add_handler(DEL+PATH, NULL);
4728c8
 	add_handler(ADD+MAP, NULL);
4728c8
Index: multipath-tools-130222/multipathd/cli_handlers.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
4728c8
+++ multipath-tools-130222/multipathd/cli_handlers.c
4728c8
@@ -233,6 +233,17 @@ show_config (char ** r, int * len)
4728c8
 	return 0;
4728c8
 }
4728c8
 
4728c8
+void
4728c8
+reset_stats(struct multipath * mpp)
4728c8
+{
4728c8
+	mpp->stat_switchgroup = 0;
4728c8
+	mpp->stat_path_failures = 0;
4728c8
+	mpp->stat_map_loads = 0;
4728c8
+	mpp->stat_total_queueing_time = 0;
4728c8
+	mpp->stat_queueing_timeouts = 0;
4728c8
+	mpp->stat_map_failures = 0;
4728c8
+}
4728c8
+
4728c8
 int
4728c8
 cli_list_config (void * v, char ** reply, int * len, void * data)
4728c8
 {
4728c8
@@ -501,6 +512,39 @@ cli_list_daemon (void * v, char ** reply
4728c8
 }
4728c8
 
4728c8
 int
4728c8
+cli_reset_maps_stats (void * v, char ** reply, int * len, void * data)
4728c8
+{
4728c8
+	struct vectors * vecs = (struct vectors *)data;
4728c8
+	int i;
4728c8
+	struct multipath * mpp;
4728c8
+
4728c8
+	condlog(3, "reset multipaths stats (operator)");
4728c8
+
4728c8
+	vector_foreach_slot(vecs->mpvec, mpp, i) {
4728c8
+		reset_stats(mpp);
4728c8
+	}
4728c8
+	return 0;
4728c8
+}
4728c8
+
4728c8
+int
4728c8
+cli_reset_map_stats (void * v, char ** reply, int * len, void * data)
4728c8
+{
4728c8
+	struct vectors * vecs = (struct vectors *)data;
4728c8
+	struct multipath * mpp;
4728c8
+	char * param = get_keyparam(v, MAP);
4728c8
+
4728c8
+	param = convert_dev(param, 0);
4728c8
+	mpp = find_mp_by_str(vecs->mpvec, param);
4728c8
+
4728c8
+	if (!mpp)
4728c8
+		return 1;
4728c8
+
4728c8
+	condlog(3, "reset multipath %s stats (operator)", param);
4728c8
+	reset_stats(mpp);
4728c8
+	return 0;
4728c8
+}
4728c8
+
4728c8
+int
4728c8
 cli_add_path (void * v, char ** reply, int * len, void * data)
4728c8
 {
4728c8
 	struct vectors * vecs = (struct vectors *)data;
4728c8
Index: multipath-tools-130222/multipathd/cli_handlers.h
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipathd/cli_handlers.h
4728c8
+++ multipath-tools-130222/multipathd/cli_handlers.h
4728c8
@@ -16,6 +16,8 @@ int cli_list_config (void * v, char ** r
4728c8
 int cli_list_blacklist (void * v, char ** reply, int * len, void * data);
4728c8
 int cli_list_devices (void * v, char ** reply, int * len, void * data);
4728c8
 int cli_list_wildcards (void * v, char ** reply, int * len, void * data);
4728c8
+int cli_reset_maps_stats (void * v, char ** reply, int * len, void * data);
4728c8
+int cli_reset_map_stats (void * v, char ** reply, int * len, void * data);
4728c8
 int cli_add_path (void * v, char ** reply, int * len, void * data);
4728c8
 int cli_del_path (void * v, char ** reply, int * len, void * data);
4728c8
 int cli_add_map (void * v, char ** reply, int * len, void * data);
4728c8
Index: multipath-tools-130222/multipathd/main.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipathd/main.c
4728c8
+++ multipath-tools-130222/multipathd/main.c
4728c8
@@ -1011,6 +1011,8 @@ uxlsnrloop (void * ap)
4728c8
 	set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
4728c8
 	set_handler_callback(LIST+DEVICES, cli_list_devices);
4728c8
 	set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
4728c8
+	set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats);
4728c8
+	set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats);
4728c8
 	set_handler_callback(ADD+PATH, cli_add_path);
4728c8
 	set_handler_callback(DEL+PATH, cli_del_path);
4728c8
 	set_handler_callback(ADD+MAP, cli_add_map);
4728c8
Index: multipath-tools-130222/multipathd/multipathd.8
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipathd/multipathd.8
4728c8
+++ multipath-tools-130222/multipathd/multipathd.8
4728c8
@@ -87,6 +87,12 @@ Show all available block devices by name
4728c8
 .B list|show status
4728c8
 Show the number of path checkers in each possible state, the number of monitored paths, and whether multipathd is currently handling a uevent.
4728c8
 .TP
4728c8
+.B reset maps|multipaths stats
4728c8
+Reset the stat counters for all multipath devices.
4728c8
+.TP
4728c8
+.B reset map|multipath $map stats
4728c8
+Reset the stat counters for a specific multipath device.
4728c8
+.TP
4728c8
 .B add path $path
4728c8
 Add a path to the list of monitored paths. $path is as listed in /sys/block (e.g. sda).
4728c8
 .TP