device-mapper-multipath/bindings_file.patch
Benjamin Marzinski c7ea1a3b8d Updated to latest upstream 0.4.9 code : multipath-tools-090729.tgz (git
commit id: d678c139719d5631194b50e49f16ca97162ecd0f) moved multipath
    bindings file from /var/lib/multipath to /etc/multipath Fixed 354961,
    432520
2009-07-29 22:54:07 +00:00

173 lines
5.7 KiB
Diff

Add the ability to change the location of the user_friendly_names
binding file.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/config.c | 11 ++++++++---
libmultipath/dict.c | 24 ++++++++++++++++++++++++
multipath.conf.annotated | 9 +++++++++
multipath.conf.defaults | 1 +
multipath/main.c | 4 +++-
multipath/multipath.conf.5 | 8 ++++++--
6 files changed, 51 insertions(+), 6 deletions(-)
Index: multipath-tools-090513/libmultipath/config.c
===================================================================
--- multipath-tools-090513.orig/libmultipath/config.c
+++ multipath-tools-090513/libmultipath/config.c
@@ -405,6 +405,9 @@ free_config (struct config * conf)
if (conf->checker_name)
FREE(conf->checker_name);
+ if (conf->bindings_file)
+ FREE(conf->bindings_file);
+
free_blacklist(conf->blist_devnode);
free_blacklist(conf->blist_wwid);
free_blacklist_device(conf->blist_device);
@@ -437,7 +440,6 @@ load_config (char * file)
conf->dev_type = DEV_NONE;
conf->minio = 1000;
conf->max_fds = 0;
- conf->bindings_file = DEFAULT_BINDINGS_FILE;
conf->multipath_dir = set_default(DEFAULT_MULTIPATHDIR);
conf->flush_on_last_del = 0;
conf->attribute_flags = 0;
@@ -535,9 +537,12 @@ load_config (char * file)
if (conf->hwhandler == NULL)
conf->hwhandler = set_default(DEFAULT_HWHANDLER);
+ if (conf->bindings_file == NULL)
+ conf->bindings_file = set_default(DEFAULT_BINDINGS_FILE);
+
if (!conf->selector || !conf->udev_dir || !conf->multipath_dir ||
- !conf->getuid || !conf->features ||
- !conf->hwhandler)
+ !conf->getuid || !conf->features || !conf->hwhandler ||
+ !conf->bindings_file)
goto out;
if (!conf->prio_name)
Index: multipath-tools-090513/libmultipath/dict.c
===================================================================
--- multipath-tools-090513.orig/libmultipath/dict.c
+++ multipath-tools-090513/libmultipath/dict.c
@@ -423,6 +423,17 @@ names_handler(vector strvec)
return 0;
}
+static int
+def_bindings_file_handler(vector strvec)
+{
+ conf->bindings_file = set_value(strvec);
+
+ if (!conf->bindings_file)
+ return 1;
+
+ return 0;
+}
+
/*
* blacklist block handlers
*/
@@ -1920,6 +1931,18 @@ snprint_def_user_friendly_names (char *
}
static int
+snprint_def_bindings_file(char * buff, int len, void * data)
+{
+ if (conf->bindings_file == NULL)
+ return 0;
+ if (strlen(conf->bindings_file) == strlen(DEFAULT_BINDINGS_FILE) &&
+ !strcmp(conf->bindings_file, DEFAULT_BINDINGS_FILE))
+ return 0;
+
+ return snprintf(buff, len, "%s", conf->bindings_file);
+}
+
+static int
snprint_ble_simple (char * buff, int len, void * data)
{
struct blentry * ble = (struct blentry *)data;
@@ -1969,6 +1992,7 @@ init_keywords(void)
install_keyword("pg_timeout", &def_pg_timeout_handler, &snprint_def_pg_timeout);
install_keyword("flush_on_last_del", &def_flush_on_last_del_handler, &snprint_def_flush_on_last_del);
install_keyword("user_friendly_names", &names_handler, &snprint_def_user_friendly_names);
+ install_keyword("bindings_file", &def_bindings_file_handler, &snprint_def_bindings_file);
install_keyword("mode", &def_mode_handler, &snprint_def_mode);
install_keyword("uid", &def_uid_handler, &snprint_def_uid);
install_keyword("gid", &def_gid_handler, &snprint_def_gid);
Index: multipath-tools-090513/multipath.conf.annotated
===================================================================
--- multipath-tools-090513.orig/multipath.conf.annotated
+++ multipath-tools-090513/multipath.conf.annotated
@@ -198,6 +198,15 @@
# # default : determined by the process
# gid disk
#
+# #
+# # name : bindings_file
+# # scope : multipath
+# # desc : The location of the bindings file that is used with
+# the user_friendly_names option
+# # values : <full_pathname>
+# # default : "/var/lib/multipath/bindings"
+# bindings_file "/etc/multipath_bindings"
+#
#}
#
##
Index: multipath-tools-090513/multipath.conf.defaults
===================================================================
--- multipath-tools-090513.orig/multipath.conf.defaults
+++ multipath-tools-090513/multipath.conf.defaults
@@ -14,6 +14,7 @@
# failback manual
# no_path_retry fail
# user_friendly_names no
+# bindings_file "/var/lib/multipath/bindings"
#}
#
#blacklist {
Index: multipath-tools-090513/multipath/main.c
===================================================================
--- multipath-tools-090513.orig/multipath/main.c
+++ multipath-tools-090513/multipath/main.c
@@ -362,7 +362,9 @@ main (int argc, char *argv[])
conf->verbosity = atoi(optarg);
break;
case 'b':
- conf->bindings_file = optarg;
+ if (conf->bindings_file)
+ FREE(conf->bindings_file);
+ conf->bindings_file = STRDUP(optarg);
break;
case 'd':
conf->dry_run = 1;
Index: multipath-tools-090513/multipath/multipath.conf.5
===================================================================
--- multipath-tools-090513.orig/multipath/multipath.conf.5
+++ multipath-tools-090513/multipath/multipath.conf.5
@@ -221,8 +221,7 @@ for never stop queueing. Default is 0.
.B user_friendly_names
If set to
.I yes
-, using the bindings file
-.I /var/lib/multipath/bindings
+, using the bindings file (by default \fI/var/lib/multipath/bindings\fR)
to assign a persistent and unique alias to the multipath, in the form of mpath<n>.
If set to
.I no
@@ -231,6 +230,11 @@ be overriden by any specific aliases in
Default is
.I no
.TP
+.B bindings_file
+Specify the location of the bindings file used by the user_friendly_names
+option. Default is
+.I /var/lib/multipath/bindings
+.TP
.B max_fds
Specify the maximum number of file descriptors that can be opened by multipath
and multipathd. This is equivalent to ulimit -n. A value of \fImax\fR will set