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

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