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

Merge pull request #13494 from Microsoft/10662-vfsdriveroption

Windows: Allow VFS
This commit is contained in:
David Calavera 2015-06-12 11:12:32 -07:00
commit e7533d7f81
3 changed files with 20 additions and 17 deletions

View file

@ -4,6 +4,7 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"runtime"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
) )
@ -112,9 +113,12 @@ func (daemon *Daemon) rm(container *Container, forceRemove bool) (err error) {
return fmt.Errorf("Driver %s failed to remove root filesystem %s: %s", daemon.driver, container.ID, err) return fmt.Errorf("Driver %s failed to remove root filesystem %s: %s", daemon.driver, container.ID, err)
} }
initID := fmt.Sprintf("%s-init", container.ID) // There will not be an -init on Windows, so don't fail by not attempting to delete it
if err := daemon.driver.Remove(initID); err != nil { if runtime.GOOS != "windows" {
return fmt.Errorf("Driver %s failed to remove init filesystem %s: %s", daemon.driver, initID, err) initID := fmt.Sprintf("%s-init", container.ID)
if err := daemon.driver.Remove(initID); err != nil {
return fmt.Errorf("Driver %s failed to remove init filesystem %s: %s", daemon.driver, initID, err)
}
} }
if err = os.RemoveAll(container.root); err != nil { if err = os.RemoveAll(container.root); err != nil {

View file

@ -1,26 +1,25 @@
package graphdriver package graphdriver
import (
_ "github.com/docker/docker/daemon/graphdriver/vfs"
// TODO Windows - Add references to real graph driver when PR'd
)
type DiffDiskDriver interface { type DiffDiskDriver interface {
Driver Driver
CopyDiff(id, sourceId string) error CopyDiff(id, sourceId string) error
} }
const (
FsMagicWindows = FsMagic(0xa1b1830f)
)
var ( var (
// Slice of drivers that should be used in an order // Slice of drivers that should be used in order
priority = []string{ priority = []string{
"windows", "windows",
} "vfs",
FsNames = map[FsMagic]string{
FsMagicWindows: "windows",
FsMagicUnsupported: "unsupported",
} }
) )
func GetFSMagic(rootpath string) (FsMagic, error) { func GetFSMagic(rootpath string) (FsMagic, error) {
return FsMagicWindows, nil // Note it is OK to return FsMagicUnsupported on Windows.
return FsMagicUnsupported, nil
} }

View file

@ -5,7 +5,7 @@ package vfs
import ( import (
"fmt" "fmt"
"os" "os"
"path" "path/filepath"
"github.com/docker/docker/daemon/graphdriver" "github.com/docker/docker/daemon/graphdriver"
"github.com/docker/docker/pkg/chrootarchive" "github.com/docker/docker/pkg/chrootarchive"
@ -42,7 +42,7 @@ func (d *Driver) Cleanup() error {
func (d *Driver) Create(id, parent string) error { func (d *Driver) Create(id, parent string) error {
dir := d.dir(id) dir := d.dir(id)
if err := system.MkdirAll(path.Dir(dir), 0700); err != nil { if err := system.MkdirAll(filepath.Dir(dir), 0700); err != nil {
return err return err
} }
if err := os.Mkdir(dir, 0755); err != nil { if err := os.Mkdir(dir, 0755); err != nil {
@ -66,7 +66,7 @@ func (d *Driver) Create(id, parent string) error {
} }
func (d *Driver) dir(id string) string { func (d *Driver) dir(id string) string {
return path.Join(d.home, "dir", path.Base(id)) return filepath.Join(d.home, "dir", filepath.Base(id))
} }
func (d *Driver) Remove(id string) error { func (d *Driver) Remove(id string) error {