mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
WIP
This commit is contained in:
parent
cbd1281ec9
commit
a518b84751
3 changed files with 49 additions and 4 deletions
|
@ -95,18 +95,25 @@ func supportsAufs() error {
|
||||||
return fmt.Errorf("AUFS was not found in /proc/filesystems")
|
return fmt.Errorf("AUFS was not found in /proc/filesystems")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AufsDriver) rootPath() string {
|
func (a AufsDriver) rootPath() string {
|
||||||
return a.root
|
return a.root
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AufsDriver) String() string {
|
func (AufsDriver) String() string {
|
||||||
return "aufs"
|
return "aufs"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *AufsDriver) Status() [][2]string {
|
func (AufsDriver) Status() [][2]string {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a AufsDriver) Exists(id string) bool {
|
||||||
|
if _, err := os.Lstat(path.Join(a.rootPath(), "diff", id)); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
// Three folders are created for each id
|
// Three folders are created for each id
|
||||||
// mnt, layers, and diff
|
// mnt, layers, and diff
|
||||||
func (a *AufsDriver) Create(id, parent string) error {
|
func (a *AufsDriver) Create(id, parent string) error {
|
||||||
|
|
32
graphdriver/aufs/migrate.go
Normal file
32
graphdriver/aufs/migrate.go
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
package aufs
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
|
"path"
|
||||||
|
)
|
||||||
|
|
||||||
|
func exists(pth string) bool {
|
||||||
|
if _, err := os.Stat(pth); err != nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *AufsDriver) Migrate(pth string) error {
|
||||||
|
fis, err := ioutil.ReadDir(pth)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
for _, fi := range fis {
|
||||||
|
if fi.IsDir() && exists(path.Join(pth, fi.Name(), "layer")) && !a.Exists(fi.Name()) {
|
||||||
|
if err := os.Symlink(path.Join(pth, fi.Name(), "layer"), path.Join(a.rootPath(), "diff", fi.Name())); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := a.Create(fi.Name(), ""); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/dotcloud/docker/archive"
|
"github.com/dotcloud/docker/archive"
|
||||||
"github.com/dotcloud/docker/graphdb"
|
"github.com/dotcloud/docker/graphdb"
|
||||||
"github.com/dotcloud/docker/graphdriver"
|
"github.com/dotcloud/docker/graphdriver"
|
||||||
_ "github.com/dotcloud/docker/graphdriver/aufs"
|
"github.com/dotcloud/docker/graphdriver/aufs"
|
||||||
_ "github.com/dotcloud/docker/graphdriver/devmapper"
|
_ "github.com/dotcloud/docker/graphdriver/devmapper"
|
||||||
_ "github.com/dotcloud/docker/graphdriver/dummy"
|
_ "github.com/dotcloud/docker/graphdriver/dummy"
|
||||||
"github.com/dotcloud/docker/utils"
|
"github.com/dotcloud/docker/utils"
|
||||||
|
@ -629,6 +629,12 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ad, ok := driver.(*aufs.AufsDriver); ok {
|
||||||
|
if err := ad.Migrate(path.Join(config.Root, "graph")); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err := linkLxcStart(config.Root); err != nil {
|
if err := linkLxcStart(config.Root); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue