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; }
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); }