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

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