summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@canonical.com>2010-02-12 12:18:59 +0000
committerChristophe Varoqui <christophe.varoqui@free.fr>2010-02-13 15:32:02 +0100
commitb68400c7b1a1863bd606e7909b2ab3fb2df3c7b7 (patch)
tree4b3f913148d8336ae8ca11daf115771706ccf567
parent1d4089c41874a4cafdb6627d5cbb6797d9e47184 (diff)
downloadmultipath-tools-b68400c7b1a1863bd606e7909b2ab3fb2df3c7b7.tar.gz
multipath-tools-b68400c7b1a1863bd606e7909b2ab3fb2df3c7b7.tar.bz2
multipath-tools-b68400c7b1a1863bd606e7909b2ab3fb2df3c7b7.zip
Honour ALUA preference indicator
SPC defines the preference indicator (bit 7 of the first byte returned by REPORT TARGET PORT GROUPS) as indicating a preferred primary target port group, and says that applications may use it to influence path selection. Choose TPGs with this bit set over TPGs with it unset. This fixes failback handling with the Intel Modular Server. Signed-off-by: Yingying Zhao <yingying.zhao@intel.com> Signed-off-by: Colin Watson <cjwatson@canonical.com>
-rw-r--r--libmultipath/prioritizers/alua.c12
-rw-r--r--libmultipath/prioritizers/alua_spc3.h2
2 files changed, 11 insertions, 3 deletions
diff --git a/libmultipath/prioritizers/alua.c b/libmultipath/prioritizers/alua.c
index 0048a44..abf6232 100644
--- a/libmultipath/prioritizers/alua.c
+++ b/libmultipath/prioritizers/alua.c
@@ -37,6 +37,7 @@ get_alua_info(int fd)
};
int rc;
int tpg;
+ int aas;
rc = get_target_port_group_support(fd);
if (rc < 0)
@@ -53,22 +54,27 @@ get_alua_info(int fd)
rc = get_asymmetric_access_state(fd, tpg);
if (rc < 0)
return -ALUA_PRIO_GETAAS_FAILED;
+ aas = (rc & 0x0f);
condlog(3, "aas = [%s]",
- (rc < 4) ? aas_string[rc] : "invalid/reserved");
+ (aas < 4) ? aas_string[aas] : "invalid/reserved");
return rc;
}
int getprio (struct path * pp)
{
int rc;
+ int aas;
+ int priopath;
if (pp->fd < 0)
return -ALUA_PRIO_NO_INFORMATION;
rc = get_alua_info(pp->fd);
if (rc >= 0) {
- switch(rc) {
+ aas = (rc & 0x0f);
+ priopath = (rc & 0x80);
+ switch(aas) {
case AAS_OPTIMIZED:
rc = 50;
break;
@@ -81,6 +87,8 @@ int getprio (struct path * pp)
default:
rc = 0;
}
+ if (priopath)
+ rc += 80;
} else {
switch(-rc) {
case ALUA_PRIO_NOT_SUPPORTED:
diff --git a/libmultipath/prioritizers/alua_spc3.h b/libmultipath/prioritizers/alua_spc3.h
index bddbbdd..4bbdded 100644
--- a/libmultipath/prioritizers/alua_spc3.h
+++ b/libmultipath/prioritizers/alua_spc3.h
@@ -299,7 +299,7 @@ struct rtpg_tpg_dscr {
static inline int
rtpg_tpg_dscr_get_aas(struct rtpg_tpg_dscr *d)
{
- return (d->b0 & 0x0f);
+ return (d->b0 & 0x8f);
}
struct rtpg_data {