multipath: adjust messages
[multipath-tools/.git] / libmultipath / configure.c
1 /*
2  * Copyright (c) 2003, 2004, 2005 Christophe Varoqui
3  * Copyright (c) 2005 Benjamin Marzinski, Redhat
4  * Copyright (c) 2005 Kiyoshi Ueda, NEC
5  * Copyright (c) 2005 Patrick Caulfield, Redhat
6  * Copyright (c) 2005 Edward Goggin, EMC
7  */
8
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <unistd.h>
12 #include <string.h>
13 #include <sys/file.h>
14 #include <errno.h>
15 #include <libdevmapper.h>
16
17 #include "checkers.h"
18 #include "vector.h"
19 #include "memory.h"
20 #include "devmapper.h"
21 #include "defaults.h"
22 #include "structs.h"
23 #include "structs_vec.h"
24 #include "dmparser.h"
25 #include "config.h"
26 #include "blacklist.h"
27 #include "propsel.h"
28 #include "discovery.h"
29 #include "debug.h"
30 #include "switchgroup.h"
31 #include "print.h"
32 #include "configure.h"
33 #include "pgpolicies.h"
34 #include "dict.h"
35 #include "alias.h"
36 #include "prio.h"
37 #include "util.h"
38 #include "uxsock.h"
39
40 extern int
41 setup_map (struct multipath * mpp, char * params, int params_size)
42 {
43         struct pathgroup * pgp;
44         int i;
45
46         /*
47          * don't bother if devmap size is unknown
48          */
49         if (mpp->size <= 0) {
50                 condlog(3, "%s: devmap size is unknown", mpp->alias);
51                 return 1;
52         }
53
54         /*
55          * free features, selector, and hwhandler properties if they are being reused
56          */
57         free_multipath_attributes(mpp);
58
59         /*
60          * properties selectors
61          */
62         select_pgfailback(mpp);
63         select_pgpolicy(mpp);
64         select_selector(mpp);
65         select_features(mpp);
66         select_hwhandler(mpp);
67         select_rr_weight(mpp);
68         select_minio(mpp);
69         select_no_path_retry(mpp);
70         select_pg_timeout(mpp);
71         select_mode(mpp);
72         select_uid(mpp);
73         select_gid(mpp);
74         select_fast_io_fail(mpp);
75         select_dev_loss(mpp);
76         select_reservation_key(mpp);
77
78         sysfs_set_scsi_tmo(mpp);
79         /*
80          * assign paths to path groups -- start with no groups and all paths
81          * in mpp->paths
82          */
83         if (mpp->pg) {
84                 vector_foreach_slot (mpp->pg, pgp, i)
85                         free_pathgroup(pgp, KEEP_PATHS);
86
87                 vector_free(mpp->pg);
88                 mpp->pg = NULL;
89         }
90         if (mpp->pgpolicyfn && mpp->pgpolicyfn(mpp))
91                 return 1;
92
93         mpp->nr_active = pathcount(mpp, PATH_UP) + pathcount(mpp, PATH_GHOST);
94
95         /*
96          * ponders each path group and determine highest prio pg
97          * to switch over (default to first)
98          */
99         mpp->bestpg = select_path_group(mpp);
100
101         /*
102          * transform the mp->pg vector of vectors of paths
103          * into a mp->params strings to feed the device-mapper
104          */
105         if (assemble_map(mpp, params, params_size)) {
106                 condlog(0, "%s: problem assembing map", mpp->alias);
107                 return 1;
108         }
109         return 0;
110 }
111
112 static void
113 compute_pgid(struct pathgroup * pgp)
114 {
115         struct path * pp;
116         int i;
117
118         vector_foreach_slot (pgp->paths, pp, i)
119                 pgp->id ^= (long)pp;
120 }
121
122 static int
123 pgcmp (struct multipath * mpp, struct multipath * cmpp)
124 {
125         int i, j;
126         struct pathgroup * pgp;
127         struct pathgroup * cpgp;
128         int r = 0;
129
130         if (!mpp)
131                 return 0;
132
133         vector_foreach_slot (mpp->pg, pgp, i) {
134                 compute_pgid(pgp);
135
136                 vector_foreach_slot (cmpp->pg, cpgp, j) {
137                         if (pgp->id == cpgp->id &&
138                             !pathcmp(pgp, cpgp)) {
139                                 r = 0;
140                                 break;
141                         }
142                         r++;
143                 }
144                 if (r)
145                         return r;
146         }
147         return r;
148 }
149
150 static void
151 select_action (struct multipath * mpp, vector curmp, int force_reload)
152 {
153         struct multipath * cmpp;
154
155         cmpp = find_mp_by_alias(curmp, mpp->alias);
156
157         if (!cmpp) {
158                 cmpp = find_mp_by_wwid(curmp, mpp->wwid);
159
160                 if (cmpp) {
161                         condlog(2, "%s: rename %s to %s", mpp->wwid,
162                                 cmpp->alias, mpp->alias);
163                         strncpy(mpp->alias_old, cmpp->alias, WWID_SIZE);
164                         mpp->action = ACT_RENAME;
165                         return;
166                 }
167                 mpp->action = ACT_CREATE;
168                 condlog(3, "%s: set ACT_CREATE (map does not exist)",
169                         mpp->alias);
170                 return;
171         }
172
173         if (!find_mp_by_wwid(curmp, mpp->wwid)) {
174                 condlog(2, "%s: remove (wwid changed)", cmpp->alias);
175                 dm_flush_map(mpp->alias);
176                 strncpy(cmpp->wwid, mpp->wwid, WWID_SIZE);
177                 drop_multipath(curmp, cmpp->wwid, KEEP_PATHS);
178                 mpp->action = ACT_CREATE;
179                 condlog(3, "%s: set ACT_CREATE (map wwid change)",
180                         mpp->alias);
181                 return;
182         }
183
184         if (pathcount(mpp, PATH_UP) == 0) {
185                 mpp->action = ACT_NOTHING;
186                 condlog(3, "%s: set ACT_NOTHING (no usable path)",
187                         mpp->alias);
188                 return;
189         }
190         if (force_reload) {
191                 mpp->action = ACT_RELOAD;
192                 condlog(3, "%s: set ACT_RELOAD (forced by user)",
193                         mpp->alias);
194                 return;
195         }
196         if (cmpp->size != mpp->size) {
197                 mpp->action = ACT_RESIZE;
198                 condlog(3, "%s: set ACT_RESIZE (size change)",
199                         mpp->alias);
200                 return;
201         }
202         if (!mpp->no_path_retry && !mpp->pg_timeout &&
203             (strlen(cmpp->features) != strlen(mpp->features) ||
204              strcmp(cmpp->features, mpp->features))) {
205                 mpp->action =  ACT_RELOAD;
206                 condlog(3, "%s: set ACT_RELOAD (features change)",
207                         mpp->alias);
208                 return;
209         }
210         if (!cmpp->selector || strncmp(cmpp->hwhandler, mpp->hwhandler,
211                     strlen(mpp->hwhandler))) {
212                 mpp->action = ACT_RELOAD;
213                 condlog(3, "%s: set ACT_RELOAD (hwhandler change)",
214                         mpp->alias);
215                 return;
216         }
217         if (!cmpp->selector || strncmp(cmpp->selector, mpp->selector,
218                     strlen(mpp->selector))) {
219                 mpp->action = ACT_RELOAD;
220                 condlog(3, "%s: set ACT_RELOAD (selector change)",
221                         mpp->alias);
222                 return;
223         }
224         if (cmpp->minio != mpp->minio) {
225                 mpp->action = ACT_RELOAD;
226                 condlog(3, "%s: set ACT_RELOAD (minio change, %u->%u)",
227                         mpp->alias, cmpp->minio, mpp->minio);
228                 return;
229         }
230         if (!cmpp->pg || VECTOR_SIZE(cmpp->pg) != VECTOR_SIZE(mpp->pg)) {
231                 mpp->action = ACT_RELOAD;
232                 condlog(3, "%s: set ACT_RELOAD (path group number change)",
233                         mpp->alias);
234                 return;
235         }
236         if (pgcmp(mpp, cmpp)) {
237                 mpp->action = ACT_RELOAD;
238                 condlog(3, "%s: set ACT_RELOAD (path group topology change)",
239                         mpp->alias);
240                 return;
241         }
242         if (cmpp->nextpg != mpp->bestpg) {
243                 mpp->action = ACT_SWITCHPG;
244                 condlog(3, "%s: set ACT_SWITCHPG (next path group change)",
245                         mpp->alias);
246                 return;
247         }
248         mpp->action = ACT_NOTHING;
249         condlog(3, "%s: set ACT_NOTHING (map unchanged)",
250                 mpp->alias);
251         return;
252 }
253
254 extern int
255 reinstate_paths (struct multipath * mpp)
256 {
257         int i, j;
258         struct pathgroup * pgp;
259         struct path * pp;
260
261         if (!mpp->pg)
262                 return 0;
263
264         vector_foreach_slot (mpp->pg, pgp, i) {
265                 if (!pgp->paths)
266                         continue;
267
268                 vector_foreach_slot (pgp->paths, pp, j) {
269                         if (pp->state != PATH_UP &&
270                             (pgp->status == PGSTATE_DISABLED ||
271                              pgp->status == PGSTATE_ACTIVE))
272                                 continue;
273
274                         if (pp->dmstate == PSTATE_FAILED) {
275                                 if (dm_reinstate_path(mpp->alias, pp->dev_t))
276                                         condlog(0, "%s: error reinstating",
277                                                 pp->dev);
278                         }
279                 }
280         }
281         return 0;
282 }
283
284 static int
285 lock_multipath (struct multipath * mpp, int lock)
286 {
287         struct pathgroup * pgp;
288         struct path * pp;
289         int i, j;
290         int x, y;
291
292         if (!mpp || !mpp->pg)
293                 return 0;
294
295         vector_foreach_slot (mpp->pg, pgp, i) {
296                 if (!pgp->paths)
297                         continue;
298                 vector_foreach_slot(pgp->paths, pp, j) {
299                         if (lock && flock(pp->fd, LOCK_EX | LOCK_NB) &&
300                             errno == EWOULDBLOCK)
301                                 goto fail;
302                         else if (!lock)
303                                 flock(pp->fd, LOCK_UN);
304                 }
305         }
306         return 0;
307 fail:
308         vector_foreach_slot (mpp->pg, pgp, x) {
309                 if (x > i)
310                         return 1;
311                 if (!pgp->paths)
312                         continue;
313                 vector_foreach_slot(pgp->paths, pp, y) {
314                         if (x == i && y >= j)
315                                 return 1;
316                         flock(pp->fd, LOCK_UN);
317                 }
318         }
319         return 1;
320 }
321
322 /*
323  * Return value:
324  */
325 #define DOMAP_RETRY     -1
326 #define DOMAP_FAIL      0
327 #define DOMAP_OK        1
328 #define DOMAP_EXIST     2
329 #define DOMAP_DRY       3
330
331 extern int
332 domap (struct multipath * mpp, char * params)
333 {
334         int r = 0;
335
336         /*
337          * last chance to quit before touching the devmaps
338          */
339         if (conf->dry_run && mpp->action != ACT_NOTHING) {
340                 print_multipath_topology(mpp, conf->verbosity);
341                 return DOMAP_DRY;
342         }
343
344         switch (mpp->action) {
345         case ACT_REJECT:
346         case ACT_NOTHING:
347                 return DOMAP_EXIST;
348
349         case ACT_SWITCHPG:
350                 dm_switchgroup(mpp->alias, mpp->bestpg);
351                 /*
352                  * we may have avoided reinstating paths because there where in
353                  * active or disabled PG. Now that the topology has changed,
354                  * retry.
355                  */
356                 reinstate_paths(mpp);
357                 return DOMAP_EXIST;
358
359         case ACT_CREATE:
360                 if (lock_multipath(mpp, 1)) {
361                         condlog(3, "%s: failed to create map (in use)",
362                                 mpp->alias);
363                         return DOMAP_RETRY;
364                 }
365
366                 if (dm_map_present(mpp->alias)) {
367                         condlog(3, "%s: map already present", mpp->alias);
368                         lock_multipath(mpp, 0);
369                         break;
370                 }
371
372                 r = dm_addmap_create(mpp, params);
373
374                 if (!r)
375                         r = dm_addmap_create_ro(mpp, params);
376
377                 lock_multipath(mpp, 0);
378                 break;
379
380         case ACT_RELOAD:
381                 r = dm_addmap_reload(mpp, params);
382                 if (!r)
383                         r = dm_addmap_reload_ro(mpp, params);
384                 if (r)
385                         r = dm_simplecmd_noflush(DM_DEVICE_RESUME, mpp->alias);
386                 break;
387
388         case ACT_RESIZE:
389                 r = dm_addmap_reload(mpp, params);
390                 if (!r)
391                         r = dm_addmap_reload_ro(mpp, params);
392                 if (r)
393                         r = dm_simplecmd_flush(DM_DEVICE_RESUME, mpp->alias, 1);
394                 break;
395
396         case ACT_RENAME:
397                 r = dm_rename(mpp->alias_old, mpp->alias);
398                 break;
399
400         default:
401                 break;
402         }
403
404         if (r) {
405                 /*
406                  * DM_DEVICE_CREATE, DM_DEVICE_RENAME, or DM_DEVICE_RELOAD
407                  * succeeded
408                  */
409                 if (!conf->daemon) {
410                         /* multipath client mode */
411                         dm_switchgroup(mpp->alias, mpp->bestpg);
412                 } else  {
413                         /* multipath daemon mode */
414                         mpp->stat_map_loads++;
415                         condlog(2, "%s: load table [0 %llu %s %s]", mpp->alias,
416                                 mpp->size, TGT_MPATH, params);
417                         /*
418                          * Required action is over, reset for the stateful daemon.
419                          * But don't do it for creation as we use in the caller the
420                          * mpp->action to figure out whether to start the watievent checker.
421                          */
422                         if (mpp->action != ACT_CREATE)
423                                 mpp->action = ACT_NOTHING;
424                 }
425                 dm_setgeometry(mpp);
426                 return DOMAP_OK;
427         }
428         return DOMAP_FAIL;
429 }
430
431 static int
432 deadmap (struct multipath * mpp)
433 {
434         int i, j;
435         struct pathgroup * pgp;
436         struct path * pp;
437
438         if (!mpp->pg)
439                 return 1;
440
441         vector_foreach_slot (mpp->pg, pgp, i) {
442                 if (!pgp->paths)
443                         continue;
444
445                 vector_foreach_slot (pgp->paths, pp, j)
446                         if (strlen(pp->dev))
447                                 return 0; /* alive */
448         }
449
450         return 1; /* dead */
451 }
452
453 int check_daemon(void)
454 {
455         int fd;
456         char *reply;
457         size_t len;
458         int ret = 0;
459
460         fd = ux_socket_connect(DEFAULT_SOCKET);
461         if (fd == -1)
462                 return 0;
463
464         if (send_packet(fd, "show daemon", 12) != 0)
465                 goto out;
466         if (recv_packet(fd, &reply, &len) != 0)
467                 goto out;
468
469         if (strstr(reply, "shutdown"))
470                 goto out_free;
471
472         ret = 1;
473
474 out_free:
475         FREE(reply);
476 out:
477         close(fd);
478         return ret;
479 }
480
481 extern int
482 coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid, int force_reload)
483 {
484         int r = 1;
485         int k, i;
486         char empty_buff[WWID_SIZE];
487         char params[PARAMS_SIZE];
488         struct multipath * mpp;
489         struct path * pp1;
490         struct path * pp2;
491         vector curmp = vecs->mpvec;
492         vector pathvec = vecs->pathvec;
493
494         memset(empty_buff, 0, WWID_SIZE);
495
496         if (force_reload) {
497                 vector_foreach_slot (pathvec, pp1, k) {
498                         pp1->mpp = NULL;
499                 }
500         }
501         vector_foreach_slot (pathvec, pp1, k) {
502                 /* skip this path for some reason */
503
504                 /* 1. if path has no unique id or wwid blacklisted */
505                 if (memcmp(empty_buff, pp1->wwid, WWID_SIZE) == 0 ||
506                     filter_path(conf, pp1) > 0) {
507                         orphan_path(pp1);
508                         continue;
509                 }
510
511                 /* 2. if path already coalesced */
512                 if (pp1->mpp)
513                         continue;
514
515                 /* 3. if path has disappeared */
516                 if (!pp1->size) {
517                         orphan_path(pp1);
518                         continue;
519                 }
520
521                 /* 4. path is out of scope */
522                 if (refwwid && strncmp(pp1->wwid, refwwid, WWID_SIZE))
523                         continue;
524
525                 /*
526                  * at this point, we know we really got a new mp
527                  */
528                 mpp = add_map_with_path(vecs, pp1, 0);
529                 if (!mpp)
530                         return 1;
531
532                 if (pp1->priority == PRIO_UNDEF)
533                         mpp->action = ACT_REJECT;
534
535                 if (!mpp->paths) {
536                         condlog(0, "%s: skip coalesce (no paths)", mpp->alias);
537                         remove_map(mpp, vecs, 0);
538                         continue;
539                 }
540
541                 for (i = k + 1; i < VECTOR_SIZE(pathvec); i++) {
542                         pp2 = VECTOR_SLOT(pathvec, i);
543
544                         if (strcmp(pp1->wwid, pp2->wwid))
545                                 continue;
546
547                         if (!pp2->size)
548                                 continue;
549
550                         if (pp2->size != mpp->size) {
551                                 /*
552                                  * ouch, avoid feeding that to the DM
553                                  */
554                                 condlog(0, "%s: size %llu, expected %llu. "
555                                         "Discard", pp2->dev_t, pp2->size,
556                                         mpp->size);
557                                 mpp->action = ACT_REJECT;
558                         }
559                         if (pp2->priority == PRIO_UNDEF)
560                                 mpp->action = ACT_REJECT;
561                 }
562                 verify_paths(mpp, vecs, NULL);
563
564                 params[0] = '\0';
565                 if (setup_map(mpp, params, PARAMS_SIZE)) {
566                         remove_map(mpp, vecs, 0);
567                         continue;
568                 }
569
570                 if (mpp->action == ACT_UNDEF)
571                         select_action(mpp, curmp, force_reload);
572
573                 r = domap(mpp, params);
574
575                 if (r == DOMAP_FAIL || r == DOMAP_RETRY) {
576                         condlog(3, "%s: domap (%u) failure "
577                                    "for create/reload map",
578                                 mpp->alias, r);
579                         if (r == DOMAP_FAIL) {
580                                 condlog(2, "%s: %s map",
581                                         mpp->alias, (mpp->action == ACT_CREATE)?
582                                         "ignoring" : "removing");
583                                 remove_map(mpp, vecs, 0);
584                                 continue;
585                         } else /* if (r == DOMAP_RETRY) */
586                                 return r;
587                 }
588                 if (r == DOMAP_DRY)
589                         continue;
590
591                 if (!conf->daemon && !conf->allow_queueing && !check_daemon()) {
592                         if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
593                             mpp->no_path_retry != NO_PATH_RETRY_FAIL)
594                                 condlog(3, "%s: multipathd not running, unset "
595                                         "queue_if_no_path feature", mpp->alias);
596                         if (!dm_queue_if_no_path(mpp->alias, 0))
597                                 remove_feature(&mpp->features,
598                                                "queue_if_no_path");
599                 }
600                 else if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) {
601                         if (mpp->no_path_retry == NO_PATH_RETRY_FAIL) {
602                                 condlog(3, "%s: unset queue_if_no_path feature",
603                                         mpp->alias);
604                                 if (!dm_queue_if_no_path(mpp->alias, 0))
605                                         remove_feature(&mpp->features,
606                                                        "queue_if_no_path");
607                         } else {
608                                 condlog(3, "%s: set queue_if_no_path feature",
609                                         mpp->alias);
610                                 if (!dm_queue_if_no_path(mpp->alias, 1))
611                                         add_feature(&mpp->features,
612                                                     "queue_if_no_path");
613                         }
614                 }
615                 if (mpp->pg_timeout != PGTIMEOUT_UNDEF) {
616                         if (mpp->pg_timeout == -PGTIMEOUT_NONE)
617                                 dm_set_pg_timeout(mpp->alias,  0);
618                         else
619                                 dm_set_pg_timeout(mpp->alias, mpp->pg_timeout);
620                 }
621
622                 if (!conf->daemon && mpp->action != ACT_NOTHING)
623                         print_multipath_topology(mpp, conf->verbosity);
624
625                 if (newmp) {
626                         if (mpp->action != ACT_REJECT) {
627                                 if (!vector_alloc_slot(newmp))
628                                         return 1;
629                                 vector_set_slot(newmp, mpp);
630                         }
631                         else
632                                 remove_map(mpp, vecs, 0);
633                 }
634         }
635         /*
636          * Flush maps with only dead paths (ie not in sysfs)
637          * Keep maps with only failed paths
638          */
639         if (newmp) {
640                 vector_foreach_slot (newmp, mpp, i) {
641                         char alias[WWID_SIZE];
642                         int j;
643
644                         if (!deadmap(mpp))
645                                 continue;
646
647                         strncpy(alias, mpp->alias, WWID_SIZE);
648
649                         if ((j = find_slot(newmp, (void *)mpp)) != -1)
650                                 vector_del_slot(newmp, j);
651
652                         remove_map(mpp, vecs, 0);
653
654                         if (dm_flush_map(alias))
655                                 condlog(2, "%s: remove failed (dead)",
656                                         alias);
657                         else
658                                 condlog(2, "%s: remove (dead)", alias);
659                 }
660         }
661         return 0;
662 }
663
664 extern char *
665 get_refwwid (char * dev, enum devtypes dev_type, vector pathvec)
666 {
667         struct path * pp;
668         char buff[FILE_NAME_SIZE];
669         char * refwwid = NULL, tmpwwid[WWID_SIZE];
670
671         if (dev_type == DEV_NONE)
672                 return NULL;
673
674         if (dev_type == DEV_DEVNODE) {
675                 if (basenamecpy(dev, buff, FILE_NAME_SIZE) == 0) {
676                         condlog(1, "basename failed for '%s' (%s)",
677                                 dev, buff);
678                         return NULL;
679                 }
680
681                 pp = find_path_by_dev(pathvec, buff);
682                 if (!pp) {
683                         pp = alloc_path();
684
685                         if (!pp)
686                                 return NULL;
687
688                         strncpy(pp->dev, buff, FILE_NAME_SIZE);
689
690                         if (pathinfo(pp, conf->hwtable, DI_SYSFS | DI_WWID))
691                                 return NULL;
692
693                         if (store_path(pathvec, pp)) {
694                                 free_path(pp);
695                                 return NULL;
696                         }
697                 }
698                 refwwid = pp->wwid;
699                 goto out;
700         }
701
702         if (dev_type == DEV_DEVT) {
703                 strchop(dev);
704                 pp = find_path_by_devt(pathvec, dev);
705                 if (!pp) {
706                         if (devt2devname(buff, FILE_NAME_SIZE, dev))
707                                 return NULL;
708
709                         pp = alloc_path();
710
711                         if (!pp)
712                                 return NULL;
713
714                         strncpy(pp->dev, buff, FILE_NAME_SIZE);
715
716                         if (pathinfo(pp, conf->hwtable, DI_SYSFS | DI_WWID))
717                                 return NULL;
718
719                         if (store_path(pathvec, pp)) {
720                                 free_path(pp);
721                                 return NULL;
722                         }
723                 }
724                 refwwid = pp->wwid;
725                 goto out;
726         }
727         if (dev_type == DEV_DEVMAP) {
728
729                 if (((dm_get_uuid(dev, tmpwwid)) == 0) && (strlen(tmpwwid))) {
730                         refwwid = tmpwwid;
731                         goto out;
732                 }
733
734                 /*
735                  * may be a binding
736                  */
737                 refwwid = get_user_friendly_wwid(dev,
738                                                  conf->bindings_file);
739
740                 if (refwwid)
741                         return refwwid;
742
743                 /*
744                  * or may be an alias
745                  */
746                 refwwid = get_mpe_wwid(dev);
747
748                 /*
749                  * or directly a wwid
750                  */
751                 if (!refwwid)
752                         refwwid = dev;
753         }
754 out:
755         if (refwwid && strlen(refwwid))
756                 return STRDUP(refwwid);
757
758         return NULL;
759 }
760
761 extern int reload_map(struct vectors *vecs, struct multipath *mpp)
762 {
763         char params[PARAMS_SIZE];
764         int r;
765
766         update_mpp_paths(mpp, vecs->pathvec);
767
768         params[0] = '\0';
769         if (setup_map(mpp, params, PARAMS_SIZE)) {
770                 condlog(0, "%s: failed to setup map", mpp->alias);
771                 return 1;
772         }
773         select_action(mpp, vecs->mpvec, 1);
774
775         r = domap(mpp, params);
776         if (r == DOMAP_FAIL || r == DOMAP_RETRY) {
777                 condlog(3, "%s: domap (%u) failure "
778                         "for reload map", mpp->alias, r);
779                 return 1;
780         }
781         if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF) {
782                 if (mpp->no_path_retry == NO_PATH_RETRY_FAIL)
783                         dm_queue_if_no_path(mpp->alias, 0);
784                 else
785                         dm_queue_if_no_path(mpp->alias, 1);
786         }
787         if (mpp->pg_timeout != PGTIMEOUT_UNDEF) {
788                 if (mpp->pg_timeout == -PGTIMEOUT_NONE)
789                         dm_set_pg_timeout(mpp->alias,  0);
790                 else
791                         dm_set_pg_timeout(mpp->alias, mpp->pg_timeout);
792         }
793
794         return 0;
795 }