From c57317893a743720a241ae328d1bdf7bd02b1fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Sun, 30 Nov 2014 10:14:34 +0100 Subject: [PATCH 1/3] Rename overlayfs to overlay MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Linux 3.18-rc6, overlayfs has been renamed overlay. This change was introduced by the following commit in linux.git: ef94b1864d1ed5be54376404bb23d22ed0481feb ovl: rename filesystem type to "overlay" Signed-off-by: Lénaïc Huard --- contrib/check-config.sh | 2 +- daemon/graphdriver/overlayfs/overlayfs.go | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/contrib/check-config.sh b/contrib/check-config.sh index 54b1359a22..e9fbb21e98 100755 --- a/contrib/check-config.sh +++ b/contrib/check-config.sh @@ -166,7 +166,7 @@ echo '- Storage Drivers:' check_flags BLK_DEV_DM DM_THIN_PROVISIONING EXT4_FS EXT4_FS_POSIX_ACL EXT4_FS_SECURITY | sed 's/^/ /' echo '- "'$(wrap_color 'overlayfs' blue)'":' - check_flags OVERLAYFS_FS | sed 's/^/ /' + check_flags OVERLAY_FS | sed 's/^/ /' } | sed 's/^/ /' echo diff --git a/daemon/graphdriver/overlayfs/overlayfs.go b/daemon/graphdriver/overlayfs/overlayfs.go index a9ce75a375..d7dfcb24ac 100644 --- a/daemon/graphdriver/overlayfs/overlayfs.go +++ b/daemon/graphdriver/overlayfs/overlayfs.go @@ -9,7 +9,6 @@ import ( "os" "os/exec" "path" - "strings" "sync" "syscall" @@ -115,7 +114,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) { func supportsOverlayfs() error { // We can try to modprobe overlayfs first before looking at // proc/filesystems for when overlayfs is supported - exec.Command("modprobe", "overlayfs").Run() + exec.Command("modprobe", "overlay").Run() f, err := os.Open("/proc/filesystems") if err != nil { @@ -125,11 +124,11 @@ func supportsOverlayfs() error { s := bufio.NewScanner(f) for s.Scan() { - if strings.Contains(s.Text(), "overlayfs") { + if s.Text() == "nodev\toverlay" { return nil } } - log.Error("'overlayfs' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlayfs support loaded.") + log.Error("'overlay' not found as a supported filesystem on this host. Please ensure kernel is new enough and has overlay support loaded.") return graphdriver.ErrNotSupported } @@ -274,7 +273,7 @@ func (d *Driver) Get(id string, mountLabel string) (string, error) { mergedDir := path.Join(dir, "merged") opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", lowerDir, upperDir, workDir) - if err := syscall.Mount("overlayfs", mergedDir, "overlayfs", 0, label.FormatMountLabel(opts, mountLabel)); err != nil { + if err := syscall.Mount("overlay", mergedDir, "overlay", 0, label.FormatMountLabel(opts, mountLabel)); err != nil { return "", err } mount.path = mergedDir From d680ca5c96484474757fb6f92274f47bf1520631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Wed, 3 Dec 2014 13:57:23 +0100 Subject: [PATCH 2/3] Rename the overlay storage driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit so that docker is started with `docker -d -s overlay` instead of `docker -d -s overlayfs` Signed-off-by: Lénaïc Huard --- contrib/check-config.sh | 4 ++-- daemon/graphdriver/driver.go | 2 +- daemon/graphdriver/overlayfs/overlayfs.go | 20 ++++++++++---------- docs/sources/reference/commandline/cli.md | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/contrib/check-config.sh b/contrib/check-config.sh index e9fbb21e98..72e3108fe1 100755 --- a/contrib/check-config.sh +++ b/contrib/check-config.sh @@ -76,7 +76,7 @@ check_flags() { for flag in "$@"; do echo "- $(check_flag "$flag")" done -} +} if [ ! -e "$CONFIG" ]; then wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config..." @@ -165,7 +165,7 @@ echo '- Storage Drivers:' echo '- "'$(wrap_color 'devicemapper' blue)'":' check_flags BLK_DEV_DM DM_THIN_PROVISIONING EXT4_FS EXT4_FS_POSIX_ACL EXT4_FS_SECURITY | sed 's/^/ /' - echo '- "'$(wrap_color 'overlayfs' blue)'":' + echo '- "'$(wrap_color 'overlay' blue)'":' check_flags OVERLAY_FS | sed 's/^/ /' } | sed 's/^/ /' echo diff --git a/daemon/graphdriver/driver.go b/daemon/graphdriver/driver.go index e91b44b34e..95479bf64f 100644 --- a/daemon/graphdriver/driver.go +++ b/daemon/graphdriver/driver.go @@ -81,7 +81,7 @@ var ( "devicemapper", "vfs", // experimental, has to be enabled manually for now - "overlayfs", + "overlay", } ErrNotSupported = errors.New("driver not supported") diff --git a/daemon/graphdriver/overlayfs/overlayfs.go b/daemon/graphdriver/overlayfs/overlayfs.go index d7dfcb24ac..fbe6b48083 100644 --- a/daemon/graphdriver/overlayfs/overlayfs.go +++ b/daemon/graphdriver/overlayfs/overlayfs.go @@ -50,18 +50,18 @@ func (d *naiveDiffDriverWithApply) ApplyDiff(id, parent string, diff archive.Arc return b, err } -// This backend uses the overlayfs union filesystem for containers +// This backend uses the overlay union filesystem for containers // plus hard link file sharing for images. // Each container/image can have a "root" subdirectory which is a plain -// filesystem hierarchy, or they can use overlayfs. +// filesystem hierarchy, or they can use overlay. -// If they use overlayfs there is a "upper" directory and a "lower-id" +// If they use overlay there is a "upper" directory and a "lower-id" // file, as well as "merged" and "work" directories. The "upper" // directory has the upper layer of the overlay, and "lower-id" contains // the id of the parent whose "root" directory shall be used as the lower // layer in the overlay. The overlay itself is mounted in the "merged" -// directory, and the "work" dir is needed for overlayfs to work. +// directory, and the "work" dir is needed for overlay to work. // When a overlay layer is created there are two cases, either the // parent has a "root" dir, then we start out with a empty "upper" @@ -90,7 +90,7 @@ type Driver struct { } func init() { - graphdriver.Register("overlayfs", Init) + graphdriver.Register("overlay", Init) } func Init(home string, options []string) (graphdriver.Driver, error) { @@ -112,8 +112,8 @@ func Init(home string, options []string) (graphdriver.Driver, error) { } func supportsOverlayfs() error { - // We can try to modprobe overlayfs first before looking at - // proc/filesystems for when overlayfs is supported + // We can try to modprobe overlay first before looking at + // proc/filesystems for when overlay is supported exec.Command("modprobe", "overlay").Run() f, err := os.Open("/proc/filesystems") @@ -133,7 +133,7 @@ func supportsOverlayfs() error { } func (d *Driver) String() string { - return "overlayfs" + return "overlay" } func (d *Driver) Status() [][2]string { @@ -175,7 +175,7 @@ func (d *Driver) Create(id string, parent string) (retErr error) { return err } - // If parent has a root, just do a overlayfs to it + // If parent has a root, just do a overlay to it parentRoot := path.Join(parentDir, "root") if s, err := os.Lstat(parentRoot); err == nil { @@ -301,7 +301,7 @@ func (d *Driver) Put(id string) { if mount.mounted { if err := syscall.Unmount(mount.path, 0); err != nil { - log.Debugf("Failed to unmount %s overlayfs: %v", id, err) + log.Debugf("Failed to unmount %s overlay: %v", id, err) } } diff --git a/docs/sources/reference/commandline/cli.md b/docs/sources/reference/commandline/cli.md index 06220be22a..4d33970b59 100644 --- a/docs/sources/reference/commandline/cli.md +++ b/docs/sources/reference/commandline/cli.md @@ -156,7 +156,7 @@ string is equivalent to setting the `--tlsverify` flag. The following are equiva ### Daemon storage-driver option The Docker daemon has support for several different image layer storage drivers: `aufs`, -`devicemapper`, `btrfs` and `overlayfs`. +`devicemapper`, `btrfs` and `overlay`. The `aufs` driver is the oldest, but is based on a Linux kernel patch-set that is unlikely to be merged into the main kernel. These are also known to cause some @@ -175,9 +175,9 @@ To tell the Docker daemon to use `devicemapper`, use The `btrfs` driver is very fast for `docker build` - but like `devicemapper` does not share executable memory between devices. Use `docker -d -s btrfs -g /mnt/btrfs_partition`. -The `overlayfs` is a very fast union filesystem. It is now merged in the main +The `overlay` is a very fast union filesystem. It is now merged in the main Linux kernel as of [3.18.0](https://lkml.org/lkml/2014/10/26/137). -Call `docker -d -s overlayfs` to use it. +Call `docker -d -s overlay` to use it. ### Docker exec-driver option From 2352f00e4ff2cd102a4d591d67aba8e1c7eaa7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Wed, 3 Dec 2014 14:06:19 +0100 Subject: [PATCH 3/3] Remove the last references to overlayfs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This only renames docker internal structures. It has no impact on the end-user. Signed-off-by: Lénaïc Huard --- daemon/daemon_overlay.go | 7 +++++ daemon/daemon_overlayfs.go | 7 ----- .../{overlayfs => overlay}/copy.go | 6 ++-- .../overlayfs.go => overlay/overlay.go} | 6 ++-- daemon/graphdriver/overlay/overlay_test.go | 28 +++++++++++++++++++ .../graphdriver/overlayfs/overlayfs_test.go | 28 ------------------- 6 files changed, 41 insertions(+), 41 deletions(-) create mode 100644 daemon/daemon_overlay.go delete mode 100644 daemon/daemon_overlayfs.go rename daemon/graphdriver/{overlayfs => overlay}/copy.go (94%) rename daemon/graphdriver/{overlayfs/overlayfs.go => overlay/overlay.go} (98%) create mode 100644 daemon/graphdriver/overlay/overlay_test.go delete mode 100644 daemon/graphdriver/overlayfs/overlayfs_test.go diff --git a/daemon/daemon_overlay.go b/daemon/daemon_overlay.go new file mode 100644 index 0000000000..25d6e80285 --- /dev/null +++ b/daemon/daemon_overlay.go @@ -0,0 +1,7 @@ +// +build !exclude_graphdriver_overlay + +package daemon + +import ( + _ "github.com/docker/docker/daemon/graphdriver/overlay" +) diff --git a/daemon/daemon_overlayfs.go b/daemon/daemon_overlayfs.go deleted file mode 100644 index e134b297a9..0000000000 --- a/daemon/daemon_overlayfs.go +++ /dev/null @@ -1,7 +0,0 @@ -// +build !exclude_graphdriver_overlayfs - -package daemon - -import ( - _ "github.com/docker/docker/daemon/graphdriver/overlayfs" -) diff --git a/daemon/graphdriver/overlayfs/copy.go b/daemon/graphdriver/overlay/copy.go similarity index 94% rename from daemon/graphdriver/overlayfs/copy.go rename to daemon/graphdriver/overlay/copy.go index 4c8c6239ac..ae6bee517b 100644 --- a/daemon/graphdriver/overlayfs/copy.go +++ b/daemon/graphdriver/overlay/copy.go @@ -1,6 +1,6 @@ // +build linux -package overlayfs +package overlay import ( "fmt" @@ -122,8 +122,8 @@ func copyDir(srcDir, dstDir string, flags CopyFlags) error { return err } - // We need to copy this attribute if it appears in an overlayfs upper layer, as - // this function is used to copy those. It is set by overlayfs if a directory + // We need to copy this attribute if it appears in an overlay upper layer, as + // this function is used to copy those. It is set by overlay if a directory // is removed and then re-created and should not inherit anything from the // same dir in the lower dir. if err := copyXattr(srcPath, dstPath, "trusted.overlay.opaque"); err != nil { diff --git a/daemon/graphdriver/overlayfs/overlayfs.go b/daemon/graphdriver/overlay/overlay.go similarity index 98% rename from daemon/graphdriver/overlayfs/overlayfs.go rename to daemon/graphdriver/overlay/overlay.go index fbe6b48083..c45c3ea7ad 100644 --- a/daemon/graphdriver/overlayfs/overlayfs.go +++ b/daemon/graphdriver/overlay/overlay.go @@ -1,6 +1,6 @@ // +build linux -package overlayfs +package overlay import ( "bufio" @@ -94,7 +94,7 @@ func init() { } func Init(home string, options []string) (graphdriver.Driver, error) { - if err := supportsOverlayfs(); err != nil { + if err := supportsOverlay(); err != nil { return nil, graphdriver.ErrNotSupported } @@ -111,7 +111,7 @@ func Init(home string, options []string) (graphdriver.Driver, error) { return NaiveDiffDriverWithApply(d), nil } -func supportsOverlayfs() error { +func supportsOverlay() error { // We can try to modprobe overlay first before looking at // proc/filesystems for when overlay is supported exec.Command("modprobe", "overlay").Run() diff --git a/daemon/graphdriver/overlay/overlay_test.go b/daemon/graphdriver/overlay/overlay_test.go new file mode 100644 index 0000000000..88194e4ff8 --- /dev/null +++ b/daemon/graphdriver/overlay/overlay_test.go @@ -0,0 +1,28 @@ +package overlay + +import ( + "github.com/docker/docker/daemon/graphdriver/graphtest" + "testing" +) + +// This avoids creating a new driver for each test if all tests are run +// Make sure to put new tests between TestOverlaySetup and TestOverlayTeardown +func TestOverlaySetup(t *testing.T) { + graphtest.GetDriver(t, "overlay") +} + +func TestOverlayCreateEmpty(t *testing.T) { + graphtest.DriverTestCreateEmpty(t, "overlay") +} + +func TestOverlayCreateBase(t *testing.T) { + graphtest.DriverTestCreateBase(t, "overlay") +} + +func TestOverlayCreateSnap(t *testing.T) { + graphtest.DriverTestCreateSnap(t, "overlay") +} + +func TestOverlayTeardown(t *testing.T) { + graphtest.PutDriver(t) +} diff --git a/daemon/graphdriver/overlayfs/overlayfs_test.go b/daemon/graphdriver/overlayfs/overlayfs_test.go deleted file mode 100644 index 7ab71d0e64..0000000000 --- a/daemon/graphdriver/overlayfs/overlayfs_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package overlayfs - -import ( - "github.com/docker/docker/daemon/graphdriver/graphtest" - "testing" -) - -// This avoids creating a new driver for each test if all tests are run -// Make sure to put new tests between TestOverlayfsSetup and TestOverlayfsTeardown -func TestOverlayfsSetup(t *testing.T) { - graphtest.GetDriver(t, "overlayfs") -} - -func TestOverlayfsCreateEmpty(t *testing.T) { - graphtest.DriverTestCreateEmpty(t, "overlayfs") -} - -func TestOverlayfsCreateBase(t *testing.T) { - graphtest.DriverTestCreateBase(t, "overlayfs") -} - -func TestOverlayfsCreateSnap(t *testing.T) { - graphtest.DriverTestCreateSnap(t, "overlayfs") -} - -func TestOverlayfsTeardown(t *testing.T) { - graphtest.PutDriver(t) -}