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

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