]> git.ipfire.org Git - ipfire-3.x.git/blame - multipath-tools/patches/0098-UPBZ-1067171-mutipath-i.patch
krb5: Update to 1.14.4
[ipfire-3.x.git] / multipath-tools / patches / 0098-UPBZ-1067171-mutipath-i.patch
CommitLineData
289c5516
MT
1---
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(-)
8
9Index: 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 {
14 DEV_DEVMAP
15 };
16
17+enum mpath_cmds {
18+ CMD_CREATE,
19+ CMD_DRY_RUN,
20+ CMD_LIST_SHORT,
21+ CMD_LIST_LONG,
22+ CMD_VALID_PATH,
23+ CMD_REMOVE_WWID,
24+ CMD_RESET_WWIDS,
25+ CMD_ADD_WWID,
26+};
27+
28 struct hwentry {
29 char * vendor;
30 char * product;
31@@ -79,8 +90,7 @@ struct mpentry {
32
33 struct config {
34 int verbosity;
35- int dry_run;
36- int list;
37+ enum mpath_cmds cmd;
38 int pgpolicy_flag;
39 int pgpolicy;
40 enum devtypes dev_type;
41@@ -98,6 +108,7 @@ struct config {
42 int max_fds;
43 int force_reload;
44 int queue_without_daemon;
45+ int ignore_wwids;
46 int checker_timeout;
47 int daemon;
48 int flush_on_last_del;
49Index: 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)
54 {
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
72 * about them
73 */
74- if (conf->list != 1)
75+ if (conf->cmd != CMD_LIST_SHORT)
76 update_paths(mpp);
77
78- if (conf->list > 1)
79+ if (conf->cmd == CMD_LIST_LONG)
80 mpp->bestpg = select_path_group(mpp);
81
82 disassemble_status(status, mpp);
83
84- if (conf->list)
85+ if (conf->cmd == CMD_LIST_SHORT ||
86+ conf->cmd == CMD_LIST_LONG)
87 print_multipath_topology(mpp, conf->verbosity);
88
89- if (!conf->dry_run)
90+ if (conf->cmd == CMD_CREATE)
91 reinstate_paths(mpp);
92 }
93 return 0;
94@@ -262,10 +264,11 @@ configure (void)
95 /*
96 * if we have a blacklisted device parameter, exit early
97 */
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",
106 conf->dev);
107 goto out;
108@@ -278,13 +281,13 @@ configure (void)
109 int failed = get_refwwid(conf->dev, conf->dev_type, pathvec,
110 &refwwid);
111 if (!refwwid) {
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);
115 else
116 condlog(3, "scope is nul");
117 goto out;
118 }
119- if (conf->dry_run == 3) {
120+ if (conf->cmd == CMD_REMOVE_WWID) {
121 r = remove_wwid(refwwid);
122 if (r == 0)
123 printf("wwid '%s' removed\n", refwwid);
124@@ -295,7 +298,7 @@ configure (void)
125 }
126 goto out;
127 }
128- if (conf->dry_run == 5) {
129+ if (conf->cmd == CMD_ADD_WWID) {
130 r = remember_wwid(refwwid);
131 if (r == 0)
132 printf("wwid '%s' added\n", refwwid);
133@@ -305,13 +308,13 @@ configure (void)
134 goto out;
135 }
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)
143 r = 0;
144- }
145- else
146- printf("%s is not a valid multipath device path\n", conf->dev);
147+
148+ printf("%s %s a valid multipath device path\n",
149+ conf->dev, r == 0 ? "is" : "is not");
150 goto out;
151 }
152 }
153@@ -319,13 +322,13 @@ configure (void)
154 /*
155 * get a path list
156 */
157- if (conf->dev && !conf->list)
158+ if (conf->dev)
159 di_flag = DI_WWID;
160
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' */
168 di_flag |= DI_SYSFS;
169 else
170@@ -345,7 +348,7 @@ configure (void)
171
172 filter_pathvec(pathvec, refwwid);
173
174- if (conf->list) {
175+ if (conf->cmd != CMD_CREATE && conf->cmd != CMD_DRY_RUN) {
176 r = 0;
177 goto out;
178 }
179@@ -440,7 +443,7 @@ main (int argc, char *argv[])
180 int r = 1;
181 long int timestamp = -1;
182 int valid = -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 ) {
185 switch(arg) {
186 case 'T':
187 if (optarg[0] == ':')
188@@ -476,7 +479,7 @@ main (int argc, char *argv[])
189 if (dm_prereq())
190 exit(1);
191
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 ) {
194 switch(arg) {
195 case 1: printf("optarg : %s\n",optarg);
196 break;
197@@ -499,11 +502,11 @@ main (int argc, char *argv[])
198 conf->allow_queueing = 1;
199 break;
200 case 'c':
201- conf->dry_run = 2;
202+ conf->cmd = CMD_VALID_PATH;
203 break;
204 case 'd':
205- if (!conf->dry_run)
206- conf->dry_run = 1;
207+ if (conf->cmd == CMD_CREATE)
208+ conf->cmd = CMD_DRY_RUN;
209 break;
210 case 'f':
211 conf->remove = FLUSH_ONE;
212@@ -512,11 +515,10 @@ main (int argc, char *argv[])
213 conf->remove = FLUSH_ALL;
214 break;
215 case 'l':
216- conf->list = 1;
217- conf->dry_run = 1;
218-
219 if (optarg && !strncmp(optarg, "l", 1))
220- conf->list++;
221+ conf->cmd = CMD_LIST_LONG;
222+ else
223+ conf->cmd = CMD_LIST_SHORT;
224
225 break;
226 case 'M':
227@@ -535,6 +537,9 @@ main (int argc, char *argv[])
228 case 'r':
229 conf->force_reload = 1;
230 break;
231+ case 'i':
232+ conf->ignore_wwids = 1;
233+ break;
234 case 't':
235 r = dump_config();
236 goto out;
237@@ -548,13 +553,13 @@ main (int argc, char *argv[])
238 usage(argv[0]);
239 exit(0);
240 case 'w':
241- conf->dry_run = 3;
242+ conf->cmd = CMD_REMOVE_WWID;
243 break;
244 case 'W':
245- conf->dry_run = 4;
246+ conf->cmd = CMD_RESET_WWIDS;
247 break;
248 case 'a':
249- conf->dry_run = 5;
250+ conf->cmd = CMD_ADD_WWID;
251 break;
252 case ':':
253 fprintf(stderr, "Missing option argument\n");
254@@ -600,16 +605,16 @@ main (int argc, char *argv[])
255 }
256 dm_init();
257
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");
262 goto out;
263 }
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");
267 goto out;
268 }
269- if (conf->dry_run == 4) {
270+ if (conf->cmd == CMD_RESET_WWIDS) {
271 struct multipath * mpp;
272 int i;
273 vector curmp;
274Index: 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
279 .RB [\| \-b\ \c
280 .IR bindings_file \|]
281 .RB [\| \-d \|]
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 \|]
284 .RB [\| \-p\ \c
285 .BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
286 .RB [\| device \|]
287@@ -55,6 +55,9 @@ print internal hardware table to stdout
288 .B \-r
289 force devmap reload
290 .TP
291+.B \-i
292+ignore wwids file when processing devices
293+.TP
294 .B \-B
295 treat the bindings file as read only
296 .TP
297Index: 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
302 /*
303 * last chance to quit before touching the devmaps
304 */
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);
308 return DOMAP_DRY;
309 }
310Index: 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
315 }
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));
321 if (err)
322 goto out;
323
324@@ -1101,7 +1102,7 @@ get_uid (struct path * pp)
325
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;