6738b34a0b
- 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
394 lines
13 KiB
Diff
394 lines
13 KiB
Diff
---
|
|
libmultipath/print.c | 42 ++++++++++++++++++++++++----------------
|
|
libmultipath/print.h | 4 +--
|
|
multipathd/cli.c | 5 +++-
|
|
multipathd/cli.h | 6 +++--
|
|
multipathd/cli_handlers.c | 48 ++++++++++++++++++++++++++++++++++------------
|
|
multipathd/cli_handlers.h | 2 +
|
|
multipathd/main.c | 2 +
|
|
7 files changed, 76 insertions(+), 33 deletions(-)
|
|
|
|
Index: multipath-tools-130222/libmultipath/print.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/libmultipath/print.c
|
|
+++ multipath-tools-130222/libmultipath/print.c
|
|
@@ -32,14 +32,21 @@
|
|
#define MAX(x,y) (x > y) ? x : y
|
|
#define TAIL (line + len - 1 - c)
|
|
#define NOPAD s = c
|
|
-#define PAD(x) while ((int)(c - s) < (x) && (c < (line + len - 1))) \
|
|
- *c++ = ' '; s = c
|
|
+#define PAD(x) \
|
|
+do { \
|
|
+ while ((int)(c - s) < (x) && (c < (line + len - 1))) \
|
|
+ *c++ = ' '; \
|
|
+ s = c; \
|
|
+} while (0)
|
|
+
|
|
#define ENDLINE \
|
|
if (c > line) \
|
|
line[c - line - 1] = '\n'
|
|
-#define PRINT(var, size, format, args...) \
|
|
- fwd = snprintf(var, size, format, ##args); \
|
|
- c += (fwd >= size) ? size : fwd;
|
|
+#define PRINT(var, size, format, args...) \
|
|
+do { \
|
|
+ fwd = snprintf(var, size, format, ##args); \
|
|
+ c += (fwd >= size) ? size : fwd; \
|
|
+} while (0)
|
|
|
|
/*
|
|
* information printing helpers
|
|
@@ -720,7 +727,7 @@ snprint_multipath_header (char * line, i
|
|
|
|
int
|
|
snprint_multipath (char * line, int len, char * format,
|
|
- struct multipath * mpp)
|
|
+ struct multipath * mpp, int pad)
|
|
{
|
|
char * c = line; /* line cursor */
|
|
char * s = line; /* for padding */
|
|
@@ -747,7 +754,8 @@ snprint_multipath (char * line, int len,
|
|
|
|
data->snprint(buff, MAX_FIELD_LEN, mpp);
|
|
PRINT(c, TAIL, "%s", buff);
|
|
- PAD(data->width);
|
|
+ if (pad)
|
|
+ PAD(data->width);
|
|
buff[0] = '\0';
|
|
} while (*f++);
|
|
|
|
@@ -790,7 +798,7 @@ snprint_path_header (char * line, int le
|
|
|
|
int
|
|
snprint_path (char * line, int len, char * format,
|
|
- struct path * pp)
|
|
+ struct path * pp, int pad)
|
|
{
|
|
char * c = line; /* line cursor */
|
|
char * s = line; /* for padding */
|
|
@@ -817,7 +825,8 @@ snprint_path (char * line, int len, char
|
|
|
|
data->snprint(buff, MAX_FIELD_LEN, pp);
|
|
PRINT(c, TAIL, "%s", buff);
|
|
- PAD(data->width);
|
|
+ if (pad)
|
|
+ PAD(data->width);
|
|
} while (*f++);
|
|
|
|
ENDLINE;
|
|
@@ -909,7 +918,7 @@ snprint_multipath_topology (char * buff,
|
|
reset_multipath_layout();
|
|
|
|
if (verbosity == 1)
|
|
- return snprint_multipath(buff, len, "%n", mpp);
|
|
+ return snprint_multipath(buff, len, "%n", mpp, 1);
|
|
|
|
if(isatty(1))
|
|
c += sprintf(c, "%c[%dm", 0x1B, 1); /* bold on */
|
|
@@ -928,10 +937,11 @@ snprint_multipath_topology (char * buff,
|
|
if(isatty(1))
|
|
c += sprintf(c, "%c[%dm", 0x1B, 0); /* bold off */
|
|
|
|
- fwd += snprint_multipath(buff + fwd, len - fwd, style, mpp);
|
|
+ fwd += snprint_multipath(buff + fwd, len - fwd, style, mpp, 1);
|
|
if (fwd > len)
|
|
return len;
|
|
- fwd += snprint_multipath(buff + fwd, len - fwd, PRINT_MAP_PROPS, mpp);
|
|
+ fwd += snprint_multipath(buff + fwd, len - fwd, PRINT_MAP_PROPS, mpp,
|
|
+ 1);
|
|
if (fwd > len)
|
|
return len;
|
|
|
|
@@ -958,7 +968,7 @@ snprint_multipath_topology (char * buff,
|
|
strcpy(f, " |- " PRINT_PATH_INDENT);
|
|
else
|
|
strcpy(f, " `- " PRINT_PATH_INDENT);
|
|
- fwd += snprint_path(buff + fwd, len - fwd, fmt, pp);
|
|
+ fwd += snprint_path(buff + fwd, len - fwd, fmt, pp, 1);
|
|
if (fwd > len)
|
|
return len;
|
|
}
|
|
@@ -1425,7 +1435,7 @@ snprint_devices (char * buff, int len, s
|
|
if (r > 0)
|
|
fwd += snprintf(buff + fwd, len - fwd,
|
|
" devnode blacklisted, unmonitored");
|
|
- else if (r < 0)
|
|
+ else if (r <= 0)
|
|
fwd += snprintf(buff + fwd, len - fwd,
|
|
" devnode whitelisted, unmonitored");
|
|
} else
|
|
@@ -1455,7 +1465,7 @@ print_path (struct path * pp, char * sty
|
|
char line[MAX_LINE_LEN];
|
|
|
|
memset(&line[0], 0, MAX_LINE_LEN);
|
|
- snprint_path(&line[0], MAX_LINE_LEN, style, pp);
|
|
+ snprint_path(&line[0], MAX_LINE_LEN, style, pp, 1);
|
|
printf("%s", line);
|
|
}
|
|
|
|
@@ -1465,7 +1475,7 @@ print_multipath (struct multipath * mpp,
|
|
char line[MAX_LINE_LEN];
|
|
|
|
memset(&line[0], 0, MAX_LINE_LEN);
|
|
- snprint_multipath(&line[0], MAX_LINE_LEN, style, mpp);
|
|
+ snprint_multipath(&line[0], MAX_LINE_LEN, style, mpp, 1);
|
|
printf("%s", line);
|
|
}
|
|
|
|
Index: multipath-tools-130222/libmultipath/print.h
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/libmultipath/print.h
|
|
+++ multipath-tools-130222/libmultipath/print.h
|
|
@@ -37,8 +37,8 @@ void get_path_layout (vector pathvec, in
|
|
void get_multipath_layout (vector mpvec, int header);
|
|
int snprint_path_header (char *, int, char *);
|
|
int snprint_multipath_header (char *, int, char *);
|
|
-int snprint_path (char *, int, char *, struct path *);
|
|
-int snprint_multipath (char *, int, char *, struct multipath *);
|
|
+int snprint_path (char *, int, char *, struct path *, int);
|
|
+int snprint_multipath (char *, int, char *, struct multipath *, int);
|
|
int snprint_multipath_topology (char *, int, struct multipath * mpp,
|
|
int verbosity);
|
|
int snprint_defaults (char *, int);
|
|
Index: multipath-tools-130222/multipathd/cli.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/cli.c
|
|
+++ multipath-tools-130222/multipathd/cli.c
|
|
@@ -180,7 +180,7 @@ load_keys (void)
|
|
r += add_key(keys, "config", CONFIG, 0);
|
|
r += add_key(keys, "blacklist", BLACKLIST, 0);
|
|
r += add_key(keys, "devices", DEVICES, 0);
|
|
- r += add_key(keys, "format", FMT, 1);
|
|
+ r += add_key(keys, "raw", RAW, 0);
|
|
r += add_key(keys, "wildcards", WILDCARDS, 0);
|
|
r += add_key(keys, "quit", QUIT, 0);
|
|
r += add_key(keys, "exit", QUIT, 0);
|
|
@@ -188,6 +188,7 @@ load_keys (void)
|
|
r += add_key(keys, "getprstatus", GETPRSTATUS, 0);
|
|
r += add_key(keys, "setprstatus", SETPRSTATUS, 0);
|
|
r += add_key(keys, "unsetprstatus", UNSETPRSTATUS, 0);
|
|
+ r += add_key(keys, "format", FMT, 1);
|
|
|
|
if (r) {
|
|
free_keys(keys);
|
|
@@ -463,12 +464,14 @@ cli_init (void) {
|
|
|
|
add_handler(LIST+PATHS, NULL);
|
|
add_handler(LIST+PATHS+FMT, NULL);
|
|
+ add_handler(LIST+PATHS+RAW+FMT, NULL);
|
|
add_handler(LIST+STATUS, NULL);
|
|
add_handler(LIST+DAEMON, NULL);
|
|
add_handler(LIST+MAPS, NULL);
|
|
add_handler(LIST+MAPS+STATUS, NULL);
|
|
add_handler(LIST+MAPS+STATS, NULL);
|
|
add_handler(LIST+MAPS+FMT, NULL);
|
|
+ add_handler(LIST+MAPS+RAW+FMT, NULL);
|
|
add_handler(LIST+MAPS+TOPOLOGY, NULL);
|
|
add_handler(LIST+TOPOLOGY, NULL);
|
|
add_handler(LIST+MAP+TOPOLOGY, NULL);
|
|
Index: multipath-tools-130222/multipathd/cli.h
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/cli.h
|
|
+++ multipath-tools-130222/multipathd/cli.h
|
|
@@ -26,13 +26,14 @@ enum {
|
|
__CONFIG,
|
|
__BLACKLIST,
|
|
__DEVICES,
|
|
- __FMT,
|
|
+ __RAW,
|
|
__WILDCARDS,
|
|
__QUIT,
|
|
__SHUTDOWN,
|
|
__GETPRSTATUS,
|
|
__SETPRSTATUS,
|
|
__UNSETPRSTATUS,
|
|
+ __FMT,
|
|
};
|
|
|
|
#define LIST (1 << __LIST)
|
|
@@ -62,7 +63,7 @@ enum {
|
|
#define CONFIG (1 << __CONFIG)
|
|
#define BLACKLIST (1 << __BLACKLIST)
|
|
#define DEVICES (1 << __DEVICES)
|
|
-#define FMT (1 << __FMT)
|
|
+#define RAW (1 << __RAW)
|
|
#define COUNT (1 << __COUNT)
|
|
#define WILDCARDS (1 << __WILDCARDS)
|
|
#define QUIT (1 << __QUIT)
|
|
@@ -70,6 +71,7 @@ enum {
|
|
#define GETPRSTATUS (1UL << __GETPRSTATUS)
|
|
#define SETPRSTATUS (1UL << __SETPRSTATUS)
|
|
#define UNSETPRSTATUS (1UL << __UNSETPRSTATUS)
|
|
+#define FMT (1UL << __FMT)
|
|
|
|
#define INITIAL_REPLY_LEN 1200
|
|
|
|
Index: multipath-tools-130222/multipathd/cli_handlers.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/cli_handlers.c
|
|
+++ multipath-tools-130222/multipathd/cli_handlers.c
|
|
@@ -24,7 +24,8 @@
|
|
#include "uevent.h"
|
|
|
|
int
|
|
-show_paths (char ** r, int * len, struct vectors * vecs, char * style)
|
|
+show_paths (char ** r, int * len, struct vectors * vecs, char * style,
|
|
+ int pretty)
|
|
{
|
|
int i;
|
|
struct path * pp;
|
|
@@ -42,13 +43,13 @@ show_paths (char ** r, int * len, struct
|
|
|
|
c = reply;
|
|
|
|
- if (VECTOR_SIZE(vecs->pathvec) > 0)
|
|
+ if (pretty && VECTOR_SIZE(vecs->pathvec) > 0)
|
|
c += snprint_path_header(c, reply + maxlen - c,
|
|
style);
|
|
|
|
vector_foreach_slot(vecs->pathvec, pp, i)
|
|
c += snprint_path(c, reply + maxlen - c,
|
|
- style, pp);
|
|
+ style, pp, pretty);
|
|
|
|
again = ((c - reply) == (maxlen - 1));
|
|
|
|
@@ -183,7 +184,7 @@ cli_list_paths (void * v, char ** reply,
|
|
|
|
condlog(3, "list paths (operator)");
|
|
|
|
- return show_paths(reply, len, vecs, PRINT_PATH_CHECKER);
|
|
+ return show_paths(reply, len, vecs, PRINT_PATH_CHECKER, 1);
|
|
}
|
|
|
|
int
|
|
@@ -194,7 +195,18 @@ cli_list_paths_fmt (void * v, char ** re
|
|
|
|
condlog(3, "list paths (operator)");
|
|
|
|
- return show_paths(reply, len, vecs, fmt);
|
|
+ return show_paths(reply, len, vecs, fmt, 1);
|
|
+}
|
|
+
|
|
+int
|
|
+cli_list_paths_raw (void * v, char ** reply, int * len, void * data)
|
|
+{
|
|
+ struct vectors * vecs = (struct vectors *)data;
|
|
+ char * fmt = get_keyparam(v, FMT);
|
|
+
|
|
+ condlog(3, "list paths (operator)");
|
|
+
|
|
+ return show_paths(reply, len, vecs, fmt, 0);
|
|
}
|
|
|
|
int
|
|
@@ -285,7 +297,8 @@ show_daemon (char ** r, int *len)
|
|
}
|
|
|
|
int
|
|
-show_maps (char ** r, int *len, struct vectors * vecs, char * style)
|
|
+show_maps (char ** r, int *len, struct vectors * vecs, char * style,
|
|
+ int pretty)
|
|
{
|
|
int i;
|
|
struct multipath * mpp;
|
|
@@ -302,13 +315,13 @@ show_maps (char ** r, int *len, struct v
|
|
return 1;
|
|
|
|
c = reply;
|
|
- if (VECTOR_SIZE(vecs->mpvec) > 0)
|
|
+ if (pretty && VECTOR_SIZE(vecs->mpvec) > 0)
|
|
c += snprint_multipath_header(c, reply + maxlen - c,
|
|
style);
|
|
|
|
vector_foreach_slot(vecs->mpvec, mpp, i)
|
|
c += snprint_multipath(c, reply + maxlen - c,
|
|
- style, mpp);
|
|
+ style, mpp, pretty);
|
|
|
|
again = ((c - reply) == (maxlen - 1));
|
|
|
|
@@ -327,7 +340,18 @@ cli_list_maps_fmt (void * v, char ** rep
|
|
|
|
condlog(3, "list maps (operator)");
|
|
|
|
- return show_maps(reply, len, vecs, fmt);
|
|
+ return show_maps(reply, len, vecs, fmt, 1);
|
|
+}
|
|
+
|
|
+int
|
|
+cli_list_maps_raw (void * v, char ** reply, int * len, void * data)
|
|
+{
|
|
+ struct vectors * vecs = (struct vectors *)data;
|
|
+ char * fmt = get_keyparam(v, FMT);
|
|
+
|
|
+ condlog(3, "list maps (operator)");
|
|
+
|
|
+ return show_maps(reply, len, vecs, fmt, 0);
|
|
}
|
|
|
|
int
|
|
@@ -337,7 +361,7 @@ cli_list_maps (void * v, char ** reply,
|
|
|
|
condlog(3, "list maps (operator)");
|
|
|
|
- return show_maps(reply, len, vecs, PRINT_MAP_NAMES);
|
|
+ return show_maps(reply, len, vecs, PRINT_MAP_NAMES, 1);
|
|
}
|
|
|
|
int
|
|
@@ -357,7 +381,7 @@ cli_list_maps_status (void * v, char **
|
|
|
|
condlog(3, "list maps status (operator)");
|
|
|
|
- return show_maps(reply, len, vecs, PRINT_MAP_STATUS);
|
|
+ return show_maps(reply, len, vecs, PRINT_MAP_STATUS, 1);
|
|
}
|
|
|
|
int
|
|
@@ -367,7 +391,7 @@ cli_list_maps_stats (void * v, char ** r
|
|
|
|
condlog(3, "list maps stats (operator)");
|
|
|
|
- return show_maps(reply, len, vecs, PRINT_MAP_STATS);
|
|
+ return show_maps(reply, len, vecs, PRINT_MAP_STATS, 1);
|
|
}
|
|
|
|
int
|
|
Index: multipath-tools-130222/multipathd/cli_handlers.h
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/cli_handlers.h
|
|
+++ multipath-tools-130222/multipathd/cli_handlers.h
|
|
@@ -1,9 +1,11 @@
|
|
int cli_list_paths (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_paths_fmt (void * v, char ** reply, int * len, void * data);
|
|
+int cli_list_paths_raw (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_status (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_daemon (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_maps (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_maps_fmt (void * v, char ** reply, int * len, void * data);
|
|
+int cli_list_maps_raw (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_maps_status (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_maps_stats (void * v, char ** reply, int * len, void * data);
|
|
int cli_list_map_topology (void * v, char ** reply, int * len, void * data);
|
|
Index: multipath-tools-130222/multipathd/main.c
|
|
===================================================================
|
|
--- multipath-tools-130222.orig/multipathd/main.c
|
|
+++ multipath-tools-130222/multipathd/main.c
|
|
@@ -967,12 +967,14 @@ uxlsnrloop (void * ap)
|
|
|
|
set_handler_callback(LIST+PATHS, cli_list_paths);
|
|
set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt);
|
|
+ set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw);
|
|
set_handler_callback(LIST+MAPS, cli_list_maps);
|
|
set_handler_callback(LIST+STATUS, cli_list_status);
|
|
set_handler_callback(LIST+DAEMON, cli_list_daemon);
|
|
set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status);
|
|
set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats);
|
|
set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt);
|
|
+ set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw);
|
|
set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
|
|
set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology);
|
|
set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology);
|