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

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