Blame SOURCES/0030-RHBZ-916528-override-queue-no-daemon.patch

4728c8
---
4728c8
 libmultipath/dict.c               |   10 ++++------
4728c8
 libmultipath/structs.h            |    2 +-
4728c8
 multipathd/cli.c                  |    3 +++
4728c8
 multipathd/cli.h                  |    2 ++
4728c8
 multipathd/cli_handlers.c         |   18 ++++++++++++++++++
4728c8
 multipathd/cli_handlers.h         |    2 ++
4728c8
 multipathd/main.c                 |    2 ++
4728c8
 multipathd/multipathd.init.redhat |   14 ++++++++++----
4728c8
 8 files changed, 42 insertions(+), 11 deletions(-)
4728c8
4728c8
Index: multipath-tools-130222/libmultipath/dict.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/dict.c
4728c8
+++ multipath-tools-130222/libmultipath/dict.c
4728c8
@@ -438,14 +438,11 @@ def_queue_without_daemon(vector strvec)
4728c8
 	if (!buff)
4728c8
 		return 1;
4728c8
 
4728c8
-	if (!strncmp(buff, "off", 3) || !strncmp(buff, "no", 2) ||
4728c8
-	    !strncmp(buff, "0", 1))
4728c8
-		conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
4728c8
-	else if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
4728c8
+	if (!strncmp(buff, "on", 2) || !strncmp(buff, "yes", 3) ||
4728c8
 		 !strncmp(buff, "1", 1))
4728c8
 		conf->queue_without_daemon = QUE_NO_DAEMON_ON;
4728c8
 	else
4728c8
-		conf->queue_without_daemon = QUE_NO_DAEMON_UNDEF;
4728c8
+		conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
4728c8
 
4728c8
 	free(buff);
4728c8
 	return 0;
4728c8
@@ -2670,8 +2667,9 @@ snprint_def_queue_without_daemon (char *
4728c8
 	case QUE_NO_DAEMON_OFF:
4728c8
 		return snprintf(buff, len, "\"no\"");
4728c8
 	case QUE_NO_DAEMON_ON:
4728c8
-	case QUE_NO_DAEMON_UNDEF:
4728c8
 		return snprintf(buff, len, "\"yes\"");
4728c8
+	case QUE_NO_DAEMON_FORCE:
4728c8
+		return snprintf(buff, len, "\"forced\"");
4728c8
 	}
4728c8
 	return 0;
4728c8
 }
4728c8
Index: multipath-tools-130222/libmultipath/structs.h
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/libmultipath/structs.h
4728c8
+++ multipath-tools-130222/libmultipath/structs.h
4728c8
@@ -67,9 +67,9 @@ enum pgstates {
4728c8
 };
4728c8
 
4728c8
 enum queue_without_daemon_states {
4728c8
-	QUE_NO_DAEMON_UNDEF,
4728c8
 	QUE_NO_DAEMON_OFF,
4728c8
 	QUE_NO_DAEMON_ON,
4728c8
+	QUE_NO_DAEMON_FORCE,
4728c8
 };
4728c8
 
4728c8
 enum pgtimeouts {
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
@@ -162,6 +162,7 @@ load_keys (void)
4728c8
 	r += add_key(keys, "resize", RESIZE, 0);
4728c8
 	r += add_key(keys, "reset", RESET, 0);
4728c8
 	r += add_key(keys, "reload", RELOAD, 0);
4728c8
+	r += add_key(keys, "forcequeueing", FORCEQ, 0);
4728c8
 	r += add_key(keys, "disablequeueing", DISABLEQ, 0);
4728c8
 	r += add_key(keys, "restorequeueing", RESTOREQ, 0);
4728c8
 	r += add_key(keys, "paths", PATHS, 0);
4728c8
@@ -459,6 +460,8 @@ cli_init (void) {
4728c8
 	add_handler(GETPRSTATUS+MAP, NULL);
4728c8
 	add_handler(SETPRSTATUS+MAP, NULL);
4728c8
 	add_handler(UNSETPRSTATUS+MAP, NULL);
4728c8
+	add_handler(FORCEQ+DAEMON, NULL);
4728c8
+	add_handler(RESTOREQ+DAEMON, NULL);
4728c8
 
4728c8
 	return 0;
4728c8
 }
4728c8
Index: multipath-tools-130222/multipathd/cli.h
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipathd/cli.h
4728c8
+++ multipath-tools-130222/multipathd/cli.h
4728c8
@@ -10,6 +10,7 @@ enum {
4728c8
 	__RESIZE,
4728c8
 	__RESET,
4728c8
 	__RELOAD,
4728c8
+	__FORCEQ,
4728c8
 	__DISABLEQ,
4728c8
 	__RESTOREQ,
4728c8
 	__PATHS,
4728c8
@@ -45,6 +46,7 @@ enum {
4728c8
 #define RESIZE		(1 << __RESIZE)
4728c8
 #define RESET		(1 << __RESET)
4728c8
 #define RELOAD		(1 << __RELOAD)
4728c8
+#define FORCEQ		(1 << __FORCEQ)
4728c8
 #define DISABLEQ	(1 << __DISABLEQ)
4728c8
 #define RESTOREQ	(1 << __RESTOREQ)
4728c8
 #define PATHS		(1 << __PATHS)
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
@@ -628,6 +628,24 @@ cli_resize(void *v, char **reply, int *l
4728c8
 }
4728c8
 
4728c8
 int
4728c8
+cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data)
4728c8
+{
4728c8
+	condlog(2, "force queue_without_daemon (operator)");
4728c8
+	if (conf->queue_without_daemon == QUE_NO_DAEMON_OFF)
4728c8
+		conf->queue_without_daemon = QUE_NO_DAEMON_FORCE;
4728c8
+	return 0;
4728c8
+}
4728c8
+
4728c8
+int
4728c8
+cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data)
4728c8
+{
4728c8
+	condlog(2, "restore queue_without_daemon (operator)");
4728c8
+	if (conf->queue_without_daemon == QUE_NO_DAEMON_FORCE)
4728c8
+		conf->queue_without_daemon = QUE_NO_DAEMON_OFF;
4728c8
+	return 0;
4728c8
+}
4728c8
+
4728c8
+int
4728c8
 cli_restore_queueing(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
@@ -28,6 +28,8 @@ int cli_suspend(void * v, char ** reply,
4728c8
 int cli_resume(void * v, char ** reply, int * len, void * data);
4728c8
 int cli_reinstate(void * v, char ** reply, int * len, void * data);
4728c8
 int cli_fail(void * v, char ** reply, int * len, void * data);
4728c8
+int cli_force_no_daemon_q(void * v, char ** reply, int * len, void * data);
4728c8
+int cli_restore_no_daemon_q(void * v, char ** reply, int * len, void * data);
4728c8
 int cli_quit(void * v, char ** reply, int * len, void * data);
4728c8
 int cli_shutdown(void * v, char ** reply, int * len, void * data);
4728c8
 int cli_reassign (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
@@ -904,6 +904,8 @@ uxlsnrloop (void * ap)
4728c8
 	set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus);
4728c8
 	set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus);
4728c8
 	set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus);
4728c8
+	set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q);
4728c8
+	set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q);
4728c8
 
4728c8
 	umask(077);
4728c8
 	uxsock_listen(&uxsock_trigger, ap);
4728c8
Index: multipath-tools-130222/multipathd/multipathd.init.redhat
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipathd/multipathd.init.redhat
4728c8
+++ multipath-tools-130222/multipathd/multipathd.init.redhat
4728c8
@@ -81,23 +81,28 @@ force_stop() {
4728c8
 	echo
4728c8
 }
4728c8
 
4728c8
-stop() {
4728c8
+check_root() {
4728c8
         root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $1; }}' /etc/mtab)
4728c8
 	dm_num=`dmsetup info -c --noheadings -o minor $root_dev 2> /dev/null`
4728c8
 	if [ $? -eq 0 ]; then
4728c8
 		root_dm_device="dm-$dm_num"
4728c8
 		[ -d $syspath/$root_dm_device ] && teardown_slaves $syspath/$root_dm_device
4728c8
 	fi
4728c8
+}
4728c8
 
4728c8
-	force_stop
4728c8
+force_queue_without_daemon() {
4728c8
+	$DAEMON forcequeueing daemon
4728c8
 }
4728c8
 
4728c8
 restart() {
4728c8
-	stop
4728c8
+	force_queue_without_daemon
4728c8
+	check_root
4728c8
+	force_stop
4728c8
 	start
4728c8
 }
4728c8
 
4728c8
 force_restart() {
4728c8
+	force_queue_without_daemon
4728c8
 	force_stop
4728c8
 	start
4728c8
 }
4728c8
@@ -115,7 +120,8 @@ start)
4728c8
 	start
4728c8
 	;;
4728c8
 stop)
4728c8
-	stop
4728c8
+	check_root
4728c8
+	force_stop
4728c8
 	;;
4728c8
 force-stop)
4728c8
 	force_stop