Esempio n. 1
0
int
get_alua_info(int fd)
{
	int	rc;
	int	tpg;

	rc = get_target_port_group_support(fd);
	if (rc < 0)
		return -ALUA_PRIO_TPGS_FAILED;

	if (rc == TPGS_NONE)
		return -ALUA_PRIO_NOT_SUPPORTED;

	tpg = get_target_port_group(fd);
	if (tpg < 0)
		return -ALUA_PRIO_RTPG_FAILED;

	condlog(3, "reported target port group is %i", tpg);
	rc = get_asymmetric_access_state(fd, tpg);
	if (rc < 0)
		return -ALUA_PRIO_GETAAS_FAILED;

	condlog(3, "aas = %02x [%s]%s", rc, aas_print_string(rc),
		(rc & 0x80) ? " [preferred]" : "");
	return rc;
}
Esempio n. 2
0
void
detect_prio(struct path * pp)
{
	struct prio *p = &pp->prio;

	if (get_target_port_group_support(pp->fd) > 0)
		prio_get(p, PRIO_ALUA, DEFAULT_PRIO_ARGS);
}
Esempio n. 3
0
void
detect_prio(struct config *conf, struct path * pp)
{
	int ret;
	struct prio *p = &pp->prio;
	int tpgs = 0;
	unsigned int timeout = conf->checker_timeout;
	char buff[512];
	char *default_prio = PRIO_ALUA;

	if ((tpgs = get_target_port_group_support(pp->fd, timeout)) <= 0)
		return;
	pp->tpgs = tpgs;
	ret = get_target_port_group(pp, timeout);
	if (ret < 0)
		return;
	if (get_asymmetric_access_state(pp->fd, ret, timeout) < 0)
		return;
	if (sysfs_get_asymmetric_access_state(pp, buff, 512) >= 0)
		default_prio = PRIO_SYSFS;
	prio_get(conf->multipath_dir, p, default_prio, DEFAULT_PRIO_ARGS);
}
Esempio n. 4
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;
}