|
|
1eb31d |
---
|
|
|
1eb31d |
libmultipath/config.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
|
1eb31d |
libmultipath/config.h | 1
|
|
|
1eb31d |
libmultipath/dict.c | 38 +++++++++++++++++++++++++++++
|
|
|
1eb31d |
3 files changed, 102 insertions(+), 1 deletion(-)
|
|
|
1eb31d |
|
|
|
1eb31d |
Index: multipath-tools-130222/libmultipath/config.c
|
|
|
1eb31d |
===================================================================
|
|
|
1eb31d |
--- multipath-tools-130222.orig/libmultipath/config.c
|
|
|
1eb31d |
+++ multipath-tools-130222/libmultipath/config.c
|
|
|
1eb31d |
@@ -113,6 +113,8 @@ find_hwe (vector hwtable, char * vendor,
|
|
|
1eb31d |
* continuing to the generic entries
|
|
|
1eb31d |
*/
|
|
|
1eb31d |
vector_foreach_slot_backwards (hwtable, tmp, i) {
|
|
|
1eb31d |
+ if (tmp->all_devs == 1)
|
|
|
1eb31d |
+ continue;
|
|
|
1eb31d |
if (hwe_regmatch(tmp, &hwe))
|
|
|
1eb31d |
continue;
|
|
|
1eb31d |
ret = tmp;
|
|
|
1eb31d |
@@ -348,6 +350,62 @@ merge_hwe (struct hwentry * dst, struct
|
|
|
1eb31d |
return 0;
|
|
|
1eb31d |
}
|
|
|
1eb31d |
|
|
|
1eb31d |
+#define overwrite_str(s) \
|
|
|
1eb31d |
+do { \
|
|
|
1eb31d |
+ if (src->s) { \
|
|
|
1eb31d |
+ if (dst->s) \
|
|
|
1eb31d |
+ FREE(dst->s); \
|
|
|
1eb31d |
+ if (!(dst->s = set_param_str(src->s))) \
|
|
|
1eb31d |
+ return 1; \
|
|
|
1eb31d |
+ } \
|
|
|
1eb31d |
+} while(0)
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+#define overwrite_num(s) \
|
|
|
1eb31d |
+do { \
|
|
|
1eb31d |
+ if (src->s) \
|
|
|
1eb31d |
+ dst->s = src->s; \
|
|
|
1eb31d |
+} while(0)
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+static int
|
|
|
1eb31d |
+overwrite_hwe (struct hwentry * dst, struct hwentry * src)
|
|
|
1eb31d |
+{
|
|
|
1eb31d |
+ overwrite_str(vendor);
|
|
|
1eb31d |
+ overwrite_str(product);
|
|
|
1eb31d |
+ overwrite_str(revision);
|
|
|
1eb31d |
+ overwrite_str(uid_attribute);
|
|
|
1eb31d |
+ overwrite_str(features);
|
|
|
1eb31d |
+ overwrite_str(hwhandler);
|
|
|
1eb31d |
+ overwrite_str(selector);
|
|
|
1eb31d |
+ overwrite_str(checker_name);
|
|
|
1eb31d |
+ overwrite_str(prio_name);
|
|
|
1eb31d |
+ overwrite_str(prio_args);
|
|
|
1eb31d |
+ overwrite_str(alias_prefix);
|
|
|
1eb31d |
+ overwrite_str(bl_product);
|
|
|
1eb31d |
+ overwrite_num(pgpolicy);
|
|
|
1eb31d |
+ overwrite_num(pgfailback);
|
|
|
1eb31d |
+ overwrite_num(rr_weight);
|
|
|
1eb31d |
+ overwrite_num(no_path_retry);
|
|
|
1eb31d |
+ overwrite_num(minio);
|
|
|
1eb31d |
+ overwrite_num(minio_rq);
|
|
|
1eb31d |
+ overwrite_num(pg_timeout);
|
|
|
1eb31d |
+ overwrite_num(flush_on_last_del);
|
|
|
1eb31d |
+ overwrite_num(fast_io_fail);
|
|
|
1eb31d |
+ overwrite_num(dev_loss);
|
|
|
1eb31d |
+ overwrite_num(user_friendly_names);
|
|
|
1eb31d |
+ overwrite_num(retain_hwhandler);
|
|
|
1eb31d |
+ overwrite_num(detect_prio);
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+ /*
|
|
|
1eb31d |
+ * Make sure features is consistent with
|
|
|
1eb31d |
+ * no_path_retry
|
|
|
1eb31d |
+ */
|
|
|
1eb31d |
+ if (dst->no_path_retry == NO_PATH_RETRY_FAIL)
|
|
|
1eb31d |
+ remove_feature(&dst->features, "queue_if_no_path");
|
|
|
1eb31d |
+ else if (dst->no_path_retry != NO_PATH_RETRY_UNDEF)
|
|
|
1eb31d |
+ add_feature(&dst->features, "queue_if_no_path");
|
|
|
1eb31d |
+ return 0;
|
|
|
1eb31d |
+}
|
|
|
1eb31d |
+
|
|
|
1eb31d |
int
|
|
|
1eb31d |
store_hwe (vector hwtable, struct hwentry * dhwe)
|
|
|
1eb31d |
{
|
|
|
1eb31d |
@@ -431,7 +489,11 @@ restart:
|
|
|
1eb31d |
break;
|
|
|
1eb31d |
j = n;
|
|
|
1eb31d |
vector_foreach_slot_after(hw, hwe2, j) {
|
|
|
1eb31d |
- if (conf->hw_strmatch) {
|
|
|
1eb31d |
+ if (hwe2->all_devs == 1) {
|
|
|
1eb31d |
+ overwrite_hwe(hwe1, hwe2);
|
|
|
1eb31d |
+ continue;
|
|
|
1eb31d |
+ }
|
|
|
1eb31d |
+ else if (conf->hw_strmatch) {
|
|
|
1eb31d |
if (hwe_strmatch(hwe2, hwe1))
|
|
|
1eb31d |
continue;
|
|
|
1eb31d |
}
|
|
|
1eb31d |
Index: multipath-tools-130222/libmultipath/config.h
|
|
|
1eb31d |
===================================================================
|
|
|
1eb31d |
--- multipath-tools-130222.orig/libmultipath/config.h
|
|
|
1eb31d |
+++ multipath-tools-130222/libmultipath/config.h
|
|
|
1eb31d |
@@ -47,6 +47,7 @@ struct hwentry {
|
|
|
1eb31d |
char * prio_args;
|
|
|
1eb31d |
char * alias_prefix;
|
|
|
1eb31d |
|
|
|
1eb31d |
+ int all_devs;
|
|
|
1eb31d |
int pgpolicy;
|
|
|
1eb31d |
int pgfailback;
|
|
|
1eb31d |
int rr_weight;
|
|
|
1eb31d |
Index: multipath-tools-130222/libmultipath/dict.c
|
|
|
1eb31d |
===================================================================
|
|
|
1eb31d |
--- multipath-tools-130222.orig/libmultipath/dict.c
|
|
|
1eb31d |
+++ multipath-tools-130222/libmultipath/dict.c
|
|
|
1eb31d |
@@ -918,6 +918,32 @@ device_handler(vector strvec)
|
|
|
1eb31d |
}
|
|
|
1eb31d |
|
|
|
1eb31d |
static int
|
|
|
1eb31d |
+all_devs_handler(vector strvec)
|
|
|
1eb31d |
+{
|
|
|
1eb31d |
+ char * buff;
|
|
|
1eb31d |
+ struct hwentry *hwe = VECTOR_LAST_SLOT(conf->hwtable);
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+ if (!hwe)
|
|
|
1eb31d |
+ return 1;
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+ buff = set_value(strvec);
|
|
|
1eb31d |
+ if (!buff)
|
|
|
1eb31d |
+ return 1;
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+ if ((strlen(buff) == 2 && !strcmp(buff, "no")) ||
|
|
|
1eb31d |
+ (strlen(buff) == 1 && !strcmp(buff, "0")))
|
|
|
1eb31d |
+ hwe->all_devs = 0;
|
|
|
1eb31d |
+ else if ((strlen(buff) == 3 && !strcmp(buff, "yes")) ||
|
|
|
1eb31d |
+ (strlen(buff) == 1 && !strcmp(buff, "1")))
|
|
|
1eb31d |
+ hwe->all_devs = 1;
|
|
|
1eb31d |
+ else
|
|
|
1eb31d |
+ hwe->all_devs = 0;
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+ FREE(buff);
|
|
|
1eb31d |
+ return 0;
|
|
|
1eb31d |
+}
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+static int
|
|
|
1eb31d |
vendor_handler(vector strvec)
|
|
|
1eb31d |
{
|
|
|
1eb31d |
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
|
|
|
1eb31d |
@@ -2182,6 +2208,17 @@ snprint_hw_dev_loss(char * buff, int len
|
|
|
1eb31d |
}
|
|
|
1eb31d |
|
|
|
1eb31d |
static int
|
|
|
1eb31d |
+snprint_hw_all_devs (char *buff, int len, void *data)
|
|
|
1eb31d |
+{
|
|
|
1eb31d |
+ struct hwentry * hwe = (struct hwentry *)data;
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+ if (!hwe->all_devs)
|
|
|
1eb31d |
+ return 0;
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+ return snprintf(buff, len, "yes");
|
|
|
1eb31d |
+}
|
|
|
1eb31d |
+
|
|
|
1eb31d |
+static int
|
|
|
1eb31d |
snprint_hw_vendor (char * buff, int len, void * data)
|
|
|
1eb31d |
{
|
|
|
1eb31d |
struct hwentry * hwe = (struct hwentry *)data;
|
|
|
1eb31d |
@@ -2968,6 +3005,7 @@ init_keywords(void)
|
|
|
1eb31d |
install_keyword_root("devices", &devices_handler);
|
|
|
1eb31d |
install_keyword_multi("device", &device_handler, NULL);
|
|
|
1eb31d |
install_sublevel();
|
|
|
1eb31d |
+ install_keyword("all_devs", &all_devs_handler, &snprint_hw_all_devs);
|
|
|
1eb31d |
install_keyword("vendor", &vendor_handler, &snprint_hw_vendor);
|
|
|
1eb31d |
install_keyword("product", &product_handler, &snprint_hw_product);
|
|
|
1eb31d |
install_keyword("revision", &revision_handler, &snprint_hw_revision);
|