<div dir="ltr"><div>Applied.<br></div>Thanks.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 30, 2014 at 7:13 AM, Benjamin Marzinski <span dir="ltr"><<a href="mailto:bmarzins@redhat.com" target="_blank">bmarzins@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The patch adds a "-a" option to multipath, that allows it to add wwids<br>
to the /etc/multipath wwids file.<br>
<br>
Signed-off-by: Benjamin Marzinski <<a href="mailto:bmarzins@redhat.com">bmarzins@redhat.com</a>><br>
---<br>
libmultipath/config.h | 1 +<br>
multipath/main.c | 17 +++++++++++++++--<br>
multipath/multipath.8 | 5 ++++-<br>
3 files changed, 20 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/libmultipath/config.h b/libmultipath/config.h<br>
index eb23820..ac7c58e 100644<br>
--- a/libmultipath/config.h<br>
+++ b/libmultipath/config.h<br>
@@ -30,6 +30,7 @@ enum mpath_cmds {<br>
CMD_VALID_PATH,<br>
CMD_REMOVE_WWID,<br>
CMD_RESET_WWIDS,<br>
+ CMD_ADD_WWID,<br>
};<br>
<br>
struct hwentry {<br>
diff --git a/multipath/main.c b/multipath/main.c<br>
index 54b2a74..157475e 100644<br>
--- a/multipath/main.c<br>
+++ b/multipath/main.c<br>
@@ -84,7 +84,7 @@ usage (char * progname)<br>
{<br>
fprintf (stderr, VERSION_STRING);<br>
fprintf (stderr, "Usage:\n");<br>
- fprintf (stderr, " %s [-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);<br>
+ fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);<br>
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);<br>
fprintf (stderr, " %s -F [-v lvl]\n", progname);<br>
fprintf (stderr, " %s -t\n", progname);<br>
@@ -97,6 +97,7 @@ usage (char * progname)<br>
" -ll show multipath topology (maximum info)\n" \<br>
" -f flush a multipath device map\n" \<br>
" -F flush all multipath device maps\n" \<br>
+ " -a add a device wwid to the wwids file\n" \<br>
" -c check if a device should be a path in a multipath device\n" \<br>
" -q allow queue_if_no_path when multipathd is not running\n"\<br>
" -d dry run, do not create or update devmaps\n" \<br>
@@ -295,6 +296,15 @@ configure (void)<br>
}<br>
goto out;<br>
}<br>
+ if (conf->cmd == CMD_ADD_WWID) {<br>
+ r = remember_wwid(refwwid);<br>
+ if (r == 0)<br>
+ printf("wwid '%s' added\n", refwwid);<br>
+ else<br>
+ printf("failed adding '%s' to wwids file\n",<br>
+ refwwid);<br>
+ goto out;<br>
+ }<br>
condlog(3, "scope limited to %s", refwwid);<br>
if (conf->cmd == CMD_VALID_PATH) {<br>
if (check_wwids_file(refwwid, 0) == 0){<br>
@@ -435,7 +445,7 @@ main (int argc, char *argv[])<br>
if (load_config(DEFAULT_CONFIGFILE, udev))<br>
exit(1);<br>
<br>
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtqwW")) != EOF ) {<br>
+ while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtqwW")) != EOF ) {<br>
switch(arg) {<br>
case 1: printf("optarg : %s\n",optarg);<br>
break;<br>
@@ -505,6 +515,9 @@ main (int argc, char *argv[])<br>
case 'W':<br>
conf->cmd = CMD_RESET_WWIDS;<br>
break;<br>
+ case 'a':<br>
+ conf->cmd = CMD_ADD_WWID;<br>
+ break;<br>
case ':':<br>
fprintf(stderr, "Missing option argument\n");<br>
usage(argv[0]);<br>
diff --git a/multipath/multipath.8 b/multipath/multipath.8<br>
index a2262ac..b6479b1 100644<br>
--- a/multipath/multipath.8<br>
+++ b/multipath/multipath.8<br>
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoconfig<br>
.RB [\| \-b\ \c<br>
.IR bindings_file \|]<br>
.RB [\| \-d \|]<br>
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w | \-W \|]<br>
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|]<br>
.RB [\| \-p\ \c<br>
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]<br>
.RB [\| device \|]<br>
@@ -68,6 +68,9 @@ check if a block device should be a path in a multipath device<br>
.B \-q<br>
allow device tables with queue_if_no_path when multipathd is not running<br>
.TP<br>
+.B \-a<br>
+add the wwid for the specified device to the wwids file<br>
+.TP<br>
.B \-w<br>
remove the wwid for the specified device from the wwids file<br>
.TP<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.1<br>
<br>
</font></span></blockquote></div><br></div>