extern int select_features (struct multipath * mp) { struct mpentry * mpe; char *origin; if ((mpe = find_mpe(mp->wwid)) && mpe->features) { mp->features = STRDUP(mpe->features); origin = "LUN setting"; } else if (mp->hwe && mp->hwe->features) { mp->features = STRDUP(mp->hwe->features); origin = "controller setting"; } else if (conf->features) { mp->features = STRDUP(conf->features); origin = "config file default"; } else { mp->features = set_default(DEFAULT_FEATURES); origin = "internal default"; } condlog(3, "%s: features = %s (%s)", mp->alias, mp->features, origin); if (strstr(mp->features, "queue_if_no_path")) { if (mp->no_path_retry == NO_PATH_RETRY_UNDEF) mp->no_path_retry = NO_PATH_RETRY_QUEUE; else if (mp->no_path_retry == NO_PATH_RETRY_FAIL) { condlog(1, "%s: config error, overriding 'no_path_retry' value", mp->alias); mp->no_path_retry = NO_PATH_RETRY_QUEUE; } } return 0; }
extern int select_prio (struct path * pp) { struct mpentry * mpe; struct prio * p = &pp->prio; if (pp->detect_prio == DETECT_PRIO_ON) { detect_prio(pp); if (prio_selected(p)) { condlog(3, "%s: prio = %s (detected setting)", pp->dev, prio_name(p)); return 0; } } if ((mpe = find_mpe(pp->wwid))) { if (mpe->prio_name) { prio_get(p, mpe->prio_name, mpe->prio_args); condlog(3, "%s: prio = %s (LUN setting)", pp->dev, prio_name(p)); return 0; } } if (pp->hwe && pp->hwe->prio_name) { prio_get(p, pp->hwe->prio_name, pp->hwe->prio_args); condlog(3, "%s: prio = %s (controller setting)", pp->dev, pp->hwe->prio_name); condlog(3, "%s: prio args = %s (controller setting)", pp->dev, pp->hwe->prio_args); return 0; } if (conf->prio_name) { prio_get(p, conf->prio_name, conf->prio_args); condlog(3, "%s: prio = %s (config file default)", pp->dev, conf->prio_name); condlog(3, "%s: prio args = %s (config file default)", pp->dev, conf->prio_args); return 0; } prio_get(p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); condlog(3, "%s: prio = %s (internal default)", pp->dev, DEFAULT_PRIO); condlog(3, "%s: prio = %s (internal default)", pp->dev, DEFAULT_PRIO_ARGS); return 0; }
extern int select_prio (struct path * pp) { struct mpentry * mpe; if ((mpe = find_mpe(pp->wwid))) { if (mpe->prio_name) { pp->prio = prio_lookup(mpe->prio_name); prio_set_args(pp->prio, mpe->prio_args); condlog(3, "%s: prio = %s (LUN setting)", pp->dev, pp->prio->name); return 0; } } if (pp->hwe && pp->hwe->prio_name) { pp->prio = prio_lookup(pp->hwe->prio_name); prio_set_args(pp->prio, pp->hwe->prio_args); condlog(3, "%s: prio = %s (controller setting)", pp->dev, pp->hwe->prio_name); condlog(3, "%s: prio args = %s (controller setting)", pp->dev, pp->hwe->prio_args); return 0; } if (conf->prio_name) { pp->prio = prio_lookup(conf->prio_name); prio_set_args(pp->prio, conf->prio_args); condlog(3, "%s: prio = %s (config file default)", pp->dev, conf->prio_name); condlog(3, "%s: prio args = %s (config file default)", pp->dev, conf->prio_args); return 0; } pp->prio = prio_lookup(DEFAULT_PRIO); prio_set_args(pp->prio, DEFAULT_PRIO_ARGS); condlog(3, "%s: prio = %s (internal default)", pp->dev, DEFAULT_PRIO); condlog(3, "%s: prio = %s (internal default)", pp->dev, DEFAULT_PRIO_ARGS); return 0; }
int select_prio(struct config *conf, struct path *pp) { char *origin; struct mpentry * mpe; struct prio * p = &pp->prio; if (pp->detect_prio == DETECT_PRIO_ON) { detect_prio(conf, pp); if (prio_selected(p)) { origin = "(setting: array autodetected)"; goto out; } } mpe = find_mpe(conf->mptable, pp->wwid); set_prio(conf->multipath_dir, mpe, "(setting: multipath.conf multipaths section)"); set_prio(conf->multipath_dir, conf->overrides, "(setting: multipath.conf overrides section)"); set_prio(conf->multipath_dir, pp->hwe, "(setting: array configuration)"); set_prio(conf->multipath_dir, conf, "(setting: multipath.conf defaults/devices section)"); prio_get(conf->multipath_dir, p, DEFAULT_PRIO, DEFAULT_PRIO_ARGS); origin = "(setting: multipath internal)"; out: /* * fetch tpgs mode for alua, if its not already obtained */ if (!strncmp(prio_name(p), PRIO_ALUA, PRIO_NAME_LEN)) { int tpgs = 0; unsigned int timeout = conf->checker_timeout; if(!pp->tpgs && (tpgs = get_target_port_group_support(pp->fd, timeout)) >= 0) pp->tpgs = tpgs; } condlog(3, "%s: prio = %s %s", pp->dev, prio_name(p), origin); condlog(3, "%s: prio args = \"%s\" %s", pp->dev, prio_args(p), origin); return 0; }