libmultipath: select_action: check special features separately
authorMartin Wilck <mwilck@suse.de>
Tue, 28 Feb 2017 16:23:20 +0000 (17:23 +0100)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Thu, 23 Mar 2017 08:23:18 +0000 (09:23 +0100)
The features queue_if_no_path and retain_attached_hw_handler are
treated separately in libmultipath. Compare these features by looking
at the respective flags, and ignore them when comparing the "features"
string. assemble_map() does the ssame thing when constructing the
features string for device mapper.

Signed-off-by: Martin Wilck <mwilck@suse.com>
libmultipath/configure.c

index f164801..fb5a5a9 100644 (file)
@@ -395,6 +395,7 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
 {
        struct multipath * cmpp;
        struct multipath * cmpp_by_name;
+       char * mpp_feat, * cmpp_feat;
 
        cmpp = find_mp_by_wwid(curmp, mpp->wwid);
        cmpp_by_name = find_mp_by_alias(curmp, mpp->alias);
@@ -455,11 +456,11 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
                        mpp->alias);
                return;
        }
-       if (!mpp->no_path_retry &&
-           (strlen(cmpp->features) != strlen(mpp->features) ||
-            strcmp(cmpp->features, mpp->features))) {
+
+       if (mpp->no_path_retry != NO_PATH_RETRY_UNDEF &&
+           mpp->no_path_retry != cmpp->no_path_retry) {
                mpp->action =  ACT_RELOAD;
-               condlog(3, "%s: set ACT_RELOAD (features change)",
+               condlog(3, "%s: set ACT_RELOAD (no_path_retry change)",
                        mpp->alias);
                return;
        }
@@ -472,6 +473,31 @@ select_action (struct multipath * mpp, vector curmp, int force_reload)
                        mpp->alias);
                return;
        }
+
+       if (mpp->retain_hwhandler != RETAIN_HWHANDLER_UNDEF &&
+           mpp->retain_hwhandler != cmpp->retain_hwhandler) {
+               mpp->action = ACT_RELOAD;
+               condlog(3, "%s: set ACT_RELOAD (retain_hwhandler change)",
+                       mpp->alias);
+               return;
+       }
+
+       cmpp_feat = STRDUP(cmpp->features);
+       mpp_feat = STRDUP(mpp->features);
+       if (cmpp_feat && mpp_feat) {
+               remove_feature(&mpp_feat, "queue_if_no_path");
+               remove_feature(&mpp_feat, "retain_attached_hw_handler");
+               remove_feature(&cmpp_feat, "queue_if_no_path");
+               remove_feature(&cmpp_feat, "retain_attached_hw_handler");
+               if (strncmp(mpp_feat, cmpp_feat, PARAMS_SIZE)) {
+                       mpp->action =  ACT_RELOAD;
+                       condlog(3, "%s: set ACT_RELOAD (features change)",
+                               mpp->alias);
+               }
+       }
+       FREE(cmpp_feat);
+       FREE(mpp_feat);
+
        if (!cmpp->selector || strncmp(cmpp->selector, mpp->selector,
                    strlen(mpp->selector))) {
                mpp->action = ACT_RELOAD;