Select 'features' from multipath configuration
authorHannes Reinecke <hare@suse.de>
Fri, 13 Mar 2009 14:21:29 +0000 (15:21 +0100)
committerHannes Reinecke <hare@suse.de>
Tue, 3 May 2011 12:54:24 +0000 (14:54 +0200)
For some setups we need to set the 'features' keyword from the
multipath configuration setting.

Signed-off-by: Hannes Reinecke <hare@suse.de>
libmultipath/config.h
libmultipath/dict.c
libmultipath/propsel.c
multipath/multipath.conf.5

index 46cd32a..af8adb9 100644 (file)
@@ -45,6 +45,7 @@ struct mpentry {
        char * alias;
        char * getuid;
        char * selector;
+       char * features;
 
        int pgpolicy;
        int pgfailback;
index b4d3103..299ec82 100644 (file)
@@ -1424,6 +1424,22 @@ mp_pg_timeout_handler(vector strvec)
        return 0;
 }
 
+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)
 {
@@ -1622,6 +1638,20 @@ snprint_mp_pg_timeout (char * buff, int len, void * data)
        return 0;
 }
 
+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)
 {
@@ -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);
index 2055d2a..b0f3ceb 100644 (file)
@@ -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)",
index 8edaccd..43a0c27 100644 (file)
@@ -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