|
|
4ae388 |
---
|
|
|
4ae388 |
libmultipath/wwids.c | 44 ++++++++++++++++++++++++++++++++++++++++++
|
|
|
4ae388 |
libmultipath/wwids.h | 1
|
|
|
4ae388 |
multipath/main.c | 12 ++++++++---
|
|
|
4ae388 |
multipath/multipath.8 | 5 +++-
|
|
|
4ae388 |
multipathd/multipathd.service | 1
|
|
|
4ae388 |
5 files changed, 59 insertions(+), 4 deletions(-)
|
|
|
4ae388 |
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/wwids.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/wwids.c
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/wwids.c
|
|
|
4ae388 |
@@ -305,3 +305,47 @@ remember_wwid(char *wwid)
|
|
|
4ae388 |
condlog(4, "wwid %s already in wwids file", wwid);
|
|
|
4ae388 |
return 0;
|
|
|
4ae388 |
}
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+int remember_cmdline_wwid(void)
|
|
|
4ae388 |
+{
|
|
|
4ae388 |
+ FILE *f = NULL;
|
|
|
4ae388 |
+ char buf[LINE_MAX], *next, *ptr;
|
|
|
4ae388 |
+ int ret = 0;
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ f = fopen("/proc/cmdline", "re");
|
|
|
4ae388 |
+ if (!f) {
|
|
|
4ae388 |
+ condlog(0, "can't open /proc/cmdline : %s", strerror(errno));
|
|
|
4ae388 |
+ return -1;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+
|
|
|
4ae388 |
+ if (!fgets(buf, sizeof(buf), f)) {
|
|
|
4ae388 |
+ if (ferror(f))
|
|
|
4ae388 |
+ condlog(0, "read of /proc/cmdline failed : %s",
|
|
|
4ae388 |
+ strerror(errno));
|
|
|
4ae388 |
+ else
|
|
|
4ae388 |
+ condlog(0, "couldn't read /proc/cmdline");
|
|
|
4ae388 |
+ fclose(f);
|
|
|
4ae388 |
+ return -1;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ fclose(f);
|
|
|
4ae388 |
+ next = buf;
|
|
|
4ae388 |
+ while((ptr = strstr(next, "mpath.wwid="))) {
|
|
|
4ae388 |
+ ptr += 11;
|
|
|
4ae388 |
+ next = strpbrk(ptr, " \t\n");
|
|
|
4ae388 |
+ if (next) {
|
|
|
4ae388 |
+ *next = '\0';
|
|
|
4ae388 |
+ next++;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ if (strlen(ptr)) {
|
|
|
4ae388 |
+ if (remember_wwid(ptr) != 0)
|
|
|
4ae388 |
+ ret = -1;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ else {
|
|
|
4ae388 |
+ condlog(0, "empty mpath.wwid kernel command line option");
|
|
|
4ae388 |
+ ret = -1;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ if (!next)
|
|
|
4ae388 |
+ break;
|
|
|
4ae388 |
+ }
|
|
|
4ae388 |
+ return ret;
|
|
|
4ae388 |
+}
|
|
|
4ae388 |
Index: multipath-tools-130222/libmultipath/wwids.h
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/libmultipath/wwids.h
|
|
|
4ae388 |
+++ multipath-tools-130222/libmultipath/wwids.h
|
|
|
4ae388 |
@@ -17,5 +17,6 @@ int remember_wwid(char *wwid);
|
|
|
4ae388 |
int check_wwids_file(char *wwid, int write_wwid);
|
|
|
4ae388 |
int remove_wwid(char *wwid);
|
|
|
4ae388 |
int replace_wwids(vector mp);
|
|
|
4ae388 |
+int remember_cmdline_wwid(void);
|
|
|
4ae388 |
|
|
|
4ae388 |
#endif /* _WWIDS_H */
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/main.c
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/main.c
|
|
|
4ae388 |
@@ -85,7 +85,7 @@ usage (char * progname)
|
|
|
4ae388 |
{
|
|
|
4ae388 |
fprintf (stderr, VERSION_STRING);
|
|
|
4ae388 |
fprintf (stderr, "Usage:\n");
|
|
|
4ae388 |
- fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
|
|
4ae388 |
+ fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
|
|
|
4ae388 |
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
|
|
|
4ae388 |
fprintf (stderr, " %s -F [-v lvl]\n", progname);
|
|
|
4ae388 |
fprintf (stderr, " %s -t\n", progname);
|
|
|
4ae388 |
@@ -99,6 +99,8 @@ usage (char * progname)
|
|
|
4ae388 |
" -f flush a multipath device map\n" \
|
|
|
4ae388 |
" -F flush all multipath device maps\n" \
|
|
|
4ae388 |
" -a add a device wwid to the wwids file\n" \
|
|
|
4ae388 |
+ " -A add devices from kernel command line mpath.wwids\n"
|
|
|
4ae388 |
+ " parameters to wwids file\n" \
|
|
|
4ae388 |
" -c check if a device should be a path in a multipath device\n" \
|
|
|
4ae388 |
" -T tm:val\n" \
|
|
|
4ae388 |
" check if tm matches the multipathd timestamp. If so val is\n" \
|
|
|
4ae388 |
@@ -438,7 +440,7 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
int r = 1;
|
|
|
4ae388 |
long int timestamp = -1;
|
|
|
4ae388 |
int valid = -1;
|
|
|
4ae388 |
- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
|
|
4ae388 |
+ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
|
|
4ae388 |
switch(arg) {
|
|
|
4ae388 |
case 'T':
|
|
|
4ae388 |
if (optarg[0] == ':')
|
|
|
4ae388 |
@@ -474,7 +476,7 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
if (dm_prereq())
|
|
|
4ae388 |
exit(1);
|
|
|
4ae388 |
|
|
|
4ae388 |
- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
|
|
4ae388 |
+ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
|
|
|
4ae388 |
switch(arg) {
|
|
|
4ae388 |
case 1: printf("optarg : %s\n",optarg);
|
|
|
4ae388 |
break;
|
|
|
4ae388 |
@@ -538,6 +540,10 @@ main (int argc, char *argv[])
|
|
|
4ae388 |
goto out;
|
|
|
4ae388 |
case 'T':
|
|
|
4ae388 |
break;
|
|
|
4ae388 |
+ case 'A':
|
|
|
4ae388 |
+ if (remember_cmdline_wwid() != 0)
|
|
|
4ae388 |
+ exit(1);
|
|
|
4ae388 |
+ exit(0);
|
|
|
4ae388 |
case 'h':
|
|
|
4ae388 |
usage(argv[0]);
|
|
|
4ae388 |
exit(0);
|
|
|
4ae388 |
Index: multipath-tools-130222/multipathd/multipathd.service
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipathd/multipathd.service
|
|
|
4ae388 |
+++ multipath-tools-130222/multipathd/multipathd.service
|
|
|
4ae388 |
@@ -11,6 +11,7 @@ Conflicts=shutdown.target
|
|
|
4ae388 |
Type=forking
|
|
|
4ae388 |
PIDFile=/var/run/multipathd/multipathd.pid
|
|
|
4ae388 |
ExecStartPre=/sbin/modprobe dm-multipath
|
|
|
4ae388 |
+ExecStartPre=-/sbin/multipath -A
|
|
|
4ae388 |
ExecStart=/sbin/multipathd
|
|
|
4ae388 |
ExecReload=/sbin/multipathd reconfigure
|
|
|
4ae388 |
#ExecStop=/path/to/scrip delete-me if not necessary
|
|
|
4ae388 |
Index: multipath-tools-130222/multipath/multipath.8
|
|
|
4ae388 |
===================================================================
|
|
|
4ae388 |
--- multipath-tools-130222.orig/multipath/multipath.8
|
|
|
4ae388 |
+++ multipath-tools-130222/multipath/multipath.8
|
|
|
4ae388 |
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
|
|
|
4ae388 |
.RB [\| \-b\ \c
|
|
|
4ae388 |
.IR bindings_file \|]
|
|
|
4ae388 |
.RB [\| \-d \|]
|
|
|
4ae388 |
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|]
|
|
|
4ae388 |
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-A | \-w | \-W \|]
|
|
|
4ae388 |
.RB [\| \-p\ \c
|
|
|
4ae388 |
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
|
|
|
4ae388 |
.RB [\| device \|]
|
|
|
4ae388 |
@@ -71,6 +71,9 @@ allow device tables with queue_if_no_pat
|
|
|
4ae388 |
.B \-a
|
|
|
4ae388 |
add the wwid for the specified device to the wwids file
|
|
|
4ae388 |
.TP
|
|
|
4ae388 |
+.B \-A
|
|
|
4ae388 |
+add wwids from any kernel command line mpath.wwid parameters to the wwids file
|
|
|
4ae388 |
+.TP
|
|
|
4ae388 |
.B \-w
|
|
|
4ae388 |
remove the wwid for the specified device from the wwids file
|
|
|
4ae388 |
.TP
|