Blame SOURCES/0079-RHBZ-1070581-add-wwid-option.patch

4728c8
---
4728c8
 multipath/main.c      |   19 ++++++++++++++++---
4728c8
 multipath/multipath.8 |    5 ++++-
4728c8
 2 files changed, 20 insertions(+), 4 deletions(-)
4728c8
4728c8
Index: multipath-tools-130222/multipath/main.c
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipath/main.c
4728c8
+++ multipath-tools-130222/multipath/main.c
4728c8
@@ -85,7 +85,7 @@ usage (char * progname)
4728c8
 {
4728c8
 	fprintf (stderr, VERSION_STRING);
4728c8
 	fprintf (stderr, "Usage:\n");
4728c8
-	fprintf (stderr, "  %s [-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
4728c8
+	fprintf (stderr, "  %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
4728c8
 	fprintf (stderr, "  %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
4728c8
 	fprintf (stderr, "  %s -F [-v lvl]\n", progname);
4728c8
 	fprintf (stderr, "  %s -t\n", progname);
4728c8
@@ -98,6 +98,7 @@ usage (char * progname)
4728c8
 		"  -ll     show multipath topology (maximum info)\n" \
4728c8
 		"  -f      flush a multipath device map\n" \
4728c8
 		"  -F      flush all multipath device maps\n" \
4728c8
+		"  -a      add a device wwid to the wwids file\n" \
4728c8
 		"  -c      check if a device should be a path in a multipath device\n" \
4728c8
 		"  -T tm:val\n" \
4728c8
 		"          check if tm matches the multipathd timestamp. If so val is\n" \
4728c8
@@ -292,6 +293,15 @@ configure (void)
4728c8
 			}
4728c8
 			goto out;
4728c8
 		}
4728c8
+		if (conf->dry_run == 5) {
4728c8
+			r = remember_wwid(refwwid);
4728c8
+			if (r == 0)
4728c8
+				printf("wwid '%s' added\n", refwwid);
4728c8
+			else
4728c8
+				printf("failed adding '%s' to wwids file\n",
4728c8
+					refwwid);
4728c8
+			goto out;
4728c8
+		}
4728c8
 		condlog(3, "scope limited to %s", refwwid);
4728c8
 		if (conf->dry_run == 2) {
4728c8
 			if (check_wwids_file(refwwid, 0) == 0){
4728c8
@@ -428,7 +438,7 @@ main (int argc, char *argv[])
4728c8
 	int r = 1;
4728c8
 	long int timestamp = -1;
4728c8
 	int valid = -1;
4728c8
-	while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
4728c8
+	while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
4728c8
 		switch(arg) {
4728c8
 		case 'T':
4728c8
 			if (optarg[0] == ':')
4728c8
@@ -464,7 +474,7 @@ main (int argc, char *argv[])
4728c8
 	if (dm_prereq())
4728c8
 		exit(1);
4728c8
 
4728c8
-	while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
4728c8
+	while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
4728c8
 		switch(arg) {
4728c8
 		case 1: printf("optarg : %s\n",optarg);
4728c8
 			break;
4728c8
@@ -537,6 +547,9 @@ main (int argc, char *argv[])
4728c8
 		case 'W':
4728c8
 			conf->dry_run = 4;
4728c8
 			break;
4728c8
+		case 'a':
4728c8
+			conf->dry_run = 5;
4728c8
+			break;
4728c8
 		case ':':
4728c8
 			fprintf(stderr, "Missing option argument\n");
4728c8
 			usage(argv[0]);
4728c8
Index: multipath-tools-130222/multipath/multipath.8
4728c8
===================================================================
4728c8
--- multipath-tools-130222.orig/multipath/multipath.8
4728c8
+++ multipath-tools-130222/multipath/multipath.8
4728c8
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
4728c8
 .RB [\| \-b\ \c
4728c8
 .IR bindings_file \|]
4728c8
 .RB [\| \-d \|]
4728c8
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w | \-W \|]
4728c8
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|]
4728c8
 .RB [\| \-p\ \c
4728c8
 .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
4728c8
 .RB [\| device \|]
4728c8
@@ -68,6 +68,9 @@ check if a block device should be a path
4728c8
 .B \-q
4728c8
 allow device tables with queue_if_no_path when multipathd is not running
4728c8
 .TP
4728c8
+.B \-a
4728c8
+add the wwid for the specified device to the wwids file
4728c8
+.TP
4728c8
 .B \-w
4728c8
 remove the wwid for the specified device from the wwids file
4728c8
 .TP