device-mapper-multipath/0151-RHBZ-1297456-weighted-fix.patch
Benjamin Marzinski 6738b34a0b device-mapper-multipath-0.4.9-82
- Modify 0005-RH-add-mpathconf.patch
  * changed warning message
- Modify 0102-RHBZ-1160478-mpathconf-template.patch
  * updated man page
- Modify 0104-RHBZ-631009-deferred-remove.patch
  * refactor code and minor fix
- Refresh 0107-RHBZ-1169935-no-new-devs.patch
- Refresh 0112-RHBZ-1194917-add-config_dir-option.patch
- Refresh 0126-RHBZ-1211383-alias-collision.patch
- Add 0133-RHBZ-1296979-fix-define.patch
  * look for the correct libudev function to set define
- Add 0134-RHBZ-1241528-check-mpath-prefix.patch
  * only touch devices with a "mpath-" dm uuid prefix
- Add 0135-RHBZ-1299600-path-dev-uevents.patch
  * trigger path uevent the first time a path is claimed by multipath
- Add 0136-RHBZ-1304687-wait-for-map-add.patch
  * wait for the device to finish being added before reloading it.
- Add 0137-RHBZ-1280524-clear-chkr-msg.patch
- Add 0138-RHBZ-1288660-fix-mpathconf-allow.patch
  * don't remove existing lines from blacklist_exceptions section
- Add 0139-RHBZ-1273173-queue-no-daemon-doc.patch
- Add 0140-RHBZ-1299647-fix-help.patch
- Add 0141-RHBZ-1303953-mpathpersist-typo.patch
- Add 0142-RHBZ-1283750-kpartx-fix.patch
  * only remove devices if their uuid says that they are the correct
    partition device
- Add 0143-RHBZ-1299648-kpartx-sync.patch
  * default to using udev sync mode
- Add 0144-RHBZ-1299652-alua-pref-arg.patch
  * allow "exclusive_pref_bit" argument to alua prioritizer
- Add 0145-UP-resize-help-msg.patch
- Add 0146-UPBZ-1299651-raw-output.patch
  * allow raw format mutipathd show commands, that remove headers and padding
- Add 0147-RHBZ-1272620-fail-rm-msg.patch
- Add 0148-RHBZ-1292599-verify-before-remove.patch
  * verify that all partitions are unused before attempting to remove a device
- Add 0149-RHBZ-1292599-restore-removed-parts.patch
  * don't disable kpartx when restoring the first path of a device.
- Add 0150-RHBZ-1253913-fix-startup-msg.patch
  * wait for multipathd daemon to write pidfile before returning
- Add 0151-RHBZ-1297456-weighted-fix.patch
  * add wwn keyword to weighted prioritizer for persistent naming
- Add 0152-RHBZ-1269293-fix-blk-unit-file.patch
  * use "Wants" instead of "Requires"
- Add 0153-RH-fix-i686-size-bug.patch
  * use 64-bit keycodes for multipathd client commands
- Add 0154-UPBZ-1291406-disable-reinstate.patch
  * don't automatically reinstate ghost paths for implicit alua devices
- Add 0155-UPBZ-1300415-PURE-config.patch
  * Add default config for PURE FlashArray
- Add 0156-UPBZ-1313324-dont-fail-discovery.patch
  * don't fail discovery because individual paths failed.
- Add 0157-RHBZ-1319853-multipath-c-error-msg.patch
  * better error reporting for multipath -c
- Add 0158-RHBZ-1318581-timestamp-doc-fix.patch
  * add documentation for -T
- Add 0159-UPBZ-1255885-udev-waits.patch
  * make multipath and kpartx wait after for udev after each command
2016-04-21 21:27:49 -05:00

157 lines
4.9 KiB
Diff

---
libmultipath/print.c | 8 +++---
libmultipath/print.h | 4 +++
libmultipath/prioritizers/weightedpath.c | 37 +++++++++++++++++++++++++++++++
libmultipath/prioritizers/weightedpath.h | 1
multipath/multipath.conf.5 | 8 +++++-
5 files changed, 53 insertions(+), 5 deletions(-)
Index: multipath-tools-130222/libmultipath/print.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/print.c
+++ multipath-tools-130222/libmultipath/print.c
@@ -468,19 +468,19 @@ out:
return ret;
}
-static int
+int
snprint_host_wwnn (char * buff, size_t len, struct path * pp)
{
return snprint_host_attr(buff, len, pp, "node_name");
}
-static int
+int
snprint_host_wwpn (char * buff, size_t len, struct path * pp)
{
return snprint_host_attr(buff, len, pp, "port_name");
}
-static int
+int
snprint_tgt_wwpn (char * buff, size_t len, struct path * pp)
{
struct udev_device *rport_dev = NULL;
@@ -510,7 +510,7 @@ out:
}
-static int
+int
snprint_tgt_wwnn (char * buff, size_t len, struct path * pp)
{
if (pp->tgt_node_name[0] == '\0')
Index: multipath-tools-130222/libmultipath/print.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/print.h
+++ multipath-tools-130222/libmultipath/print.h
@@ -50,6 +50,10 @@ int snprint_status (char *, int, struct
int snprint_devices (char *, int, struct vectors *);
int snprint_hwtable (char *, int, vector);
int snprint_mptable (char *, int, vector);
+int snprint_host_wwnn (char *, size_t, struct path *);
+int snprint_host_wwpn (char *, size_t, struct path *);
+int snprint_tgt_wwnn (char *, size_t, struct path *);
+int snprint_tgt_wwpn (char *, size_t, struct path *);
void print_multipath_topology (struct multipath * mpp, int verbosity);
void print_path (struct path * pp, char * style);
Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/weightedpath.c
+++ multipath-tools-130222/libmultipath/prioritizers/weightedpath.c
@@ -32,6 +32,8 @@
#include <memory.h>
#include <debug.h>
#include <regex.h>
+#include <structs_vec.h>
+#include <print.h>
#include "def_func.h"
char *get_next_string(char **temp, char *split_char)
@@ -43,6 +45,36 @@ char *get_next_string(char **temp, char
return token;
}
+#define CHECK_LEN \
+do { \
+ if ((p - str) >= (len - 1)) { \
+ condlog(0, "%s: %s - buffer size too small", pp->dev, pp->prio.name); \
+ return -1; \
+ } \
+} while(0)
+
+static int
+build_wwn_path(struct path *pp, char *str, int len)
+{
+ char *p = str;
+
+ p += snprint_host_wwnn(p, str + len - p, pp);
+ CHECK_LEN;
+ p += snprintf(p, str + len - p, ":");
+ CHECK_LEN;
+ p += snprint_host_wwpn(p, str + len - p, pp);
+ CHECK_LEN;
+ p += snprintf(p, str + len - p, ":");
+ CHECK_LEN;
+ p += snprint_tgt_wwnn(p, str + len - p, pp);
+ CHECK_LEN;
+ p += snprintf(p, str + len - p, ":");
+ CHECK_LEN;
+ p += snprint_tgt_wwpn(p, str + len - p, pp);
+ CHECK_LEN;
+ return 0;
+}
+
/* main priority routine */
int prio_path_weight(struct path *pp, char *prio_args)
{
@@ -72,6 +104,11 @@ int prio_path_weight(struct path *pp, ch
pp->sg_id.channel, pp->sg_id.scsi_id, pp->sg_id.lun);
} else if (!strcmp(regex, DEV_NAME)) {
strcpy(path, pp->dev);
+ } else if (!strcmp(regex, WWN)) {
+ if (build_wwn_path(pp, path, FILE_NAME_SIZE) != 0) {
+ FREE(arg);
+ return priority;
+ }
} else {
condlog(0, "%s: %s - Invalid arguments", pp->dev,
pp->prio.name);
Index: multipath-tools-130222/libmultipath/prioritizers/weightedpath.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/prioritizers/weightedpath.h
+++ multipath-tools-130222/libmultipath/prioritizers/weightedpath.h
@@ -4,6 +4,7 @@
#define PRIO_WEIGHTED_PATH "weightedpath"
#define HBTL "hbtl"
#define DEV_NAME "devname"
+#define WWN "wwn"
#define DEFAULT_PRIORITY 0
int prio_path_weight(struct path *pp, char *prio_args);
Index: multipath-tools-130222/multipath/multipath.conf.5
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.conf.5
+++ multipath-tools-130222/multipath/multipath.conf.5
@@ -216,11 +216,17 @@ prioritizers
.TP 12
.B weighted
Needs a value of the form
-.I "<hbtl|devname> <regex1> <prio1> <regex2> <prio2> ..."
+.I "<hbtl|devname|wwn> <regex1> <prio1> <regex2> <prio2> ..."
.I hbtl
regex can be of SCSI H:B:T:L format Ex: 1:0:.:. , *:0:0:.
.I devname
regex can be of device name format Ex: sda , sd.e
+.I wwn
+regex can be of the form
+.I "host_wwnn:host_wwpn:target_wwnn:target_wwpn"
+these values can be looked up through sysfs or by running
+.I mulitpathd show paths format "%N:%R:%n:%r"
+Ex: 0x200100e08ba0aea0:0x210100e08ba0aea0:.*:.* , .*:.*:iqn.2009-10.com.redhat.msp.lab.ask-06:.*
.TP
.B alua
If