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

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