All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] dracut: Verify multipath config_dir option
@ 2020-02-03 11:30 Milan P. Gandhi
  2020-02-03 12:05 ` Dracut GitHub Import Bot
  2020-02-03 12:59 ` Martin Wilck
  0 siblings, 2 replies; 4+ messages in thread
From: Milan P. Gandhi @ 2020-02-03 11:30 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: harald-H+wXaHxf7aLQT0dZR+AlfA, mwilck-IBi9RG/b67k

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.

Signed-off-by: Milan P. Gandhi <mgandhi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---

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(-)

diff --git a/modules.d/90multipath/module-setup.sh b/modules.d/90multipath/module-setup.sh
index 48a9d09a..7609ff52 100755
--- a/modules.d/90multipath/module-setup.sh
+++ b/modules.d/90multipath/module-setup.sh
@@ -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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dracut: Verify multipath config_dir option
  2020-02-03 11:30 [PATCH v2] dracut: Verify multipath config_dir option Milan P. Gandhi
@ 2020-02-03 12:05 ` Dracut GitHub Import Bot
  2020-02-03 12:59 ` Martin Wilck
  1 sibling, 0 replies; 4+ messages in thread
From: Dracut GitHub Import Bot @ 2020-02-03 12:05 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

Patchset imported to github.
Pull request:
<https://github.com/dracutdevs/dracut/compare/master...dracut-mailing-devs:20200203113034.GA19959%40machine1>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dracut: Verify multipath config_dir option
  2020-02-03 11:30 [PATCH v2] dracut: Verify multipath config_dir option Milan P. Gandhi
  2020-02-03 12:05 ` Dracut GitHub Import Bot
@ 2020-02-03 12:59 ` Martin Wilck
       [not found]   ` <89c04b96b10322918b1fce9afda885254556f3af.camel-IBi9RG/b67k@public.gmane.org>
  1 sibling, 1 reply; 4+ messages in thread
From: Martin Wilck @ 2020-02-03 12:59 UTC (permalink / raw)
  To: Milan P. Gandhi, initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: harald-H+wXaHxf7aLQT0dZR+AlfA

On Mon, 2020-02-03 at 17:00 +0530, Milan P. Gandhi wrote:
> 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.
> 
> Signed-off-by: Milan P. Gandhi <mgandhi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> 
> 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(-)
> 
> diff --git a/modules.d/90multipath/module-setup.sh
> b/modules.d/90multipath/module-setup.sh
> index 48a9d09a..7609ff52 100755
> --- a/modules.d/90multipath/module-setup.sh
> +++ b/modules.d/90multipath/module-setup.sh
> @@ -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"

I believe new code should use derror or dwarning here instead of plain
echo. Otherwise, it's looking good.

Martin



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dracut: Verify multipath config_dir option
       [not found]   ` <89c04b96b10322918b1fce9afda885254556f3af.camel-IBi9RG/b67k@public.gmane.org>
@ 2020-02-04  5:09     ` Milan P. Gandhi
  0 siblings, 0 replies; 4+ messages in thread
From: Milan P. Gandhi @ 2020-02-04  5:09 UTC (permalink / raw)
  To: Martin Wilck, initramfs-u79uwXL29TY76Z2rM5mHXA
  Cc: harald-H+wXaHxf7aLQT0dZR+AlfA

On 2/3/20 6:29 PM, Martin Wilck wrote:
> On Mon, 2020-02-03 at 17:00 +0530, Milan P. Gandhi wrote:
>> 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.
>>
>> Signed-off-by: Milan P. Gandhi <mgandhi-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>>
>> 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(-)
>>
>> diff --git a/modules.d/90multipath/module-setup.sh
>> b/modules.d/90multipath/module-setup.sh
>> index 48a9d09a..7609ff52 100755
>> --- a/modules.d/90multipath/module-setup.sh
>> +++ b/modules.d/90multipath/module-setup.sh
>> @@ -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"
> 
> 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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-02-04  5:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 11:30 [PATCH v2] dracut: Verify multipath config_dir option Milan P. Gandhi
2020-02-03 12:05 ` Dracut GitHub Import Bot
2020-02-03 12:59 ` Martin Wilck
     [not found]   ` <89c04b96b10322918b1fce9afda885254556f3af.camel-IBi9RG/b67k@public.gmane.org>
2020-02-04  5:09     ` Milan P. Gandhi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.