1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #9426 from lhuard1A/overlay_rename

Rename overlayfs to overlay
This commit is contained in:
Michael Crosby 2014-12-03 10:57:42 -08:00
commit 5d49d2bb7a
9 changed files with 62 additions and 63 deletions

View file

@ -165,8 +165,8 @@ 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)'":'
check_flags OVERLAYFS_FS | sed 's/^/ /'
echo '- "'$(wrap_color 'overlay' blue)'":'
check_flags OVERLAY_FS | sed 's/^/ /'
} | sed 's/^/ /'
echo

7
daemon/daemon_overlay.go Normal file
View file

@ -0,0 +1,7 @@
// +build !exclude_graphdriver_overlay
package daemon
import (
_ "github.com/docker/docker/daemon/graphdriver/overlay"
)

View file

@ -1,7 +0,0 @@
// +build !exclude_graphdriver_overlayfs
package daemon
import (
_ "github.com/docker/docker/daemon/graphdriver/overlayfs"
)

View file

@ -81,7 +81,7 @@ var (
"devicemapper",
"vfs",
// experimental, has to be enabled manually for now
"overlayfs",
"overlay",
}
ErrNotSupported = errors.New("driver not supported")

View file

@ -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 {

View file

@ -1,6 +1,6 @@
// +build linux
package overlayfs
package overlay
import (
"bufio"
@ -9,7 +9,6 @@ import (
"os"
"os/exec"
"path"
"strings"
"sync"
"syscall"
@ -51,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"
@ -91,11 +90,11 @@ type Driver struct {
}
func init() {
graphdriver.Register("overlayfs", Init)
graphdriver.Register("overlay", Init)
}
func Init(home string, options []string) (graphdriver.Driver, error) {
if err := supportsOverlayfs(); err != nil {
if err := supportsOverlay(); err != nil {
return nil, graphdriver.ErrNotSupported
}
@ -112,10 +111,10 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
return NaiveDiffDriverWithApply(d), nil
}
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()
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()
f, err := os.Open("/proc/filesystems")
if err != nil {
@ -125,16 +124,16 @@ 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
}
func (d *Driver) String() string {
return "overlayfs"
return "overlay"
}
func (d *Driver) Status() [][2]string {
@ -176,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 {
@ -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
@ -302,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)
}
}

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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