2 libmultipath/config.h | 15 ++++++++-
3 libmultipath/configure.c | 2 -
4 libmultipath/discovery.c | 5 +--
5 multipath/main.c | 75 +++++++++++++++++++++++++----------------------
6 multipath/multipath.8 | 5 ++-
7 5 files changed, 61 insertions(+), 41 deletions(-)
9 Index: multipath-tools-130222/libmultipath/config.h
10 ===================================================================
11 --- multipath-tools-130222.orig/libmultipath/config.h
12 +++ multipath-tools-130222/libmultipath/config.h
13 @@ -23,6 +23,17 @@ enum devtypes {
31 @@ -79,8 +90,7 @@ struct mpentry {
37 + enum mpath_cmds cmd;
40 enum devtypes dev_type;
41 @@ -98,6 +108,7 @@ struct config {
44 int queue_without_daemon;
48 int flush_on_last_del;
49 Index: multipath-tools-130222/multipath/main.c
50 ===================================================================
51 --- multipath-tools-130222.orig/multipath/main.c
52 +++ multipath-tools-130222/multipath/main.c
53 @@ -85,7 +85,7 @@ usage (char * progname)
55 fprintf (stderr, VERSION_STRING);
56 fprintf (stderr, "Usage:\n");
57 - fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
58 + fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-i] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
59 fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
60 fprintf (stderr, " %s -F [-v lvl]\n", progname);
61 fprintf (stderr, " %s -t\n", progname);
62 @@ -109,6 +109,7 @@ usage (char * progname)
63 " -d dry run, do not create or update devmaps\n" \
64 " -t dump internal hardware table\n" \
65 " -r force devmap reload\n" \
66 + " -i ignore wwids file\n" \
67 " -B treat the bindings file as read only\n" \
68 " -p policy failover|multibus|group_by_serial|group_by_prio\n" \
69 " -b fil bindings file location\n" \
70 @@ -209,18 +210,19 @@ get_dm_mpvec (vector curmp, vector pathv
71 * If not in "fast list mode", we need to fetch information
74 - if (conf->list != 1)
75 + if (conf->cmd != CMD_LIST_SHORT)
79 + if (conf->cmd == CMD_LIST_LONG)
80 mpp->bestpg = select_path_group(mpp);
82 disassemble_status(status, mpp);
85 + if (conf->cmd == CMD_LIST_SHORT ||
86 + conf->cmd == CMD_LIST_LONG)
87 print_multipath_topology(mpp, conf->verbosity);
90 + if (conf->cmd == CMD_CREATE)
94 @@ -262,10 +264,11 @@ configure (void)
96 * if we have a blacklisted device parameter, exit early
98 - if (dev && conf->dev_type == DEV_DEVNODE && conf->dry_run != 3 &&
99 + if (dev && conf->dev_type == DEV_DEVNODE &&
100 + conf->cmd != CMD_REMOVE_WWID &&
101 (filter_devnode(conf->blist_devnode,
102 conf->elist_devnode, dev) > 0)) {
103 - if (conf->dry_run == 2)
104 + if (conf->cmd == CMD_VALID_PATH)
105 printf("%s is not a valid multipath device path\n",
108 @@ -278,13 +281,13 @@ configure (void)
109 int failed = get_refwwid(conf->dev, conf->dev_type, pathvec,
112 - if (failed == 2 && conf->dry_run == 2)
113 + if (failed == 2 && conf->cmd == CMD_VALID_PATH)
114 printf("%s is not a valid multipath device path\n", conf->dev);
116 condlog(3, "scope is nul");
119 - if (conf->dry_run == 3) {
120 + if (conf->cmd == CMD_REMOVE_WWID) {
121 r = remove_wwid(refwwid);
123 printf("wwid '%s' removed\n", refwwid);
124 @@ -295,7 +298,7 @@ configure (void)
128 - if (conf->dry_run == 5) {
129 + if (conf->cmd == CMD_ADD_WWID) {
130 r = remember_wwid(refwwid);
132 printf("wwid '%s' added\n", refwwid);
133 @@ -305,13 +308,13 @@ configure (void)
136 condlog(3, "scope limited to %s", refwwid);
137 - if (conf->dry_run == 2) {
138 - if (check_wwids_file(refwwid, 0) == 0){
139 - printf("%s is a valid multipath device path\n", conf->dev);
140 + if (conf->cmd == CMD_VALID_PATH) {
141 + if (conf->ignore_wwids ||
142 + check_wwids_file(refwwid, 0) == 0)
146 - printf("%s is not a valid multipath device path\n", conf->dev);
148 + printf("%s %s a valid multipath device path\n",
149 + conf->dev, r == 0 ? "is" : "is not");
153 @@ -319,13 +322,13 @@ configure (void)
157 - if (conf->dev && !conf->list)
161 - if (conf->list > 1)
162 + if (conf->cmd == CMD_LIST_LONG)
163 /* extended path info '-ll' */
164 di_flag |= DI_SYSFS | DI_CHECKER;
165 - else if (conf->list)
166 + else if (conf->cmd == CMD_LIST_SHORT)
167 /* minimum path info '-l' */
170 @@ -345,7 +348,7 @@ configure (void)
172 filter_pathvec(pathvec, refwwid);
175 + if (conf->cmd != CMD_CREATE && conf->cmd != CMD_DRY_RUN) {
179 @@ -440,7 +443,7 @@ main (int argc, char *argv[])
181 long int timestamp = -1;
183 - while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
184 + while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BritT:qwW")) != EOF ) {
187 if (optarg[0] == ':')
188 @@ -476,7 +479,7 @@ main (int argc, char *argv[])
192 - while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
193 + while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BritT:qwW")) != EOF ) {
195 case 1: printf("optarg : %s\n",optarg);
197 @@ -499,11 +502,11 @@ main (int argc, char *argv[])
198 conf->allow_queueing = 1;
202 + conf->cmd = CMD_VALID_PATH;
205 - if (!conf->dry_run)
207 + if (conf->cmd == CMD_CREATE)
208 + conf->cmd = CMD_DRY_RUN;
211 conf->remove = FLUSH_ONE;
212 @@ -512,11 +515,10 @@ main (int argc, char *argv[])
213 conf->remove = FLUSH_ALL;
219 if (optarg && !strncmp(optarg, "l", 1))
221 + conf->cmd = CMD_LIST_LONG;
223 + conf->cmd = CMD_LIST_SHORT;
227 @@ -535,6 +537,9 @@ main (int argc, char *argv[])
229 conf->force_reload = 1;
232 + conf->ignore_wwids = 1;
237 @@ -548,13 +553,13 @@ main (int argc, char *argv[])
242 + conf->cmd = CMD_REMOVE_WWID;
246 + conf->cmd = CMD_RESET_WWIDS;
250 + conf->cmd = CMD_ADD_WWID;
253 fprintf(stderr, "Missing option argument\n");
254 @@ -600,16 +605,16 @@ main (int argc, char *argv[])
258 - if (conf->dry_run == 2 &&
259 + if (conf->cmd == CMD_VALID_PATH &&
260 (!conf->dev || conf->dev_type == DEV_DEVMAP)) {
261 condlog(0, "the -c option requires a path to check");
264 - if (conf->dry_run == 3 && !conf->dev) {
265 + if (conf->cmd == CMD_REMOVE_WWID && !conf->dev) {
266 condlog(0, "the -w option requires a device");
269 - if (conf->dry_run == 4) {
270 + if (conf->cmd == CMD_RESET_WWIDS) {
271 struct multipath * mpp;
274 Index: multipath-tools-130222/multipath/multipath.8
275 ===================================================================
276 --- multipath-tools-130222.orig/multipath/multipath.8
277 +++ multipath-tools-130222/multipath/multipath.8
278 @@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
280 .IR bindings_file \|]
282 -.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-A | \-w | \-W \|]
283 +.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-r | \-a | \-A | \-w | \-W \|]
285 .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
287 @@ -55,6 +55,9 @@ print internal hardware table to stdout
292 +ignore wwids file when processing devices
295 treat the bindings file as read only
297 Index: multipath-tools-130222/libmultipath/configure.c
298 ===================================================================
299 --- multipath-tools-130222.orig/libmultipath/configure.c
300 +++ multipath-tools-130222/libmultipath/configure.c
301 @@ -580,7 +580,7 @@ domap (struct multipath * mpp, char * pa
303 * last chance to quit before touching the devmaps
305 - if (conf->dry_run && mpp->action != ACT_NOTHING) {
306 + if (conf->cmd == CMD_DRY_RUN && mpp->action != ACT_NOTHING) {
307 print_multipath_topology(mpp, conf->verbosity);
310 Index: multipath-tools-130222/libmultipath/discovery.c
311 ===================================================================
312 --- multipath-tools-130222.orig/libmultipath/discovery.c
313 +++ multipath-tools-130222/libmultipath/discovery.c
314 @@ -54,7 +54,8 @@ store_pathinfo (vector pathvec, vector h
316 pp->udev = udev_device_ref(udevice);
317 err = pathinfo(pp, hwtable,
318 - (conf->dry_run == 3)? flag : (flag | DI_BLACKLIST));
319 + (conf->cmd == CMD_REMOVE_WWID)? flag :
320 + (flag | DI_BLACKLIST));
324 @@ -1101,7 +1102,7 @@ get_uid (struct path * pp)
326 memset(pp->wwid, 0, WWID_SIZE);
327 value = udev_device_get_property_value(pp->udev, pp->uid_attribute);
328 - if ((!value || strlen(value) == 0) && conf->dry_run == 2)
329 + if ((!value || strlen(value) == 0) && conf->cmd == CMD_VALID_PATH)
330 value = getenv(pp->uid_attribute);
331 if (value && strlen(value)) {
332 size_t len = WWID_SIZE;