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

@ -76,7 +76,7 @@ check_flags() {
for flag in "$@"; do for flag in "$@"; do
echo "- $(check_flag "$flag")" echo "- $(check_flag "$flag")"
done done
} }
if [ ! -e "$CONFIG" ]; then if [ ! -e "$CONFIG" ]; then
wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config..." wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config..."
@ -165,8 +165,8 @@ echo '- Storage Drivers:'
echo '- "'$(wrap_color 'devicemapper' blue)'":' echo '- "'$(wrap_color 'devicemapper' blue)'":'
check_flags BLK_DEV_DM DM_THIN_PROVISIONING EXT4_FS EXT4_FS_POSIX_ACL EXT4_FS_SECURITY | sed 's/^/ /' 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 OVERLAYFS_FS | sed 's/^/ /' check_flags OVERLAY_FS | sed 's/^/ /'
} | sed 's/^/ /' } | sed 's/^/ /'
echo 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", "devicemapper",
"vfs", "vfs",
// experimental, has to be enabled manually for now // experimental, has to be enabled manually for now
"overlayfs", "overlay",
} }
ErrNotSupported = errors.New("driver not supported") ErrNotSupported = errors.New("driver not supported")

View File

@ -1,6 +1,6 @@
// +build linux // +build linux
package overlayfs package overlay
import ( import (
"fmt" "fmt"
@ -122,8 +122,8 @@ func copyDir(srcDir, dstDir string, flags CopyFlags) error {
return err return err
} }
// We need to copy this attribute if it appears in an overlayfs upper layer, as // 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 overlayfs if a directory // 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 // is removed and then re-created and should not inherit anything from the
// same dir in the lower dir. // same dir in the lower dir.
if err := copyXattr(srcPath, dstPath, "trusted.overlay.opaque"); err != nil { if err := copyXattr(srcPath, dstPath, "trusted.overlay.opaque"); err != nil {

View File

@ -1,6 +1,6 @@
// +build linux // +build linux
package overlayfs package overlay
import ( import (
"bufio" "bufio"
@ -9,7 +9,6 @@ import (
"os" "os"
"os/exec" "os/exec"
"path" "path"
"strings"
"sync" "sync"
"syscall" "syscall"
@ -51,18 +50,18 @@ func (d *naiveDiffDriverWithApply) ApplyDiff(id, parent string, diff archive.Arc
return b, err 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. // plus hard link file sharing for images.
// Each container/image can have a "root" subdirectory which is a plain // 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" // file, as well as "merged" and "work" directories. The "upper"
// directory has the upper layer of the overlay, and "lower-id" contains // 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 // 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" // 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 // 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" // parent has a "root" dir, then we start out with a empty "upper"
@ -91,11 +90,11 @@ type Driver struct {
} }
func init() { func init() {
graphdriver.Register("overlayfs", Init) graphdriver.Register("overlay", Init)
} }
func Init(home string, options []string) (graphdriver.Driver, error) { func Init(home string, options []string) (graphdriver.Driver, error) {
if err := supportsOverlayfs(); err != nil { if err := supportsOverlay(); err != nil {
return nil, graphdriver.ErrNotSupported return nil, graphdriver.ErrNotSupported
} }
@ -112,10 +111,10 @@ func Init(home string, options []string) (graphdriver.Driver, error) {
return NaiveDiffDriverWithApply(d), nil return NaiveDiffDriverWithApply(d), nil
} }
func supportsOverlayfs() error { func supportsOverlay() error {
// We can try to modprobe overlayfs first before looking at // We can try to modprobe overlay first before looking at
// proc/filesystems for when overlayfs is supported // proc/filesystems for when overlay is supported
exec.Command("modprobe", "overlayfs").Run() exec.Command("modprobe", "overlay").Run()
f, err := os.Open("/proc/filesystems") f, err := os.Open("/proc/filesystems")
if err != nil { if err != nil {
@ -125,16 +124,16 @@ func supportsOverlayfs() error {
s := bufio.NewScanner(f) s := bufio.NewScanner(f)
for s.Scan() { for s.Scan() {
if strings.Contains(s.Text(), "overlayfs") { if s.Text() == "nodev\toverlay" {
return nil 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 return graphdriver.ErrNotSupported
} }
func (d *Driver) String() string { func (d *Driver) String() string {
return "overlayfs" return "overlay"
} }
func (d *Driver) Status() [][2]string { func (d *Driver) Status() [][2]string {
@ -176,7 +175,7 @@ func (d *Driver) Create(id string, parent string) (retErr error) {
return err 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") parentRoot := path.Join(parentDir, "root")
if s, err := os.Lstat(parentRoot); err == nil { 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") mergedDir := path.Join(dir, "merged")
opts := fmt.Sprintf("lowerdir=%s,upperdir=%s,workdir=%s", lowerDir, upperDir, workDir) 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 return "", err
} }
mount.path = mergedDir mount.path = mergedDir
@ -302,7 +301,7 @@ func (d *Driver) Put(id string) {
if mount.mounted { if mount.mounted {
if err := syscall.Unmount(mount.path, 0); err != nil { 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 ### Daemon storage-driver option
The Docker daemon has support for several different image layer storage drivers: `aufs`, 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 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 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 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`. 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). 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 ### Docker exec-driver option