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

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