Blame SOURCES/0243-RHBZ-1498724-save-persist-options.patch

d3a483
---
d3a483
 libmpathpersist/mpath_persist.c  |    3 ++-
d3a483
 libmpathpersist/mpath_updatepr.c |   10 ++++++++--
d3a483
 libmpathpersist/mpathpr.h        |    3 ++-
d3a483
 libmultipath/Makefile            |    2 +-
d3a483
 libmultipath/config.h            |    2 ++
d3a483
 libmultipath/dict.c              |   24 ++++++++++++++++++------
d3a483
 libmultipath/prkey.c             |   25 ++++++++++++++++++++++---
d3a483
 libmultipath/prkey.h             |    4 ++--
d3a483
 libmultipath/propsel.c           |   13 ++++++++++---
d3a483
 libmultipath/structs.h           |    1 +
d3a483
 libmultipath/util.c              |   16 ++++++++++++++++
d3a483
 libmultipath/util.h              |    1 +
d3a483
 multipath/multipath.conf.5       |    8 ++++++--
d3a483
 multipathd/cli_handlers.c        |   15 ++++++++++-----
d3a483
 multipathd/main.c                |    1 +
d3a483
 15 files changed, 102 insertions(+), 26 deletions(-)
d3a483
d3a483
Index: multipath-tools-130222/libmultipath/config.h
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/config.h
d3a483
+++ multipath-tools-130222/libmultipath/config.h
d3a483
@@ -86,6 +86,7 @@ struct mpentry {
d3a483
 	char * prio_args;
d3a483
 	int prkey_source;
d3a483
 	struct be64 reservation_key;
d3a483
+	uint8_t sa_flags;
d3a483
 	int pgpolicy;
d3a483
 	int pgfailback;
d3a483
 	int rr_weight;
d3a483
@@ -183,6 +184,7 @@ struct config {
d3a483
 	char * config_dir;
d3a483
 	int prkey_source;
d3a483
 	struct be64 reservation_key;
d3a483
+	uint8_t sa_flags;
d3a483
 
d3a483
 	vector keywords;
d3a483
 	vector mptable;
d3a483
Index: multipath-tools-130222/libmultipath/structs.h
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/structs.h
d3a483
+++ multipath-tools-130222/libmultipath/structs.h
d3a483
@@ -331,6 +331,7 @@ struct multipath {
d3a483
 	struct be64 reservation_key;
d3a483
 	unsigned char prflag;
d3a483
 	int all_tg_pt;
d3a483
+	uint8_t sa_flags;
d3a483
 };
d3a483
 
d3a483
 struct pathgroup {
d3a483
Index: multipath-tools-130222/libmultipath/util.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/util.c
d3a483
+++ multipath-tools-130222/libmultipath/util.c
d3a483
@@ -6,6 +6,8 @@
d3a483
 #include <sys/vfs.h>
d3a483
 #include <linux/magic.h>
d3a483
 #include <errno.h>
d3a483
+#include <libudev.h>
d3a483
+#include <mpath_persist.h>
d3a483
 
d3a483
 #include "debug.h"
d3a483
 #include "memory.h"
d3a483
@@ -317,6 +319,20 @@ int parse_prkey(char *ptr, uint64_t *prk
d3a483
 	return 0;
d3a483
 }
d3a483
 
d3a483
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags)
d3a483
+{
d3a483
+	char *flagstr;
d3a483
+
d3a483
+	flagstr = strchr(ptr, ':');
d3a483
+	*flags = 0;
d3a483
+	if (flagstr) {
d3a483
+		*flagstr++ = '\0';
d3a483
+		if (strlen(flagstr) == 5 && strcmp(flagstr, "aptpl") == 0)
d3a483
+			*flags = MPATH_F_APTPL_MASK;
d3a483
+	}
d3a483
+	return parse_prkey(ptr, prkey);
d3a483
+}
d3a483
+
d3a483
 int safe_write(int fd, const void *buf, size_t count)
d3a483
 {
d3a483
 	while (count > 0) {
d3a483
Index: multipath-tools-130222/libmultipath/util.h
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/util.h
d3a483
+++ multipath-tools-130222/libmultipath/util.h
d3a483
@@ -15,6 +15,7 @@ dev_t parse_devt(const char *dev_t);
d3a483
 char *convert_dev(char *dev, int is_path_device);
d3a483
 int in_initrd(void);
d3a483
 int parse_prkey(char *ptr, uint64_t *prkey);
d3a483
+int parse_prkey_flags(char *ptr, uint64_t *prkey, uint8_t *flags);
d3a483
 int safe_write(int fd, const void *buf, size_t count);
d3a483
 
d3a483
 #define safe_sprintf(var, format, args...)	\
d3a483
Index: multipath-tools-130222/libmultipath/Makefile
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/Makefile
d3a483
+++ multipath-tools-130222/libmultipath/Makefile
d3a483
@@ -8,7 +8,7 @@ SONAME=0
d3a483
 DEVLIB = libmultipath.so
d3a483
 LIBS = $(DEVLIB).$(SONAME)
d3a483
 LIBDEPS = -lpthread -ldl -ldevmapper -ludev -L$(mpathcmddir) -lmpathcmd
d3a483
-CFLAGS += -fPIC -I$(mpathcmddir)
d3a483
+CFLAGS += -fPIC -I$(mpathcmddir) -I$(mpathpersistdir)
d3a483
 
d3a483
 OBJS = memory.o parser.o vector.o devmapper.o \
d3a483
        hwtable.o blacklist.o util.o dmparser.o config.o \
d3a483
Index: multipath-tools-130222/libmultipath/dict.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/dict.c
d3a483
+++ multipath-tools-130222/libmultipath/dict.c
d3a483
@@ -23,6 +23,8 @@
d3a483
 #include "util.h"
d3a483
 #include "prkey.h"
d3a483
 #include <inttypes.h>
d3a483
+#include <libudev.h>
d3a483
+#include <mpath_persist.h>
d3a483
 
d3a483
 /*
d3a483
  * default block handlers
d3a483
@@ -557,6 +559,7 @@ def_reservation_key_handler(vector strve
d3a483
 {
d3a483
 	char *buff;
d3a483
 	uint64_t prkey = 0;
d3a483
+	uint8_t flags;
d3a483
 
d3a483
 	buff = set_value(strvec);
d3a483
 	if (!buff)
d3a483
@@ -568,12 +571,13 @@ def_reservation_key_handler(vector strve
d3a483
 		FREE(buff);
d3a483
 		return 0;
d3a483
 	}
d3a483
-	else if (parse_prkey(buff, &prkey) != 0) {
d3a483
+	else if (parse_prkey_flags(buff, &prkey, &flags) != 0) {
d3a483
 		FREE(buff);
d3a483
 		return 1;
d3a483
 	}
d3a483
 
d3a483
 	conf->prkey_source = PRKEY_SOURCE_CONF;
d3a483
+	conf->sa_flags = flags;
d3a483
 	put_be64(conf->reservation_key, prkey);
d3a483
 	FREE(buff);
d3a483
 	return 0;
d3a483
@@ -2403,6 +2407,7 @@ mp_reservation_key_handler (vector strve
d3a483
 	char *buff;
d3a483
 	struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable);
d3a483
 	uint64_t prkey;
d3a483
+	uint8_t flags;
d3a483
 
d3a483
 	if (!mpe)
d3a483
 		return 1;
d3a483
@@ -2417,12 +2422,13 @@ mp_reservation_key_handler (vector strve
d3a483
 		FREE(buff);
d3a483
 		return 0;
d3a483
 	}
d3a483
-	else if (parse_prkey(buff, &prkey) != 0) {
d3a483
+	else if (parse_prkey_flags(buff, &prkey, &flags) != 0) {
d3a483
 		FREE(buff);
d3a483
 		return 1;
d3a483
 	}
d3a483
 
d3a483
 	mpe->prkey_source = PRKEY_SOURCE_CONF;
d3a483
+	mpe->sa_flags = flags;
d3a483
 	put_be64(mpe->reservation_key, prkey);
d3a483
 	FREE(buff);
d3a483
 	return 0;
d3a483
@@ -2838,14 +2844,17 @@ snprint_mp_prio_args(char * buff, int le
d3a483
 static int
d3a483
 snprint_mp_reservation_key (char * buff, int len, void * data)
d3a483
 {
d3a483
+	char *flagstr = "";
d3a483
 	struct mpentry * mpe = (struct mpentry *)data;
d3a483
 
d3a483
 	if (mpe->prkey_source == PRKEY_SOURCE_NONE)
d3a483
 		return 0;
d3a483
 	if (mpe->prkey_source == PRKEY_SOURCE_FILE)
d3a483
 		return snprintf(buff, len, "file");
d3a483
-	return snprintf(buff, len, "0x%" PRIx64,
d3a483
-			get_be64(mpe->reservation_key));
d3a483
+	if (mpe->sa_flags == MPATH_F_APTPL_MASK)
d3a483
+		flagstr = ":aptpl";
d3a483
+	return snprintf(buff, len, "0x%" PRIx64 "%s",
d3a483
+			get_be64(mpe->reservation_key), flagstr);
d3a483
 }
d3a483
 
d3a483
 static int
d3a483
@@ -3716,12 +3725,15 @@ snprint_def_prkeys_file (char * buff, in
d3a483
 static int
d3a483
 snprint_def_reservation_key(char * buff, int len, void * data)
d3a483
 {
d3a483
+	char *flagstr = "";
d3a483
 	if (conf->prkey_source == PRKEY_SOURCE_NONE)
d3a483
 		return 0;
d3a483
 	if (conf->prkey_source == PRKEY_SOURCE_FILE)
d3a483
 		return snprintf(buff, len, "file");
d3a483
-	return snprintf(buff, len, "0x%" PRIx64,
d3a483
-			get_be64(conf->reservation_key));
d3a483
+	if (conf->sa_flags == MPATH_F_APTPL_MASK)
d3a483
+		flagstr = ":aptpl";
d3a483
+	return snprintf(buff, len, "0x%" PRIx64 "%s",
d3a483
+			get_be64(conf->reservation_key), flagstr);
d3a483
 }
d3a483
 
d3a483
 static int
d3a483
Index: multipath-tools-130222/libmpathpersist/mpath_persist.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmpathpersist/mpath_persist.c
d3a483
+++ multipath-tools-130222/libmpathpersist/mpath_persist.c
d3a483
@@ -295,7 +295,8 @@ int mpath_persistent_reserve_out ( int f
d3a483
 	      rq_servact == MPATH_PROUT_REG_SA) ||
d3a483
 	     rq_servact == MPATH_PROUT_REG_IGN_SA)) {
d3a483
 		memcpy(&mpp->reservation_key, paramp->sa_key, 8);
d3a483
-		if (update_prkey(alias, get_be64(mpp->reservation_key))) {
d3a483
+		if (update_prkey_flags(alias, get_be64(mpp->reservation_key),
d3a483
+				       paramp->sa_flags)) {
d3a483
 			condlog(0, "%s: failed to set prkey for multipathd.",
d3a483
 				alias);
d3a483
 			ret = MPATH_PR_DMMP_ERROR;
d3a483
Index: multipath-tools-130222/libmpathpersist/mpath_updatepr.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmpathpersist/mpath_updatepr.c
d3a483
+++ multipath-tools-130222/libmpathpersist/mpath_updatepr.c
d3a483
@@ -15,6 +15,8 @@
d3a483
 #include <mpath_cmd.h>
d3a483
 #include <uxsock.h>
d3a483
 #include "memory.h"
d3a483
+#include <libudev.h>
d3a483
+#include <mpath_persist.h>
d3a483
 
d3a483
 unsigned long mem_allocated;    /* Total memory used in Bytes */
d3a483
 
d3a483
@@ -54,11 +56,15 @@ int update_prflag(char *mapname, int set
d3a483
 	return do_update_pr(mapname, (set)? "setprstatus" : "unsetprstatus");
d3a483
 }
d3a483
 
d3a483
-int update_prkey(char *mapname, uint64_t prkey) {
d3a483
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags) {
d3a483
 	char str[256];
d3a483
+	char *flagstr = "";
d3a483
 
d3a483
+	if (sa_flags & MPATH_F_APTPL_MASK)
d3a483
+		flagstr = ":aptpl";
d3a483
 	if (prkey)
d3a483
-		snprintf(str, sizeof(str), "setprkey key %" PRIx64, prkey);
d3a483
+		snprintf(str, sizeof(str), "setprkey key %" PRIx64 "%s", prkey,
d3a483
+			 flagstr);
d3a483
 	else
d3a483
 		snprintf(str, sizeof(str), "unsetprkey");
d3a483
 	return do_update_pr(mapname, str);
d3a483
Index: multipath-tools-130222/libmpathpersist/mpathpr.h
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmpathpersist/mpathpr.h
d3a483
+++ multipath-tools-130222/libmpathpersist/mpathpr.h
d3a483
@@ -50,7 +50,8 @@ int send_prout_activepath(char * dev, in
d3a483
         unsigned int rq_type,   struct prout_param_descriptor * paramp, int noisy);
d3a483
 
d3a483
 int update_prflag(char *mapname, int set);
d3a483
-int update_prkey(char *mapname, uint64_t prkey);
d3a483
+int update_prkey_flags(char *mapname, uint64_t prkey, uint8_t sa_flags);
d3a483
+#define update_prkey(mapname, prkey) update_prkey_flags(mapname, prkey, 0)
d3a483
 void * mpath_alloc_prin_response(int prin_sa);
d3a483
 int update_map_pr(struct multipath *mpp);
d3a483
 int devt2devname (char *devname, char *devt);
d3a483
Index: multipath-tools-130222/libmultipath/prkey.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/prkey.c
d3a483
+++ multipath-tools-130222/libmultipath/prkey.c
d3a483
@@ -11,6 +11,8 @@
d3a483
 #include <string.h>
d3a483
 #include <inttypes.h>
d3a483
 #include <errno.h>
d3a483
+#include <libudev.h>
d3a483
+#include <mpath_persist.h>
d3a483
 
d3a483
 #define KEYSIZE 19
d3a483
 #define PRKEY_READ 0
d3a483
@@ -109,7 +111,7 @@ static int do_prkey(int fd, char *wwid,
d3a483
 	return 0;
d3a483
 }
d3a483
 
d3a483
-int get_prkey(struct multipath *mpp, uint64_t *prkey)
d3a483
+int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags)
d3a483
 {
d3a483
 	int fd;
d3a483
 	int unused;
d3a483
@@ -125,6 +127,9 @@ int get_prkey(struct multipath *mpp, uin
d3a483
 	ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_READ);
d3a483
 	if (ret)
d3a483
 		goto out_file;
d3a483
+	*sa_flags = 0;
d3a483
+	if (strchr(keystr, 'X'))
d3a483
+		*sa_flags = MPATH_F_APTPL_MASK;
d3a483
 	ret = !!parse_prkey(keystr, prkey);
d3a483
 out_file:
d3a483
 	close(fd);
d3a483
@@ -132,7 +137,7 @@ out:
d3a483
 	return ret;
d3a483
 }
d3a483
 
d3a483
-int set_prkey(struct multipath *mpp, uint64_t prkey)
d3a483
+int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags)
d3a483
 {
d3a483
 	int fd;
d3a483
 	int can_write = 1;
d3a483
@@ -142,6 +147,12 @@ int set_prkey(struct multipath *mpp, uin
d3a483
 	if (!strlen(mpp->wwid))
d3a483
 		goto out;
d3a483
 
d3a483
+	if (sa_flags & ~MPATH_F_APTPL_MASK) {
d3a483
+		condlog(0, "unsupported pr flags, 0x%x",
d3a483
+			sa_flags & ~MPATH_F_APTPL_MASK);
d3a483
+		sa_flags &= MPATH_F_APTPL_MASK;
d3a483
+	}
d3a483
+
d3a483
 	fd = open_file(conf->prkeys_file, &can_write, PRKEYS_FILE_HEADER);
d3a483
 	if (fd < 0)
d3a483
 		goto out;
d3a483
@@ -150,7 +161,15 @@ int set_prkey(struct multipath *mpp, uin
d3a483
 		goto out_file;
d3a483
 	}
d3a483
 	if (prkey) {
d3a483
-		snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey);
d3a483
+		/* using the capitalization of the 'x' is a hack, but
d3a483
+		 * it's unlikely that mpath_persist will support more options
d3a483
+		 * since sg_persist doesn't, and this lets us keep the
d3a483
+		 * same file format as before instead of needing to change
d3a483
+		 * the format of the prkeys file */
d3a483
+		if (sa_flags)
d3a483
+			snprintf(keystr, KEYSIZE, "0X%016" PRIx64, prkey);
d3a483
+		else
d3a483
+			snprintf(keystr, KEYSIZE, "0x%016" PRIx64, prkey);
d3a483
 		keystr[KEYSIZE - 1] = '\0';
d3a483
 		ret = do_prkey(fd, mpp->wwid, keystr, PRKEY_WRITE);
d3a483
 	}
d3a483
Index: multipath-tools-130222/libmultipath/prkey.h
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/prkey.h
d3a483
+++ multipath-tools-130222/libmultipath/prkey.h
d3a483
@@ -13,7 +13,7 @@
d3a483
 "# prkey wwid\n" \
d3a483
 "#\n"
d3a483
 
d3a483
-int set_prkey(struct multipath *mpp, uint64_t prkey);
d3a483
-int get_prkey(struct multipath *mpp, uint64_t *prkey);
d3a483
+int set_prkey(struct multipath *mpp, uint64_t prkey, uint8_t sa_flags);
d3a483
+int get_prkey(struct multipath *mpp, uint64_t *prkey, uint8_t *sa_flags);
d3a483
 
d3a483
 #endif /* _PRKEY_H */
d3a483
Index: multipath-tools-130222/libmultipath/propsel.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/libmultipath/propsel.c
d3a483
+++ multipath-tools-130222/libmultipath/propsel.c
d3a483
@@ -20,6 +20,8 @@
d3a483
 #include "prioritizers/alua_rtpg.h"
d3a483
 #include "prkey.h"
d3a483
 #include <inttypes.h>
d3a483
+#include <libudev.h>
d3a483
+#include <mpath_persist.h>
d3a483
 
d3a483
 pgpolicyfn *pgpolicies[] = {
d3a483
 	NULL,
d3a483
@@ -715,10 +717,12 @@ select_reservation_key (struct multipath
d3a483
 	uint64_t prkey;
d3a483
 	char *origin = NULL;
d3a483
 	char *from_file = "";
d3a483
+	char *flagstr = "";
d3a483
 
d3a483
 	if (mp->mpe && mp->mpe->prkey_source != PRKEY_SOURCE_NONE) {
d3a483
 		mp->prkey_source = mp->mpe->prkey_source;
d3a483
 		mp->reservation_key = mp->mpe->reservation_key;
d3a483
+		mp->sa_flags = mp->mpe->sa_flags;
d3a483
 		origin = "multipath setting";
d3a483
 		goto out;
d3a483
 	}
d3a483
@@ -726,6 +730,7 @@ select_reservation_key (struct multipath
d3a483
 	if (conf->prkey_source != PRKEY_SOURCE_NONE) {
d3a483
 		mp->prkey_source = conf->prkey_source;
d3a483
 		mp->reservation_key = conf->reservation_key;
d3a483
+		mp->sa_flags = conf->sa_flags;
d3a483
 		origin = "config file default";
d3a483
 		goto out;
d3a483
 	}
d3a483
@@ -736,14 +741,16 @@ select_reservation_key (struct multipath
d3a483
 out:
d3a483
 	if (mp->prkey_source == PRKEY_SOURCE_FILE) {
d3a483
 		from_file = " (from prkeys file)";
d3a483
-		if (get_prkey(mp, &prkey) != 0)
d3a483
+		if (get_prkey(mp, &prkey, &mp->sa_flags) != 0)
d3a483
 			put_be64(mp->reservation_key, 0);
d3a483
 		else
d3a483
 			put_be64(mp->reservation_key, prkey);
d3a483
 	}
d3a483
+	if (mp->sa_flags & MPATH_F_APTPL_MASK)
d3a483
+		flagstr = ":aptpl";
d3a483
 	if (get_be64(mp->reservation_key))
d3a483
-		condlog(0, "%s: reservation_key = 0x%" PRIx64 " (%s)%s",
d3a483
-			mp->alias, get_be64(mp->reservation_key), origin,
d3a483
+		condlog(0, "%s: reservation_key = 0x%" PRIx64 "%s (%s)%s",
d3a483
+			mp->alias, get_be64(mp->reservation_key), flagstr, origin,
d3a483
 			from_file);
d3a483
 	return 0;
d3a483
 }
d3a483
Index: multipath-tools-130222/multipathd/cli_handlers.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
d3a483
+++ multipath-tools-130222/multipathd/cli_handlers.c
d3a483
@@ -17,6 +17,7 @@
d3a483
 #include <sysfs.h>
d3a483
 #include <errno.h>
d3a483
 #include <libudev.h>
d3a483
+#include <mpath_persist.h>
d3a483
 #include <util.h>
d3a483
 #include <prkey.h>
d3a483
 
d3a483
@@ -1242,6 +1243,7 @@ cli_getprkey(void * v, char ** reply, in
d3a483
 	struct multipath * mpp;
d3a483
 	struct vectors * vecs = (struct vectors *)data;
d3a483
 	char *mapname = get_keyparam(v, MAP);
d3a483
+	char *flagstr = "";
d3a483
 
d3a483
 	mapname = convert_dev(mapname, 0);
d3a483
 	condlog(3, "%s: get persistent reservation key (operator)", mapname);
d3a483
@@ -1257,8 +1259,10 @@ cli_getprkey(void * v, char ** reply, in
d3a483
 		*len = strlen(*reply) + 1;
d3a483
 		return 0;
d3a483
 	}
d3a483
-	snprintf(*reply, 20, "0x%" PRIx64 "\n",
d3a483
-		 get_be64(mpp->reservation_key));
d3a483
+	if (mpp->sa_flags & MPATH_F_APTPL_MASK)
d3a483
+		flagstr = ":aptpl";
d3a483
+	snprintf(*reply, 20, "0x%" PRIx64 "%s\n",
d3a483
+		 get_be64(mpp->reservation_key), flagstr);
d3a483
 	(*reply)[19] = '\0';
d3a483
 	*len = strlen(*reply) + 1;
d3a483
 	return 0;
d3a483
@@ -1278,7 +1282,7 @@ cli_unsetprkey(void * v, char ** reply,
d3a483
 	if (!mpp)
d3a483
 		return 1;
d3a483
 
d3a483
-	return set_prkey(mpp, 0);
d3a483
+	return set_prkey(mpp, 0, 0);
d3a483
 }
d3a483
 
d3a483
 int cli_setprkey(void * v, char ** reply, int * len, void * data)
d3a483
@@ -1288,6 +1292,7 @@ int cli_setprkey(void * v, char ** reply
d3a483
 	char *mapname = get_keyparam(v, MAP);
d3a483
 	char *keyparam = get_keyparam(v, KEY);
d3a483
 	uint64_t prkey;
d3a483
+	uint8_t flags;
d3a483
 
d3a483
 	mapname = convert_dev(mapname, 0);
d3a483
 	condlog(3, "%s: set persistent reservation key (operator)", mapname);
d3a483
@@ -1296,10 +1301,10 @@ int cli_setprkey(void * v, char ** reply
d3a483
 	if (!mpp)
d3a483
 		return 1;
d3a483
 
d3a483
-	if (parse_prkey(keyparam, &prkey) != 0) {
d3a483
+	if (parse_prkey_flags(keyparam, &prkey, &flags) != 0) {
d3a483
 		condlog(0, "%s: invalid prkey : '%s'", mapname, keyparam);
d3a483
 		return 1;
d3a483
 	}
d3a483
 
d3a483
-	return set_prkey(mpp, prkey);
d3a483
+	return set_prkey(mpp, prkey, flags);
d3a483
 }
d3a483
Index: multipath-tools-130222/multipathd/main.c
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/multipathd/main.c
d3a483
+++ multipath-tools-130222/multipathd/main.c
d3a483
@@ -2324,6 +2324,7 @@ void *  mpath_pr_event_handler_fn (void
d3a483
 
d3a483
 	param= malloc(sizeof(struct prout_param_descriptor));
d3a483
 	memset(param, 0 , sizeof(struct prout_param_descriptor));
d3a483
+	param->sa_flags = mpp->sa_flags;
d3a483
 	memcpy(param->sa_key, &mpp->reservation_key, 8);
d3a483
 	param->num_transportid = 0;
d3a483
 
d3a483
Index: multipath-tools-130222/multipath/multipath.conf.5
d3a483
===================================================================
d3a483
--- multipath-tools-130222.orig/multipath/multipath.conf.5
d3a483
+++ multipath-tools-130222/multipath/multipath.conf.5
d3a483
@@ -438,14 +438,18 @@ This is the service action reservation k
d3a483
 set for all multipath devices using persistent reservations, and it must be
d3a483
 the same as the RESERVATION KEY field of the PERSISTENT RESERVE OUT parameter
d3a483
 list which contains an 8-byte value provided by the application client to the
d3a483
-device server to identify the I_T nexus.
d3a483
+device server to identify the I_T nexus. If the \fI--param-aptpl\fR option is
d3a483
+used when registering the key with mpathpersist, \fB:aptpl\fR must be appended
d3a483
+to the end of the reservation key.
d3a483
+
d3a483
 .RS
d3a483
 .PP
d3a483
 Alternatively, this can be set to \fBfile\fR, which will store the RESERVATION
d3a483
 KEY registered by mpathpersist in the \fIprkeys_file\fR. multipathd will then
d3a483
 use this key to register additional paths as they appear.  When the
d3a483
 registration is removed, the RESERVATION KEY is removed from the
d3a483
-\fIprkeys_file\fR.
d3a483
+\fIprkeys_file\fR. The prkeys file will automatically keep track of whether
d3a483
+the key was registered with \fI--param-aptpl\fR.
d3a483
 It is unset by default.
d3a483
 .RE
d3a483
 .TP