diff options
author | Hannes Reinecke <hare@suse.de> | 2009-03-13 15:21:29 +0100 |
---|---|---|
committer | Hannes Reinecke <hare@suse.de> | 2011-05-03 14:54:24 +0200 |
commit | 8bb36bd60fe706961e39322db139f8e0430662f1 (patch) | |
tree | 6a7ac18ce9c1fdc86d6a40ac63ad72ad6227bf29 | |
parent | b179750124ae896f53cdb6ad6f349e4c2e62750b (diff) | |
download | multipath-tools-8bb36bd60fe706961e39322db139f8e0430662f1.tar.gz |
Select 'features' from multipath configuration
For some setups we need to set the 'features' keyword from the
multipath configuration setting.
Signed-off-by: Hannes Reinecke <hare@suse.de>
-rw-r--r-- | libmultipath/config.h | 1 | ||||
-rw-r--r-- | libmultipath/dict.c | 31 | ||||
-rw-r--r-- | libmultipath/propsel.c | 10 | ||||
-rw-r--r-- | multipath/multipath.conf.5 | 4 |
4 files changed, 46 insertions, 0 deletions
diff --git a/libmultipath/config.h b/libmultipath/config.h index 46cd32a..af8adb9 100644 --- a/libmultipath/config.h +++ b/libmultipath/config.h @@ -45,6 +45,7 @@ struct mpentry { char * alias; char * getuid; char * selector; + char * features; int pgpolicy; int pgfailback; diff --git a/libmultipath/dict.c b/libmultipath/dict.c index b4d3103..299ec82 100644 --- a/libmultipath/dict.c +++ b/libmultipath/dict.c @@ -1425,6 +1425,22 @@ mp_pg_timeout_handler(vector strvec) } static int +mp_features_handler(vector strvec) +{ + struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable); + + if (!mpe) + return 1; + + mpe->features = set_value(strvec); + + if (!mpe->features) + return 1; + + return 0; +} + +static int mp_flush_on_last_del_handler(vector strvec) { struct mpentry *mpe = VECTOR_LAST_SLOT(conf->mptable); @@ -1623,6 +1639,20 @@ snprint_mp_pg_timeout (char * buff, int len, void * data) } static int +snprint_mp_features (char * buff, int len, void * data) +{ + struct mpentry * mpe = (struct mpentry *)data; + + if (!mpe->features) + return 0; + if (strlen(mpe->features) == strlen(conf->features) && + !strcmp(mpe->features, conf->features)) + return 0; + + return snprintf(buff, len, "%s", mpe->features); +} + +static int snprint_mp_flush_on_last_del (char * buff, int len, void * data) { struct mpentry * mpe = (struct mpentry *)data; @@ -2332,6 +2362,7 @@ init_keywords(void) install_keyword("rr_min_io_rq", &mp_minio_rq_handler, &snprint_mp_rr_min_io_rq); install_keyword("pg_timeout", &mp_pg_timeout_handler, &snprint_mp_pg_timeout); install_keyword("flush_on_last_del", &mp_flush_on_last_del_handler, &snprint_mp_flush_on_last_del); + install_keyword("features", &mp_features_handler, &snprint_mp_features); install_keyword("mode", &mp_mode_handler, &snprint_mp_mode); install_keyword("uid", &mp_uid_handler, &snprint_mp_uid); install_keyword("gid", &mp_gid_handler, &snprint_mp_gid); diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c index 2055d2a..b0f3ceb 100644 --- a/libmultipath/propsel.c +++ b/libmultipath/propsel.c @@ -260,6 +260,16 @@ select_alias (struct multipath * mp) extern int select_features (struct multipath * mp) { + struct mpentry * mpe; + + if ((mpe = find_mpe(mp->wwid))) { + if (mpe->features) { + mp->features = mpe->features; + condlog(3, "%s: features = %s (LUN setting)", + mp->alias, mp->features); + return 0; + } + } if (mp->hwe && mp->hwe->features) { mp->features = mp->hwe->features; condlog(3, "%s: features = %s (controller setting)", diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5 index 8edaccd..43a0c27 100644 --- a/multipath/multipath.conf.5 +++ b/multipath/multipath.conf.5 @@ -364,6 +364,8 @@ Index of the container. Mandatory for this subsection. The following attributes are optional; if not set the default values are taken from the .I defaults +or +.I devices section: .sp 1 .PD .1v @@ -378,6 +380,8 @@ section: .B no_path_retry .TP .B rr_min_io +.TP +.B features .RE .PD .LP |