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