Skip to contentSkip to conversation

dracut: Verify multipath config_dir option

PATCH In review Milan P. Gandhi 3 participants 3 messages Feb 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v3 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 v3:
- Removed awk/sed usage to get config_dir path
- Added a check to verify if path specifed with
config_dir is actual directory
- Used derror to report invalid config_dir path

 modules.d/90multipath/module-setup.sh | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
modules.d/90multipath/module-setup.sh +15 -1
index 48a9d09a..2f6d1f7a 100755
@@ -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
+        derror "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
Reviewed-by on v3 1/1
#2 lore raw
In reply to Milan P. Gandhi
Quoted 13 lines · Milan P. Gandhi

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.

---

Quoted 8 lines

changes v3:
- Removed awk/sed usage to get config_dir path
- Added a check to verify if path specifed with
config_dir is actual directory
- Used derror to report invalid config_dir path

 modules.d/90multipath/module-setup.sh | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
Quoted 38 lines
modules.d/90multipath/module-setup.sh +1 -0
index 48a9d09a..2f6d1f7a 100755
@@ -79,6 +79,20 @@ install() {
         }
     }
 
+    # Include multipath configuration files from path specified with

config_dir

modules.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
+        derror "multipath.conf: config_dir - No such directory

$config_dir"

modules.d/90multipath/module-setup.sh +3 -1
+    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