On Mon, Apr 20, 2020 at 10:15 PM Vivek Goyal <vgoyal@xxxxxxxxxx> wrote: > > On Sat, Apr 18, 2020 at 12:57:27PM +0300, Amir Goldstein wrote: > > > > If I specify UNIONMOUNT_BASEDIR, then --samefs should be implied? > > > > > > > > > > This might have made sense with the meaning of UNIONMOUNT_BASEDIR > > > as it is in current posting, but with intended change, I suppose an empty > > > UNIONMOUNT_LOWERDIR could mean --samefs. > > > When both --samefs and UNIONMOUNT_LOWERDIR are specified, I'll > > > throw a warning that UNIONMOUNT_LOWERDIR is ignored. > > > > > > > Vivek, > > > > I updated the logic per some of your suggestions and push to: > > https://github.com/amir73il/unionmount-testsuite/commits/overlayfs-devel > > The example of how xfstests uses it is at: > > https://github.com/amir73il/xfstests/commits/unionmount > > > > Since I am mostly interested in feedback on config interface, I'll just > > paste the commit message here (same text is also in README). > > > > In short: if you set UNIONMOUNT_BASEDIR to virtiofs path and > > execute run --ov, all layers will be created under that virtiofs path. > > This is nice. I tried following and it seems to work. > > UNIONMOUNT_BASEDIR=/mnt/virtiofs/overlayfs-tests > UNIONMOUNT_MNTPOINT=/mnt/virtiofs/mnt > > Got a question though. If somebody specifies a BASEDIR, whey not > automatically select mount point also inside that basedir. Is it because > of existing structure where basedir and mnt directory are separate and > defaults are different. Anway, I don't mind overlay mountpoint with > a separate environment variable. > No reason. I think it's a good idea. I'll do it. > > > > Let me know if this works for you. > > Thanks, > > Amir. > > > > commit 8c2ac6e0cd9d4b01e421375e0b9c3703e774cd9f > > Author: Amir Goldstein <amir73il@xxxxxxxxx> > > Date: Sun Apr 12 19:22:19 2020 +0300 > > > > Configure custom layers via environment variables > > > > The following environment variables are supported: > > > > UNIONMOUNT_BASEDIR - parent dir of all samefs layers (default: /base) > > UNIONMOUNT_LOWERDIR - lower layer path for non samefs (default: /lower) > > UNIONMOUNT_MNTPOINT - mount point for executing tests (default: /mnt) > > > > When user provides paths for base/lower dir, they should point at > > existing directories and their content will be deleted. > > When the default base/lower paths are used, tmpfs instances are created. > > > > UNIONMOUNT_LOWERDIR is meaningless and will be ignored with --samefs. > > Empty UNIONMOUNT_LOWERDIR with non-empty UNIONMOUNT_BASEDIR imply --samefs, > > What happens if I specify both UNIONMOUNT_LOWERDIR as well as > UNIONMOUNT_BASEDIR. Does that mean only upper and work will be setup in > UNIONMOUNT_BASEDIR. > Yes, work and upper and with --ov=N also middle layers. > > unless user explicitly requested non samefs setup with maxfs=<M>. > > So if UNIONMOUNT_LOWERDIR is empty and I specify a UNIONMOUNT_BASEDIR and > use maxfs=<M>. All layers will still come from under UNIONMOUNT_BASEDIR, > right? Yes, but note that while the *path* of all layers is under UNIONMOUNT_BASEDIR, namely $UNIONMOUNT_BASEDIR/$N/{u,w}, some layers will use the basedir fs, while others will have a tmpfs instance mounted at $UNIONMOUNT_BASEDIR/$N/. M from maxfs=<M> determines the number of middle layers using tmpfs instances. Now that I think about it, this setup should use $UNIONMOUNT_BASEDIR/lower as lowerdir path and it uses /lower. I'll need to fix that. > > What's most intuitive to me is this. > > - If user only specifies UNIONMOUNT_BASEDIR, all layers (lower, upper, > work and even mount point) comes from that directory. OK. > > - If user specifies both UNIONMOUNT_LOWERDIR and UNIONMOUNT_BASEDIR, then > lower layer path comes from UNIONMOUNT_LOWERDIR and rest of the layers > come from UNIONMOUNT_BASEDIR. DONE. > > - If user specifies UNIONMOUNT_MNTPOINT, it is used as overlay mount > point. Otherwise one is selected from UNIONMOUNT_BASEDIR if user > specified one. Otherwise "/mnt" is the default. > OK. Thanks for valuable feedback, Amir.