All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Giuseppe Scrivano <gscrivan@redhat.com>,
	Miklos Szeredi <miklos@szeredi.hu>,
	linux-unionfs@vger.kernel.org
Subject: Re: [PATCH 2/2] Configure custom layers via environment variables
Date: Wed, 15 Apr 2020 11:30:32 -0400	[thread overview]
Message-ID: <20200415153032.GC239514@redhat.com> (raw)
In-Reply-To: <20200415120134.28154-3-amir73il@gmail.com>

On Wed, Apr 15, 2020 at 03:01:34PM +0300, Amir Goldstein wrote:
> The following environment variables are supported:
> 
>  UNIONMOUNT_BASEDIR  - base dir for --samefs (default: /base)
>  UNIONMOUNT_UPPERDIR - upper layer root path (default: /upper)
>  UNIONMOUNT_LOWERDIR - lower layer root path (default: /lower)
>  UNIONMOUNT_MNTPOINT - mount point for tests (default: /mnt)
> 
> User provided paths for base/lower/upper should point at a pre-mounted
> filesystem, whereas tmpfs instances will be created on default paths.
> 
> This is going to be used for running unionmount tests from xfstests.

Hi Amir,

I don't understand this testsuite code. So I will ask.

What's base dir?

So these options will allow me to specify lower directory, upper directory
and overlay mount point. User can specify these and testsuite will
mount overlay accordingly?

What about overlay mount options. Should there be one option for that too.

Assuming workdir is automatically determined.

Vivek

> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
>  README      | 11 +++++++++++
>  run         |  3 ++-
>  settings.py | 51 ++++++++++++++++++++++++++++++---------------------
>  3 files changed, 43 insertions(+), 22 deletions(-)
> 
> diff --git a/README b/README
> index c352878..616135f 100644
> --- a/README
> +++ b/README
> @@ -47,5 +47,16 @@ To run these tests:
>  	./run --ov --fuse=<subfs-type>
>  
>  
> +The following environment variables are supported:
> +
> +     UNIONMOUNT_BASEDIR  - base dir for --samefs (default: /base)
> +     UNIONMOUNT_UPPERDIR - upper layer root path (default: /upper)
> +     UNIONMOUNT_LOWERDIR - lower layer root path (default: /lower)
> +     UNIONMOUNT_MNTPOINT - mount point for tests (default: /mnt)
> +
> +     User provided paths for base/lower/upper should point at a pre-mounted
> +     filesystem, whereas tmpfs instances will be created on default paths.
> +
> +
>  For more advanced overlayfs test options and more examples, see:
>       https://github.com/amir73il/overlayfs/wiki/Overlayfs-testing
> diff --git a/run b/run
> index e6262b8..60d5d0d 100755
> --- a/run
> +++ b/run
> @@ -20,10 +20,11 @@ def show_format(why):
>      print("\t", sys.argv[0], "--<fsop> <file> [<args>*] [-aLlv] [-R <content>] [-B] [-E <err>]")
>      sys.exit(2)
>  
> +cfg = config(sys.argv[0])
> +
>  if len(sys.argv) < 2:
>      show_format("Insufficient arguments")
>  
> -cfg = config(sys.argv[0])
>  args = sys.argv[1:]
>  
>  ###############################################################################
> diff --git a/settings.py b/settings.py
> index ced9cae..f065494 100644
> --- a/settings.py
> +++ b/settings.py
> @@ -20,15 +20,27 @@ along with this program; if not, write to the Free Software
>  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
>  """
>  
> +import os
> +
>  class config:
>      def __init__(self, progname):
>          self.__progname = progname
>          self.__testing_overlayfs = False
>          self.__testing_none = False
> -        self.__base_mntroot = None
> -        self.__lower_mntroot = None
> -        self.__upper_mntroot = None
> -        self.__union_mntroot = None
> +        self.__base_mntroot = os.getenv('UNIONMOUNT_BASEDIR')
> +        self.__lower_mntroot = os.getenv('UNIONMOUNT_LOWERDIR')
> +        self.__upper_mntroot = os.getenv('UNIONMOUNT_UPPERDIR')
> +        self.__union_mntroot = os.getenv('UNIONMOUNT_MNTPOINT')
> +        print("Environment variables:")
> +        if self.__base_mntroot:
> +            print("UNIONMOUNT_BASEDIR=" + self.__base_mntroot)
> +        if self.__lower_mntroot:
> +            print("UNIONMOUNT_LOWERDIR=" + self.__lower_mntroot)
> +        if self.__upper_mntroot:
> +            print("UNIONMOUNT_UPPERDIR=" + self.__upper_mntroot)
> +        if self.__union_mntroot:
> +            print("UNIONMOUNT_MNTPOINT=" + self.__union_mntroot)
> +        print()
>          self.__verbose = False
>          self.__verify = False
>          self.__maxfs = 0
> @@ -50,49 +62,46 @@ class config:
>          return self.__testing_overlayfs
>  
>      def set_testing_none(self):
> -        self.__lower_mntroot = "/lower"
> -        self.__union_mntroot = "/mnt"
>          self.__testing_none = True
>  
>      def set_testing_overlayfs(self):
> -        self.__base_mntroot = "/base"
> -        self.__lower_mntroot = "/lower"
> -        self.__upper_mntroot = "/upper"
> -        self.__union_mntroot = "/mnt"
>          self.__testing_overlayfs = True
>  
>      # base dir is mounted only for --ov --samefs
> +    # A user provided base dir should already be mounted
>      def should_mount_base(self):
> -        return self.testing_overlayfs() and self.is_samefs()
> +        return self.__base_mntroot is None and self.testing_overlayfs() and self.is_samefs()
>      def base_mntroot(self):
> -        return self.__base_mntroot
> +        return self.__base_mntroot or "/base"
>      # lower dir is mounted ro for --ov (without --samefs) ...
>      def should_mount_lower_ro(self):
> -        return self.testing_overlayfs() and not self.is_samefs()
> +        return self.__lower_mntroot is None and self.testing_overlayfs() and not self.is_samefs()
>      # ... and mounted rw for --no
> +    # A user provided lower dir should already be mounted
>      def should_mount_lower_rw(self):
> -        return self.testing_none()
> +        return self.__lower_mntroot is None and self.testing_none()
>      def should_mount_lower(self):
>          return self.should_mount_lower_ro() or self.should_mount_lower_rw()
>      def set_lower_mntroot(self, path):
>          self.__lower_mntroot = path
>      def lower_mntroot(self):
> -        return self.__lower_mntroot
> +        return self.__lower_mntroot or "/lower"
>      # upper dir is mounted for --ov (without --samefs)
> +    # A user provided upper dir should already be mounted
>      def should_mount_upper(self):
> -        return self.testing_overlayfs() and not self.is_samefs()
> +        return self.__upper_mntroot is None and self.testing_overlayfs() and not self.is_samefs()
>      def set_upper_mntroot(self, path):
>          self.__upper_mntroot = path
>      def upper_mntroot(self):
> -        return self.__upper_mntroot
> +        return self.__upper_mntroot or "/upper"
>      def union_mntroot(self):
> -        return self.__union_mntroot
> +        return self.__union_mntroot or "/mnt"
>      def lowerdir(self):
> -        return self.__lower_mntroot + "/a"
> +        return self.lower_mntroot() + "/a"
>      def lowerimg(self):
> -        return self.__lower_mntroot + "/a.img"
> +        return self.lower_mntroot() + "/a.img"
>      def testdir(self):
> -        return self.__union_mntroot + "/a"
> +        return self.union_mntroot() + "/a"
>  
>      def set_verbose(self, to=True):
>          self.__verbose = to
> -- 
> 2.17.1
> 


  reply	other threads:[~2020-04-15 15:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-15 12:01 [PATCH 0/2] Prepare for running unionmount testssuite from Amir Goldstein
2020-04-15 12:01 ` [PATCH 1/2] Stop using bind mounts for --samefs Amir Goldstein
2020-04-15 12:01 ` [PATCH 2/2] Configure custom layers via environment variables Amir Goldstein
2020-04-15 15:30   ` Vivek Goyal [this message]
2020-04-15 16:27     ` Amir Goldstein
2020-04-15 19:42       ` Vivek Goyal
2020-04-16  7:10         ` Amir Goldstein
2020-04-16 12:58           ` Vivek Goyal
2020-04-16 13:49             ` Amir Goldstein
2020-04-18  9:57               ` Amir Goldstein
2020-04-20 19:14                 ` Vivek Goyal
2020-04-21  5:57                   ` Amir Goldstein
2020-05-17  8:45                     ` Amir Goldstein
2020-05-22 14:36                       ` Vivek Goyal
2020-05-22 17:19                         ` Amir Goldstein
2020-05-24 10:28                           ` Amir Goldstein
2020-05-26 12:54                             ` Vivek Goyal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200415153032.GC239514@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=amir73il@gmail.com \
    --cc=gscrivan@redhat.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.