multipath: add option '-i' to ignore wwids file
PATCH 1/1 multipath: add option '-i' to ignore wwids file
When called from udev the multipath program is used to check if a device should be handled by multipath. Any new device, however, will not be present in /etc/multipath/wwids, and the check will always fail.
This patch implements the option '-i' to multipath to skip checking the wwids file for these scenarios.
--- libmultipath/config.h | 1 + multipath/main.c | 18 +++++++++++------- multipath/multipath.8 | 5 ++++- 3 files changed, 16 insertions(+), 8 deletions(-)
libmultipath/config.h +1 -0
@@ -106,6 +106,7 @@ struct config {int max_fds;int force_reload;int queue_without_daemon; +int ignore_wwids;int checker_timeout;int daemon;#ifdef USE_SYSTEMD
multipath/main.c +11 -7
@@ -84,7 +84,7 @@ usage (char * progname) {fprintf (stderr,VERSION_STRING );fprintf (stderr,"Usage:\n" ); -fprintf (stderr," %s [-a|-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n" , progname); +fprintf (stderr," %s [-a|-c|-w|-W] [-d] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n" , progname);fprintf (stderr," %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n" , progname);fprintf (stderr," %s -F [-v lvl]\n" , progname);fprintf (stderr," %s -t\n" , progname);
@@ -103,6 +103,7 @@ usage (char * progname)" -d dry run, do not create or update devmaps\n" \" -t dump internal hardware table\n" \" -r force devmap reload\n" \ +" -i ignore wwids file\n" \" -B treat the bindings file as read only\n" \" -p policy failover|multibus|group_by_serial|group_by_prio\n" \" -b fil bindings file location\n" \
@@ -307,12 +308,12 @@ configure (void) }condlog (3 ,"scope limited to %s" , refwwid);if (conf->cmd ==CMD_VALID_PATH ) { -if (check_wwids_file (refwwid,0 ) ==0 ){ -printf ("%s is a valid multipath device path\n" , conf->dev); +if (conf->ignore_wwids || +check_wwids_file (refwwid,0 ) ==0 ) r =0 ; - } -else -printf ("%s is not a valid multipath device path\n" , conf->dev); + +printf ("%s %s a valid multipath device path\n" , + conf->dev, r ==0 ?"is" :"is not" ); goto out; } }
@@ -445,7 +446,7 @@ main (int argc, char *argv[])if (load_config (DEFAULT_CONFIGFILE , udev))exit (1 ); -while ((arg =getopt (argc, argv,":adchl::FfM:v:p:b:BrtqwW" )) !=EOF ) { +while ((arg =getopt (argc, argv,":adchl::FfM:v:p:b:BritqwW" )) !=EOF ) {switch (arg) {case 1 :printf ("optarg : %s\n" ,optarg);break ;
@@ -503,6 +504,9 @@ main (int argc, char *argv[])case 'r' : conf->force_reload =1 ;break ; +case 'i' : + conf->ignore_wwids =1 ; +break ;case 't' : r =dump_config (); goto out_free_config;
multipath/multipath.8 +4 -1
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoconfig .RB [\| \-b\ \c .IR bindings_file \|] .RB [\| \-d \|] -.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|] +.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \|-i | \-a | \-w | \-W \|] .RB [\| \-p\ \c .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] .RB [\| device \|]
@@ -55,6 +55,9 @@ print internal hardware table to stdout .B \-r force devmap reload .TP +.B \-i +ignore wwids file when processing devices +.TP .B \-B treat the bindings file as read only .TP
Signature · 1 line
1.8.4.5
Benjamin Marzinski
maintainerOn Fri, Jul 04, 2014 at 08:20:11AM +0200, Hannes Reinecke wrote:
Looks fine by me.
ACK
-Ben
Quoted 109 lines
When called from udev the multipath program is used to check if a device should be handled by multipath. Any new device, however, will not be present in
/etc/multipath/wwids, and the check will always fail.
This patch implements the option '-i' to multipath to skip checking the wwids file for these scenarios.Signed-off-by Hannes Reinecke <[email protected]>--- libmultipath/config.h | 1 + multipath/main.c | 18 +++++++++++------- multipath/multipath.8 | 5 ++++- 3 files changed, 16 insertions(+), 8 deletions(-)libmultipath/config.h +1
-0@@ -106,6 +106,7 @@ struct config {int max_fds;int force_reload;int queue_without_daemon; +int ignore_wwids;int checker_timeout;int daemon;#ifdef USE_SYSTEMD multipath/main.c +11
-7@@ -84,7 +84,7 @@ usage (char * progname) {fprintf (stderr,VERSION_STRING );fprintf (stderr,"Usage:\n" ); -fprintf (stderr," %s [-a|-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n" , progname); +fprintf (stderr," %s [-a|-c|-w|-W] [-d] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n" , progname);fprintf (stderr," %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n" , progname);fprintf (stderr," %s -F [-v lvl]\n" , progname);fprintf (stderr," %s -t\n" , progname);@@ -103,6 +103,7 @@ usage (char * progname)" -d dry run, do not create or update devmaps\n" \" -t dump internal hardware table\n" \" -r force devmap reload\n" \ +" -i ignore wwids file\n" \" -B treat the bindings file as read only\n" \" -p policy failover|multibus|group_by_serial|group_by_prio\n" \" -b fil bindings file location\n" \@@ -307,12 +308,12 @@ configure (void) }condlog (3 ,"scope limited to %s" , refwwid);if (conf->cmd ==CMD_VALID_PATH ) { -if (check_wwids_file (refwwid,0 ) ==0 ){ -printf ("%s is a valid multipath device path\n" , conf->dev); +if (conf->ignore_wwids || +check_wwids_file (refwwid,0 ) ==0 ) r =0 ; - } -else -printf ("%s is not a valid multipath device path\n" , conf->dev); + +printf ("%s %s a valid multipath device path\n" , + conf->dev, r ==0 ?"is" :"is not" ); goto out; } }@@ -445,7 +446,7 @@ main (int argc, char *argv[])if (load_config (DEFAULT_CONFIGFILE , udev))exit (1 ); -while ((arg =getopt (argc, argv,":adchl::FfM:v:p:b:BrtqwW" )) !=EOF ) { +while ((arg =getopt (argc, argv,":adchl::FfM:v:p:b:BritqwW" )) !=EOF ) {switch (arg) {case 1 :printf ("optarg : %s\n" ,optarg);break ;@@ -503,6 +504,9 @@ main (int argc, char *argv[])case 'r' : conf->force_reload =1 ;break ; +case 'i' : + conf->ignore_wwids =1 ; +break ;case 't' : r =dump_config (); goto out_free_config;multipath/multipath.8 +4
-1@@ -8,7 +8,7 @@ multipath \- Device mapper target autoconfig .RB [\| \-b\ \c .IR bindings_file \|] .RB [\| \-d \|] -.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|] +.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \|-i | \-a | \-w | \-W \|] .RB [\| \-p\ \c .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] .RB [\| device \|]@@ -55,6 +55,9 @@ print internal hardware table to stdout .B \-r force devmap reload .TP +.B \-i +ignore wwids file when processing devices +.TP .B \-B treat the bindings file as read only .TPSignature · 1 line
1.8.4.5
Christophe Varoqui
AppliedApplied.
Thanks.
Quoted 122 lines · Hannes Reinecke
When called from udev the multipath program is used to check if a device should be handled by multipath. Any new device, however, will not be present in
/etc/multipath/wwids, and the check will always fail.
This patch implements the option '-i' to multipath to skip checking the wwids file for these scenarios.Signed-off-by Hannes Reinecke <[email protected]>--- libmultipath/config.h | 1 + multipath/main.c | 18 +++++++++++------- multipath/multipath.8 | 5 ++++- 3 files changed, 16 insertions(+), 8 deletions(-)libmultipath/config.h +1
-0@@ -106,6 +106,7 @@ struct config {int max_fds;int force_reload;int queue_without_daemon; +int ignore_wwids;int checker_timeout;int daemon;#ifdef USE_SYSTEMD multipath/main.c +1
-1@@ -84,7 +84,7 @@ usage (char * progname) {fprintf (stderr,VERSION_STRING );fprintf (stderr,"Usage:\n" ); - fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); + fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname); fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n",progname); fprintf (stderr, " %s -F [-v lvl]\n", progname); fprintf (stderr, " %s -t\n", progname);multipath/main.c +1
-0@@ -103,6 +103,7 @@ usage (char * progname)" -d dry run, do not create or update devmaps\n" \" -t dump internal hardware table\n" \" -r force devmap reload\n" \ +" -i ignore wwids file\n" \" -B treat the bindings file as read only\n" \ " -p policy failover|multibus|group_by_serial|group_by_prio\n" \" -b fil bindings file location\n" \multipath/main.c +5
-5@@ -307,12 +308,12 @@ configure (void) }condlog (3 ,"scope limited to %s" , refwwid);if (conf->cmd ==CMD_VALID_PATH ) { -if (check_wwids_file (refwwid,0 ) ==0 ){ -printf ("%s is a valid multipath device path\n", conf->dev); + if (conf->ignore_wwids || +check_wwids_file (refwwid,0 ) ==0 ) r = 0; - } -else -printf ("%s is not a valid multipath device path\n", conf->dev); + + printf("%s %s a valid multipath device path\n" , + conf->dev, r ==0 ?"is" :"is not" ); goto out;} }multipath/main.c +1
-1@@ -445,7 +446,7 @@ main (int argc, char *argv[])if (load_config (DEFAULT_CONFIGFILE , udev))exit (1 ); -while ((arg =getopt (argc, argv,":adchl::FfM:v:p:b:BrtqwW" )) != EOF ) { +while ((arg =getopt (argc, argv,":adchl::FfM:v:p:b:BritqwW" )) !=EOF ) {switch (arg) {case 1: printf("optarg : %s\n",optarg); break;multipath/main.c +3
-0@@ -503,6 +504,9 @@ main (int argc, char *argv[])case 'r' : conf->force_reload =1 ;break ; +case 'i' : + conf->ignore_wwids =1 ; +break ;case 't' : r =dump_config (); goto out_free_config;multipath/multipath.8 +0
-1@@ -8,7 +8,7 @@ multipath \- Device mapper target autoconfig .RB [\| \-b\ \c .IR bindings_file \|] .RB [\| \-d \|] -.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a| \-w | \-W \|] +.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \|-i | \-a | \-w | \-W \|] .RB [\| \-p\ \c .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|] .RB [\| device \|]multipath/multipath.8 +3
-1@@ -55,6 +55,9 @@ print internal hardware table to stdout .B \-r force devmap reload .TP +.B \-i +ignore wwids file when processing devices +.TP .B \-B treat the bindings file as read only .TP --1.8.4.5