device-mapper-multipath-0.4.9-64

Modify 0076-RHBZ-1056686-add-hw_str_match.patch
  * free temporary memory used during configuration
Add 0078-RHBZ-1054044-fix-mpathconf-manpage.patch
  * fix typo
Add 0079-RHBZ-1070581-add-wwid-option.patch
  * add multipath option "-a". To add a device's wwid to the wwids file
Add 0080-RHBZ-1075796-cmdline-wwid.patch
  * add multipath option "-A" to add wwids specified by the kernel
    command line mapth.wwid options.
This commit is contained in:
Benjamin Marzinski 2014-03-31 12:03:31 -05:00
parent d9ed5f9739
commit 2c69b486a0
5 changed files with 318 additions and 8 deletions

View File

@ -1,8 +1,9 @@
---
libmultipath/config.c | 10 ++++++++--
libmultipath/config.h | 1 +
libmultipath/dict.c | 26 ++++++++++++++++++++++++++
3 files changed, 35 insertions(+), 2 deletions(-)
libmultipath/config.c | 10 ++++++++--
libmultipath/config.h | 1 +
libmultipath/dict.c | 28 ++++++++++++++++++++++++++++
multipath/multipath.conf.5 | 11 +++++++++++
4 files changed, 48 insertions(+), 2 deletions(-)
Index: multipath-tools-130222/libmultipath/config.c
===================================================================
@ -51,7 +52,7 @@ Index: multipath-tools-130222/libmultipath/dict.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/dict.c
+++ multipath-tools-130222/libmultipath/dict.c
@@ -693,6 +693,23 @@ def_detect_prio_handler(vector strvec)
@@ -693,6 +693,25 @@ def_detect_prio_handler(vector strvec)
return 0;
}
@ -69,13 +70,15 @@ Index: multipath-tools-130222/libmultipath/dict.c
+ conf->hw_strmatch = 1;
+ else
+ conf->hw_strmatch = 0;
+
+ FREE(buff);
+ return 0;
+}
+
/*
* blacklist block handlers
*/
@@ -2795,6 +2812,14 @@ snprint_def_detect_prio(char * buff, int
@@ -2795,6 +2814,14 @@ snprint_def_detect_prio(char * buff, int
}
static int
@ -90,7 +93,7 @@ Index: multipath-tools-130222/libmultipath/dict.c
snprint_ble_simple (char * buff, int len, void * data)
{
struct blentry * ble = (struct blentry *)data;
@@ -2861,6 +2886,7 @@ init_keywords(void)
@@ -2861,6 +2888,7 @@ init_keywords(void)
install_keyword("find_multipaths", &def_find_multipaths_handler, &snprint_def_find_multipaths);
install_keyword("retain_attached_hw_handler", &def_retain_hwhandler_handler, &snprint_def_retain_hwhandler_handler);
install_keyword("detect_prio", &def_detect_prio_handler, &snprint_def_detect_prio);
@ -98,3 +101,25 @@ Index: multipath-tools-130222/libmultipath/dict.c
__deprecated install_keyword("default_selector", &def_selector_handler, NULL);
__deprecated install_keyword("default_path_grouping_policy", &def_pgpolicy_handler, NULL);
__deprecated install_keyword("default_uid_attribute", &def_uid_attribute_handler, NULL);
Index: multipath-tools-130222/multipath/multipath.conf.5
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.conf.5
+++ multipath-tools-130222/multipath/multipath.conf.5
@@ -400,6 +400,17 @@ will automatically use the
.I alua
prioritizer. If not, the prioritizer will be selected as usual. Default is
.I no
+.TP
+.B hw_str_match
+If set to
+.I yes
+, the vendor, product, and revision parameters of user device configs will be
+string matched against the built-in device configs to determine if they should
+modify an existing config, or create a new one. If set to
+.I no
+, the user device configs will be regular expression matched against the
+built-in configs instead. Default is
+.I no
.
.SH "blacklist section"
The

View File

@ -0,0 +1,17 @@
---
multipath/mpathconf.8 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: multipath-tools-130222/multipath/mpathconf.8
===================================================================
--- multipath-tools-130222.orig/multipath/mpathconf.8
+++ multipath-tools-130222/multipath/mpathconf.8
@@ -86,7 +86,7 @@ If set to \fBy\fP, this runs
.B service multipathd start
to start the multipathd daemon on \fB--enable\fP,
.B service multipathd stop
-to start the multipathd daemon on \fB--disable\fP, and
+to stop the multipathd daemon on \fB--disable\fP, and
.B service multipathd reload
to reconfigure multipathd on \fB--user_frindly_names\fP and
\fB--find_multipaths\fP.

View File

@ -0,0 +1,93 @@
---
multipath/main.c | 19 ++++++++++++++++---
multipath/multipath.8 | 5 ++++-
2 files changed, 20 insertions(+), 4 deletions(-)
Index: multipath-tools-130222/multipath/main.c
===================================================================
--- multipath-tools-130222.orig/multipath/main.c
+++ multipath-tools-130222/multipath/main.c
@@ -85,7 +85,7 @@ usage (char * progname)
{
fprintf (stderr, VERSION_STRING);
fprintf (stderr, "Usage:\n");
- fprintf (stderr, " %s [-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
+ fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
fprintf (stderr, " %s -F [-v lvl]\n", progname);
fprintf (stderr, " %s -t\n", progname);
@@ -98,6 +98,7 @@ usage (char * progname)
" -ll show multipath topology (maximum info)\n" \
" -f flush a multipath device map\n" \
" -F flush all multipath device maps\n" \
+ " -a add a device wwid to the wwids file\n" \
" -c check if a device should be a path in a multipath device\n" \
" -T tm:val\n" \
" check if tm matches the multipathd timestamp. If so val is\n" \
@@ -292,6 +293,15 @@ configure (void)
}
goto out;
}
+ if (conf->dry_run == 5) {
+ r = remember_wwid(refwwid);
+ if (r == 0)
+ printf("wwid '%s' added\n", refwwid);
+ else
+ printf("failed adding '%s' to wwids file\n",
+ refwwid);
+ goto out;
+ }
condlog(3, "scope limited to %s", refwwid);
if (conf->dry_run == 2) {
if (check_wwids_file(refwwid, 0) == 0){
@@ -428,7 +438,7 @@ main (int argc, char *argv[])
int r = 1;
long int timestamp = -1;
int valid = -1;
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
switch(arg) {
case 'T':
if (optarg[0] == ':')
@@ -464,7 +474,7 @@ main (int argc, char *argv[])
if (dm_prereq())
exit(1);
- while ((arg = getopt(argc, argv, ":dchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
switch(arg) {
case 1: printf("optarg : %s\n",optarg);
break;
@@ -537,6 +547,9 @@ main (int argc, char *argv[])
case 'W':
conf->dry_run = 4;
break;
+ case 'a':
+ conf->dry_run = 5;
+ break;
case ':':
fprintf(stderr, "Missing option argument\n");
usage(argv[0]);
Index: multipath-tools-130222/multipath/multipath.8
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.8
+++ multipath-tools-130222/multipath/multipath.8
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
.RB [\| \-b\ \c
.IR bindings_file \|]
.RB [\| \-d \|]
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-w | \-W \|]
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|]
.RB [\| \-p\ \c
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
.RB [\| device \|]
@@ -68,6 +68,9 @@ check if a block device should be a path
.B \-q
allow device tables with queue_if_no_path when multipathd is not running
.TP
+.B \-a
+add the wwid for the specified device to the wwids file
+.TP
.B \-w
remove the wwid for the specified device from the wwids file
.TP

View File

@ -0,0 +1,157 @@
---
libmultipath/wwids.c | 44 ++++++++++++++++++++++++++++++++++++++++++
libmultipath/wwids.h | 1
multipath/main.c | 12 ++++++++---
multipath/multipath.8 | 5 +++-
multipathd/multipathd.service | 1
5 files changed, 59 insertions(+), 4 deletions(-)
Index: multipath-tools-130222/libmultipath/wwids.c
===================================================================
--- multipath-tools-130222.orig/libmultipath/wwids.c
+++ multipath-tools-130222/libmultipath/wwids.c
@@ -305,3 +305,47 @@ remember_wwid(char *wwid)
condlog(4, "wwid %s already in wwids file", wwid);
return 0;
}
+
+int remember_cmdline_wwid(void)
+{
+ FILE *f = NULL;
+ char buf[LINE_MAX], *next, *ptr;
+ int ret = 0;
+
+ f = fopen("/proc/cmdline", "re");
+ if (!f) {
+ condlog(0, "can't open /proc/cmdline : %s", strerror(errno));
+ return -1;
+ }
+
+ if (!fgets(buf, sizeof(buf), f)) {
+ if (ferror(f))
+ condlog(0, "read of /proc/cmdline failed : %s",
+ strerror(errno));
+ else
+ condlog(0, "couldn't read /proc/cmdline");
+ fclose(f);
+ return -1;
+ }
+ fclose(f);
+ next = buf;
+ while((ptr = strstr(next, "mpath.wwid="))) {
+ ptr += 11;
+ next = strpbrk(ptr, " \t\n");
+ if (next) {
+ *next = '\0';
+ next++;
+ }
+ if (strlen(ptr)) {
+ if (remember_wwid(ptr) != 0)
+ ret = -1;
+ }
+ else {
+ condlog(0, "empty mpath.wwid kernel command line option");
+ ret = -1;
+ }
+ if (!next)
+ break;
+ }
+ return ret;
+}
Index: multipath-tools-130222/libmultipath/wwids.h
===================================================================
--- multipath-tools-130222.orig/libmultipath/wwids.h
+++ multipath-tools-130222/libmultipath/wwids.h
@@ -17,5 +17,6 @@ int remember_wwid(char *wwid);
int check_wwids_file(char *wwid, int write_wwid);
int remove_wwid(char *wwid);
int replace_wwids(vector mp);
+int remember_cmdline_wwid(void);
#endif /* _WWIDS_H */
Index: multipath-tools-130222/multipath/main.c
===================================================================
--- multipath-tools-130222.orig/multipath/main.c
+++ multipath-tools-130222/multipath/main.c
@@ -85,7 +85,7 @@ usage (char * progname)
{
fprintf (stderr, VERSION_STRING);
fprintf (stderr, "Usage:\n");
- fprintf (stderr, " %s [-a|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
+ fprintf (stderr, " %s [-a|-A|-c|-w|-W] [-d] [-T tm:val] [-r] [-v lvl] [-p pol] [-b fil] [-q] [dev]\n", progname);
fprintf (stderr, " %s -l|-ll|-f [-v lvl] [-b fil] [dev]\n", progname);
fprintf (stderr, " %s -F [-v lvl]\n", progname);
fprintf (stderr, " %s -t\n", progname);
@@ -99,6 +99,8 @@ usage (char * progname)
" -f flush a multipath device map\n" \
" -F flush all multipath device maps\n" \
" -a add a device wwid to the wwids file\n" \
+ " -A add devices from kernel command line mpath.wwids\n"
+ " parameters to wwids file\n" \
" -c check if a device should be a path in a multipath device\n" \
" -T tm:val\n" \
" check if tm matches the multipathd timestamp. If so val is\n" \
@@ -438,7 +440,7 @@ main (int argc, char *argv[])
int r = 1;
long int timestamp = -1;
int valid = -1;
- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
switch(arg) {
case 'T':
if (optarg[0] == ':')
@@ -474,7 +476,7 @@ main (int argc, char *argv[])
if (dm_prereq())
exit(1);
- while ((arg = getopt(argc, argv, ":adchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
+ while ((arg = getopt(argc, argv, ":aAdchl::FfM:v:p:b:BrtT:qwW")) != EOF ) {
switch(arg) {
case 1: printf("optarg : %s\n",optarg);
break;
@@ -538,6 +540,10 @@ main (int argc, char *argv[])
goto out;
case 'T':
break;
+ case 'A':
+ if (remember_cmdline_wwid() != 0)
+ exit(1);
+ exit(0);
case 'h':
usage(argv[0]);
exit(0);
Index: multipath-tools-130222/multipathd/multipathd.service
===================================================================
--- multipath-tools-130222.orig/multipathd/multipathd.service
+++ multipath-tools-130222/multipathd/multipathd.service
@@ -11,6 +11,7 @@ Conflicts=shutdown.target
Type=forking
PIDFile=/var/run/multipathd/multipathd.pid
ExecStartPre=/sbin/modprobe dm-multipath
+ExecStartPre=-/sbin/multipath -A
ExecStart=/sbin/multipathd
ExecReload=/sbin/multipathd reconfigure
#ExecStop=/path/to/scrip delete-me if not necessary
Index: multipath-tools-130222/multipath/multipath.8
===================================================================
--- multipath-tools-130222.orig/multipath/multipath.8
+++ multipath-tools-130222/multipath/multipath.8
@@ -8,7 +8,7 @@ multipath \- Device mapper target autoco
.RB [\| \-b\ \c
.IR bindings_file \|]
.RB [\| \-d \|]
-.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-w | \-W \|]
+.RB [\| \-h | \-l | \-ll | \-f | \-t | \-F | \-B | \-c | \-q | \|-r | \-a | \-A | \-w | \-W \|]
.RB [\| \-p\ \c
.BR failover | multibus | group_by_serial | group_by_prio | group_by_node_name \|]
.RB [\| device \|]
@@ -71,6 +71,9 @@ allow device tables with queue_if_no_pat
.B \-a
add the wwid for the specified device to the wwids file
.TP
+.B \-A
+add wwids from any kernel command line mpath.wwid parameters to the wwids file
+.TP
.B \-w
remove the wwid for the specified device from the wwids file
.TP

View File

@ -1,7 +1,7 @@
Summary: Tools to manage multipath devices using device-mapper
Name: device-mapper-multipath
Version: 0.4.9
Release: 63%{?dist}
Release: 64%{?dist}
License: GPL+
Group: System Environment/Base
URL: http://christophe.varoqui.free.fr/
@ -84,6 +84,10 @@ Patch0073: 0073-RH-update-build-flags.patch
Patch0074: 0074-RHBZ-1056976-dm-mpath-rules.patch
Patch0075: 0075-RHBZ-1056976-reload-flag.patch
Patch0076: 0076-RHBZ-1056686-add-hw_str_match.patch
#Patch0077:
Patch0078: 0078-RHBZ-1054044-fix-mpathconf-manpage.patch
Patch0079: 0079-RHBZ-1070581-add-wwid-option.patch
Patch0080: 0080-RHBZ-1075796-cmdline-wwid.patch
# runtime
Requires: %{name}-libs = %{version}-%{release}
@ -212,6 +216,9 @@ kpartx manages partition creation and removal for device-mapper devices.
%patch0074 -p1
%patch0075 -p1
%patch0076 -p1
%patch0078 -p1
%patch0079 -p1
%patch0080 -p1
cp %{SOURCE1} .
%build
@ -306,6 +313,17 @@ bin/systemctl --no-reload enable multipathd.service >/dev/null 2>&1 ||:
%{_mandir}/man8/kpartx.8.gz
%changelog
* Mon Mar 31 2014 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-64
- Modify 0076-RHBZ-1056686-add-hw_str_match.patch
* free temporary memory used during configuration
- Add 0078-RHBZ-1054044-fix-mpathconf-manpage.patch
* fix typo
- Add 0079-RHBZ-1070581-add-wwid-option.patch
* add multipath option "-a". To add a device's wwid to the wwids file
- Add 0080-RHBZ-1075796-cmdline-wwid.patch
* add multipath option "-A" to add wwids specified by the kernel
command line mapth.wwid options.
* Fri Jan 24 2014 Benjamin Marzinski <bmarzins@redhat.com> 0.4.9-63
- Add 0074-RHBZ-1056976-dm-mpath-rules.patch
* Add rules to keep from doing work in udev if there are no