dracut: Verify multipath config_dir option
PATCH v2 1/1 dracut: Verify multipath config_dir option
The 90multipath/module-setup.sh file currently does not check the dm-multipath config_dir option. This option in multipath.conf file is used to specify a custom directory/path that contains the multipath configuration files. It's default value is /etc/multipath/conf.d
Currently install function of module-setup.sh has hardcoded the above path, but users could change it with config_dir option. So, adding steps to read the path specified with config_dir option and add these configuration files to the initial ram disk image.
---
changes v2:
- Removed awk/sed usage to get config_dir path
- Added a check to verify if path specifed with
config_dir is actual directory
modules.d/90multipath/module-setup.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
modules.d/90multipath/module-setup.sh +15 -1
@@ -79,6 +79,20 @@ install() { } } + # Include multipath configuration files from path specified with config_dir + while read _k _v; do + if [[ "$_k" = config_dir ]]; then + _v=${_v#\"} + config_dir=${_v%\"} + fi + done < <(/sbin/multipath -t) + + if [ -d "$config_dir" ]; then + config_dir+="/*" + else + echo "multipath.conf: config_dir - No such directory $config_dir" + fi + inst_multiple -o \ dmsetup \ kpartx \
@@ -91,7 +105,7 @@ install() { /etc/xdrdevices.conf \ /etc/multipath.conf \ /etc/multipath/* \ - /etc/multipath/conf.d/* + $config_dir [[ $hostonly ]] && [[ $hostonly_mode = "strict" ]] && { for_each_host_dev_and_slaves_all add_hostonly_mpath_conf
Signature · 1 line
2.20.1
Patchset imported to github.
Pull request:
<https://github.com/dracutdevs/dracut/compare/master...dracut-mailing-devs:20200203113034.GA19959%40machine1>
Quoted 43 lines · Milan P. Gandhi
The
90multipath/module-setup.shfile currently does not check the dm-multipathconfig_diroption. This option in multipath.conf file is used to specify a custom directory/path that contains the multipath configuration files. It's default value is/etc/multipath/conf.dCurrently install function of
module-setup.shhas hardcoded the above path, but users could change it withconfig_diroption. So, adding steps to read the path specified withconfig_diroption and add these configuration files to the initial ram disk image.Signed-off-by Milan P. Gandhi <[email protected]>---
changes v2:
- Removed awk/sed usage to getconfig_dirpath
- Added a check to verify if path specifed with
config_diris actual directorymodules.d/90multipath/module-setup.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)modules.d/90multipath/module-setup.sh +1
-0@@ -79,6 +79,20 @@ install() { } } + # Include multipath configuration files from path specified with
config_dirmodules.d/90multipath/module-setup.sh +11
-0+ while read _k _v; do + if [[ "$_k" = config_dir ]]; then + _v=${_v#\"} + config_dir=${_v%\"} + fi + done < <(/sbin/multipath -t) + + if [ -d "$config_dir" ]; then + config_dir+="/*" + else + echo "multipath.conf: config_dir - No such directory
Quoted 1 line
$config_dir"
I believe new code should use derror or dwarning here instead of plain echo. Otherwise, it's looking good.
Martin
A message that is not in the archive (sent off-list or not yet received): 89c04b96b10322918b1fce9afda885254556f3af.camel-IBi9RG/[email protected]
Quoted 40 lines · Martin Wilck
Quoted 39 lines · Milan P. Gandhi
The
90multipath/module-setup.shfile currently does not check the dm-multipathconfig_diroption. This option in multipath.conf file is used to specify a custom directory/path that contains the multipath configuration files. It's default value is/etc/multipath/conf.dCurrently install function of
module-setup.shhas hardcoded the above path, but users could change it withconfig_diroption. So, adding steps to read the path specified withconfig_diroption and add these configuration files to the initial ram disk image.Signed-off-by Milan P. Gandhi <[email protected]>---
changes v2:
- Removed awk/sed usage to getconfig_dirpath
- Added a check to verify if path specifed with
config_diris actual directorymodules.d/90multipath/module-setup.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)modules.d/90multipath/module-setup.sh +1
-0@@ -79,6 +79,20 @@ install() { } } + # Include multipath configuration files from path specified with
config_dirmodules.d/90multipath/module-setup.sh +7
-0+ while read _k _v; do + if [[ "$_k" = config_dir ]]; then + _v=${_v#\"} + config_dir=${_v%\"} + fi + done < <(/sbin/multipath -t) +
Quoted 8 lines
Quoted 5 lines
modules.d/90multipath/module-setup.sh +4
-0+ if [ -d "$config_dir" ]; then + config_dir+="/*" + else + echo "multipath.conf: config_dir - No such directory$config_dir"
I believe new code should use derror or dwarning here instead of plain echo. Otherwise, it's looking good.
Sure, I will update it.
Thanks,
Milan.