зеркало из https://github.com/microsoft/docker.git
This commit is contained in:
Родитель
cbd1281ec9
Коммит
a518b84751
|
@ -95,18 +95,25 @@ func supportsAufs() error {
|
|||
return fmt.Errorf("AUFS was not found in /proc/filesystems")
|
||||
}
|
||||
|
||||
func (a *AufsDriver) rootPath() string {
|
||||
func (a AufsDriver) rootPath() string {
|
||||
return a.root
|
||||
}
|
||||
|
||||
func (a *AufsDriver) String() string {
|
||||
func (AufsDriver) String() string {
|
||||
return "aufs"
|
||||
}
|
||||
|
||||
func (d *AufsDriver) Status() [][2]string {
|
||||
func (AufsDriver) Status() [][2]string {
|
||||
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
|
||||
// mnt, layers, and diff
|
||||
func (a *AufsDriver) Create(id, parent string) error {
|
||||
|
|
|
@ -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/graphdb"
|
||||
"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/dummy"
|
||||
"github.com/dotcloud/docker/utils"
|
||||
|
@ -629,6 +629,12 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
|
|||
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 {
|
||||
return nil, err
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче