Patchwork [2/2] wic: --fsoptions handling

login
register
mail settings
Submitter Maciej Borzecki
Date July 21, 2014, 9:34 p.m.
Message ID <1405978453-16554-2-git-send-email-maciej.borzecki@open-rnd.pl>
Download mbox | patch
Permalink /patch/76221/
State Accepted
Commit 5e7de54d3d444e4a1b7f7c2a4d20ae7d5ab2fbba
Headers show

Comments

Maciej Borzecki - July 21, 2014, 9:34 p.m.
Add handling of --fsoptions in parition definition. Default value of
mount option is 'defaults', all user defined options are appended.

Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
---
 scripts/lib/mic/imager/direct.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
Tom Zanussi - July 23, 2014, 7:59 p.m.
On Mon, 2014-07-21 at 23:34 +0200, Maciej Borzecki wrote:
> Add handling of --fsoptions in parition definition. Default value of
> mount option is 'defaults', all user defined options are appended.
> 
> Signed-off-by: Maciej Borzecki <maciej.borzecki@open-rnd.pl>
> Signed-off-by: Maciek Borzecki <maciek.borzecki@gmail.com>
> ---
>  scripts/lib/mic/imager/direct.py | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
> index beae372..024cd09 100644
> --- a/scripts/lib/mic/imager/direct.py
> +++ b/scripts/lib/mic/imager/direct.py
> @@ -113,7 +113,14 @@ class DirectImageCreator(BaseImageCreator):
>                  device_name = "/dev/" + p.disk + str(num + 1)
>              else:
>                  device_name = "/dev/" + p.disk + str(num)
> -            fstab_entry = device_name + "\t" + p.mountpoint + "\t" + p.fstype + "\tdefaults\t0\t0\n"
> +            opts = "defaults"
> +            if p.fsopts:
> +                opts += ","
> +                opts += p.fsopts

This is better than the hard-coded 'defaults' there now, but shouldn't
the logic be more like 'if the user specifies --fsoptions, use only
those directly, otherwise use the default 'defaults'?

IOW, if users want to append to 'defaults' they can do it themselves in
the --fsoptions they specify.  Otherwise, there's no way for a user to
specify their own options without 'defaults'.

Tom

> +            fstab_entry = device_name + "\t" + \
> +                          p.mountpoint + "\t" + \
> +                          p.fstype + "\t" + \
> +                          opts + "\t0\t0\n"
>              fstab_lines.append(fstab_entry)
>  
>      def _write_fstab(self, fstab, fstab_lines):

Patch

diff --git a/scripts/lib/mic/imager/direct.py b/scripts/lib/mic/imager/direct.py
index beae372..024cd09 100644
--- a/scripts/lib/mic/imager/direct.py
+++ b/scripts/lib/mic/imager/direct.py
@@ -113,7 +113,14 @@  class DirectImageCreator(BaseImageCreator):
                 device_name = "/dev/" + p.disk + str(num + 1)
             else:
                 device_name = "/dev/" + p.disk + str(num)
-            fstab_entry = device_name + "\t" + p.mountpoint + "\t" + p.fstype + "\tdefaults\t0\t0\n"
+            opts = "defaults"
+            if p.fsopts:
+                opts += ","
+                opts += p.fsopts
+            fstab_entry = device_name + "\t" + \
+                          p.mountpoint + "\t" + \
+                          p.fstype + "\t" + \
+                          opts + "\t0\t0\n"
             fstab_lines.append(fstab_entry)
 
     def _write_fstab(self, fstab, fstab_lines):