Bug 1979470
| Summary: | find_multipaths_timeout is overwritten by mpatchconf command | |||
|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Renaud Métrich <rmetrich> | |
| Component: | device-mapper-multipath | Assignee: | Ben Marzinski <bmarzins> | |
| Status: | CLOSED ERRATA | QA Contact: | Lin Li <lilin> | |
| Severity: | low | Docs Contact: | ||
| Priority: | low | |||
| Version: | 8.4 | CC: | agk, bmarzins, heinzm, lilin, msnitzer, nyewale, prajnoha, zkabelac | |
| Target Milestone: | rc | Keywords: | Triaged | |
| Target Release: | --- | Flags: | pm-rhel:
mirror+
|
|
| Hardware: | All | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | device-mapper-multipath-0.8.4-14.el8 | Doc Type: | Bug Fix | |
| Doc Text: |
Cause: mpathconf wasn't correctly checking that there was one or more spaces between paramter names and their values, leading it to treat the find_multipaths_timeout parameter the same as find_multipaths parameter
Consequence: If find_multipaths_timeout was set, and mpathconf was used to modify find_multipaths, it would convert the find_multipaths_timeout line into an invalid line.
Fix: When mpathconf checks the existing multipath.conf file for parameters, it requires there to be one or more spaces between the parameter name and value
Result: mpathconf no longer converts find_multipaths_timeout lines into invalid lines when updating the find_multipaths parameter.
|
Story Points: | --- | |
| Clone Of: | ||||
| : | 1981594 (view as bug list) | Environment: | ||
| Last Closed: | 2021-11-09 19:32:00 UTC | Type: | Bug | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1981594 | |||
Hi,
Following patch looks to be fixing the issue :
# cat mpathconf.patch
--- /root/mpathconf.original 2021-07-06 18:40:15.514540136 +0530
+++ /usr/sbin/mpathconf 2021-07-06 18:44:36.757131720 +0530
@@ -331,7 +331,7 @@
fi
if [ "$HAVE_DEFAULTS" = "1" ]; then
- HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
+ HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]]\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
if [ "$HAVE_FIND" = "1" ]; then
HAVE_FIND="yes"
elif [ "$HAVE_FIND" = "0" ]; then
@@ -467,7 +467,7 @@
' $TMPFILE
CHANGED_CONFIG=1
elif [ "$FIND" != "$HAVE_FIND" ]; then
- sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]]*[^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]][^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
CHANGED_CONFIG=1
fi
fi
[root@test1 tmp]#
Thank you,
Nitin Yewale
Hi,
Tested following scenarios
[root@test1 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths no
find_multipaths_timeout 10
enable_foreign "^$"
}
After change :mpathconf --enable --with_multipathd y --find_multipaths strict
[root@test1 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths strict
find_multipaths_timeout 10
enable_foreign "^$"
}
[root@test1 ~]#
=========================================================================================
[root@test1 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths_timeout 10
enable_foreign "^$"
}
After change : mpathconf --enable --with_multipathd y --find_multipaths yes
[root@test1 ~]# cat /etc/multipath.conf
defaults {
find_multipaths yes
user_friendly_names yes
find_multipaths_timeout 10
enable_foreign "^$"
}
[root@test1 ~]#
=========================================================================================
[root@test1 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths yes
find_multipaths_timeout 10
enable_foreign "^$"
}
After change : mpathconf --enable --with_multipathd y --find_multipaths strict
[root@test1 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths strict
find_multipaths_timeout 10
enable_foreign "^$"
}
[root@test1 ~]#
=========================================================================================
[root@test1 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
enable_foreign "^$"
}
After change : mpathconf --enable --with_multipathd y --find_multipaths strict
[root@test1 ~]# cat /etc/multipath.conf
defaults {
find_multipaths strict
user_friendly_names yes
enable_foreign "^$"
}
[root@test1 ~]#
Thank you,
Nitin Yewale
Thanks for pointing this out. However, mpathconf should be able to handle lines like
find_multipaths yes
where there are multiple spaces, so I plan to go with this instead:
# git diff
diff --git a/multipath/mpathconf b/multipath/mpathconf
index 2f4f3eaf..58077077 100644
--- a/multipath/mpathconf
+++ b/multipath/mpathconf
@@ -331,7 +331,7 @@ if [ "$HAVE_BLACKLIST" = "1" ]; then
fi
if [ "$HAVE_DEFAULTS" = "1" ]; then
- HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
+ HAVE_FIND=`sed -n '/^defaults[[:space:]]*{/,/^}/ p' $TMPFILE | sed -n 's/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*\([^[:blank:]]*\).*$/\1/p' | sed -n 1p`
if [ "$HAVE_FIND" = "1" ]; then
HAVE_FIND="yes"
elif [ "$HAVE_FIND" = "0" ]; then
@@ -467,7 +467,7 @@ if [ -n "$FIND" ]; then
' $TMPFILE
CHANGED_CONFIG=1
elif [ "$FIND" != "$HAVE_FIND" ]; then
- sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]]*[^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
+ sed -i '/^defaults[[:space:]]*{/,/^}/ s/^[[:blank:]]*find_multipaths[[:blank:]][[:blank:]]*[^[:blank:]]*/ find_multipaths '"$FIND"'/' $TMPFILE
CHANGED_CONFIG=1
fi
fi
Actually what would be even greater is to have mpathconf command handle this "find_multipaths_timeout" property. The idea of mpathconf is to give the users the ability to change a few, commonly changed parameters. They are currently all ones where Red Hat has (or had) different defaults than upstream. I've considered giving mpathconf the ability to add any parameter to any section of multipath.conf, and you're welcome to file an RFE for that, but I'd like to just use this bugzilla to deal with the actual bug (and related space issues for the other parameters). There were actually multiple places where mpathconf wasn't checking that existing parameters had one or more spaces between the parameter name and value. These have all been fixed. Reproduced on device-mapper-multipath-0.8.4-13.el8
1,[root@ibm-p9z-20-lp13 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.4-13.el8.ppc64le
device-mapper-multipath-0.8.4-13.el8.ppc64le
2,Edit /etc/multipath.conf
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths yes
find_multipaths_timeout 10
enable_foreign "^$"
}
3,[root@ibm-p9z-20-lp13 ~]# mpathconf --enable --with_multipathd y --find_multipaths strict
4,check /etc/multipath.conf
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths strict
find_multipaths strict 10 <----------------------find_multipaths_timeout is overwritten
enable_foreign "^$"
}
Verified on device-mapper-multipath-0.8.4-14.el8
1,[root@ibm-p9z-20-lp13 ~]# rpm -qa | grep multipath
device-mapper-multipath-libs-0.8.4-14.el8.ppc64le
device-mapper-multipath-0.8.4-14.el8.ppc64le
2,Edit /etc/multipath.conf
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths yes
find_multipaths_timeout 10
enable_foreign "^$"
}
3,[root@ibm-p9z-20-lp13 ~]# mpathconf --enable --with_multipathd y --find_multipaths strict
4,check /etc/multipath.conf
[root@ibm-p9z-20-lp13 ~]# cat /etc/multipath.conf
defaults {
user_friendly_names yes
find_multipaths strict
find_multipaths_timeout 10 <----------------------find_multipaths_timeout is not overwritten
enable_foreign "^$"
}
Test result:When mpathconf checks the existing multipath.conf file for parameters, it requires there to be one or more spaces between the parameter name and value
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (device-mapper-multipath bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2021:4367 |
Description of problem: When specifying find_multipaths_timeout in /etc/multipath.conf and executing mpatchconf --enable to change the find_multipaths mode, the find_multipaths_timeout property is overwritten, as shown below: Original /etc/multipath.conf: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- defaults { user_friendly_names yes find_multipaths yes find_multipaths_timeout 10 enable_foreign "^$" } [...] -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Execute mpathconf: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- # mpathconf --enable --with_multipathd y --find_multipaths strict -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Final result: -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- defaults { user_friendly_names yes find_multipaths strict find_multipaths strict 10 enable_foreign "^$" } [...] -------- 8< ---------------- 8< ---------------- 8< ---------------- 8< -------- Version-Release number of selected component (if applicable): device-mapper-multipath-0.8.4-10.el8.x86_64 How reproducible: Always, see above.