device-mapper-multipath/0096-RHBZ-979474-new-wildcards.patch
Benjamin Marzinski efd38c93e9 device-mapper-multipath-0.4.9-68
Modify multipath.conf
  * remove getuid_callout example
Re-add 0050-RH-listing-speedup.patch
Add 0081-RHBZ-1066264-check-prefix-on-rename.patch
  * make multipath check the prefix on kpartx partitions during rename, and
    copy the existing behaviour
Add 0082-UPBZ-1109995-no-sync-turs-on-pthread_cancel.patch
  * If async tur checker fails on threads, don't retry with the sync version
Add 0083-RHBZ-1080055-orphan-paths-on-reload.patch
  * Fix case where pathlist wasn't getting updated properly
Add 0084-RHBZ-1110000-multipath-man.patch
  * fix errors in multipath man page
Add 0085-UPBZ-1110006-datacore-config.patch
  * Add support for DataCore Virtual Disk
Add 0086-RHBZ-1110007-orphan-path-on-failed-add.patch
  * If multipathd fails to add path correctly, it now fully orphans the path
Add 0087-RHBZ-1110013-config-error-checking.patch
  * Improve multipath.conf error checking.
Add 0088-RHBZ-1069811-configurable-prio-timeout.patch
  * checker_timeout now adjusts the timeouts of the prioritizers as well.
Add 0089-RHBZ-1110016-add-noasync-option.patch
  * Add a new defaults option, "force_sync", that disables the async mode
    of the path checkers. This is for cases where to many parallel checkers
    hog the cpu
Add 0090-UPBZ-1080038-reorder-paths-for-round-robin.patch
  * make multipathd order paths for better throughput in round-robin mode
Add 0091-RHBZ-1069584-fix-empty-values-fast-io-fail-and-dev-loss.patch
  * check for null pointers in configuration reading code.
Add 0092-UPBZ-1104605-reload-on-rename.patch
  * Reload table on rename if necessary
Add 0093-UPBZ-1086825-user-friendly-name-remap.patch
  * Keep existing user_friend_name if possible
Add 0094-RHBZ-1086825-cleanup-remap.patch
  * Cleanup issues with upstream patch
Add 0095-RHBZ-1127944-xtremIO-config.patch
  * Add support for EMC ExtremIO devices
Add 0096-RHBZ-979474-new-wildcards.patch
  * Add N, n, R, and r path wildcards to print World Wide ids
Add 0097-RH-fix-coverity-errors.patch
  * Fix a number of unterminated strings and memory leaks on failure
    paths.
Add 0098-UPBZ-1067171-mutipath-i.patch
  * Add -i option to ignore wwids file when checking for valid paths
Add 0099-RH-add-all-devs.patch
  * Add new devices config option all_devs. This makes the configuration
    overwrite the specified values in all builtin configs
Add 0100-RHBZ-1067171-multipath-i-update.patch
  * make -i work correctly with find_multipaths
Add 0101-RH-adapter-name-wildcard.patch
  * Add 'a' path wildcard to print adapter name
2014-09-16 18:22:40 -05:00

121 lines
3.3 KiB
Diff

---
libmultipath/print.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 83 insertions(+), 1 deletion(-)
Index: multipath-tools-130222/libmultipath/print.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/print.c
+++ multipath-tools-130222/libmultipath/print.c
@@ -10,6 +10,7 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
+#include <libudev.h>
#include "checkers.h"
#include "vector.h"
@@ -44,7 +45,7 @@
* information printing helpers
*/
static int
-snprint_str (char * buff, size_t len, char * str)
+snprint_str (char * buff, size_t len, const char * str)
{
return snprintf(buff, len, "%s", str);
}
@@ -432,6 +433,83 @@ snprint_path_mpp (char * buff, size_t le
}
static int
+snprint_host_attr (char * buff, size_t len, struct path * pp, char *attr)
+{
+ struct udev_device *host_dev = NULL;
+ char host_id[32];
+ const char *value = NULL;
+ int ret;
+
+ if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP)
+ return snprintf(buff, len, "[undef]");
+ sprintf(host_id, "host%d", pp->sg_id.host_no);
+ host_dev = udev_device_new_from_subsystem_sysname(conf->udev, "fc_host",
+ host_id);
+ if (!host_dev) {
+ condlog(1, "%s: No fc_host device for '%s'", pp->dev, host_id);
+ goto out;
+ }
+ value = udev_device_get_sysattr_value(host_dev, attr);
+ if (value)
+ ret = snprint_str(buff, len, value);
+ udev_device_unref(host_dev);
+out:
+ if (!value)
+ ret = snprintf(buff, len, "[unknown]");
+ return ret;
+}
+
+static int
+snprint_host_wwnn (char * buff, size_t len, struct path * pp)
+{
+ return snprint_host_attr(buff, len, pp, "node_name");
+}
+
+static int
+snprint_host_wwpn (char * buff, size_t len, struct path * pp)
+{
+ return snprint_host_attr(buff, len, pp, "port_name");
+}
+
+static int
+snprint_tgt_wwpn (char * buff, size_t len, struct path * pp)
+{
+ struct udev_device *rport_dev = NULL;
+ char rport_id[32];
+ const char *value = NULL;
+ int ret;
+
+ if (pp->sg_id.proto_id != SCSI_PROTOCOL_FCP)
+ return snprintf(buff, len, "[undef]");
+ sprintf(rport_id, "rport-%d:%d-%d",
+ pp->sg_id.host_no, pp->sg_id.channel, pp->sg_id.transport_id);
+ rport_dev = udev_device_new_from_subsystem_sysname(conf->udev,
+ "fc_remote_ports", rport_id);
+ if (!rport_dev) {
+ condlog(1, "%s: No fc_remote_port device for '%s'", pp->dev,
+ rport_id);
+ goto out;
+ }
+ value = udev_device_get_sysattr_value(rport_dev, "port_name");
+ if (value)
+ ret = snprint_str(buff, len, value);
+ udev_device_unref(rport_dev);
+out:
+ if (!value)
+ ret = snprintf(buff, len, "[unknown]");
+ return ret;
+}
+
+
+static int
+snprint_tgt_wwnn (char * buff, size_t len, struct path * pp)
+{
+ if (pp->tgt_node_name[0] == '\0')
+ return snprintf(buff, len, "[undef]");
+ return snprint_str(buff, len, pp->tgt_node_name);
+}
+
+static int
snprint_path_checker (char * buff, size_t len, struct path * pp)
{
struct checker * c = &pp->checker;
@@ -475,6 +553,10 @@ struct path_data pd[] = {
{'S', "size", 0, snprint_path_size},
{'z', "serial", 0, snprint_path_serial},
{'m', "multipath", 0, snprint_path_mpp},
+ {'N', "host WWNN", 0, snprint_host_wwnn},
+ {'n', "target WWNN", 0, snprint_tgt_wwnn},
+ {'R', "host WWPN", 0, snprint_host_wwpn},
+ {'r', "target WWPN", 0, snprint_tgt_wwpn},
{0, NULL, 0 , NULL}
};