summaryrefslogtreecommitdiff
path: root/daemon/container_windows.go
diff options
context:
space:
mode:
authorStefan J. Wernli <swernli@microsoft.com>2015-07-24 17:49:43 -0700
committerJohn Howard <jhoward@microsoft.com>2015-08-14 23:45:53 -0700
commitdfbb5520e3b35030f3eef38d5a2d86ad20ea0a2f (patch)
treed82bbd19dcac175312e6c7006281ab736c1534d4 /daemon/container_windows.go
parent424fa598597bd6d716d50dde076b0f4830b60ff8 (diff)
downloaddocker-dfbb5520e3b35030f3eef38d5a2d86ad20ea0a2f.tar.gz
Windows: Graph remove custom interface and add central store
Signed-off-by: Stefan J. Wernli <swernli@microsoft.com> Windows: add support for images stored in alternate location. Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
Diffstat (limited to 'daemon/container_windows.go')
-rw-r--r--daemon/container_windows.go75
1 files changed, 17 insertions, 58 deletions
diff --git a/daemon/container_windows.go b/daemon/container_windows.go
index 425e1abe54..cea0268565 100644
--- a/daemon/container_windows.go
+++ b/daemon/container_windows.go
@@ -4,14 +4,9 @@ package daemon
import (
"fmt"
- "path/filepath"
"strings"
"github.com/docker/docker/daemon/execdriver"
- "github.com/docker/docker/daemon/graphdriver/windows"
- "github.com/docker/docker/image"
- "github.com/docker/docker/pkg/archive"
- "github.com/microsoft/hcsshim"
)
// This is deliberately empty on Windows as the default path will be set by
@@ -98,25 +93,27 @@ func populateCommand(c *Container, env []string) error {
processConfig.Env = env
- var layerFolder string
var layerPaths []string
-
- // The following is specific to the Windows driver. We do this to
- // enable VFS to continue operating for development purposes.
- if wd, ok := c.daemon.driver.(*windows.WindowsGraphDriver); ok {
- var err error
- var img *image.Image
- var ids []string
-
- if img, err = c.daemon.graph.Get(c.ImageID); err != nil {
- return fmt.Errorf("Failed to graph.Get on ImageID %s - %s", c.ImageID, err)
+ img, err := c.daemon.graph.Get(c.ImageID)
+ if err != nil {
+ return fmt.Errorf("Failed to graph.Get on ImageID %s - %s", c.ImageID, err)
+ }
+ for i := img; i != nil && err == nil; i, err = c.daemon.graph.GetParent(i) {
+ lp, err := c.daemon.driver.Get(i.ID, "")
+ if err != nil {
+ return fmt.Errorf("Failed to get layer path from graphdriver %s for ImageID %s - %s", c.daemon.driver.String(), i.ID, err)
}
- if ids, err = c.daemon.graph.ParentLayerIds(img); err != nil {
- return fmt.Errorf("Failed to get parentlayer ids %s", img.ID)
+ layerPaths = append(layerPaths, lp)
+ err = c.daemon.driver.Put(i.ID)
+ if err != nil {
+ return fmt.Errorf("Failed to put layer path from graphdriver %s for ImageID %s - %s", c.daemon.driver.String(), i.ID, err)
}
- layerPaths = wd.LayerIdsToPaths(ids)
- layerFolder = filepath.Join(wd.Info().HomeDir, filepath.Base(c.ID))
}
+ m, err := c.daemon.driver.GetMetadata(c.ID)
+ if err != nil {
+ return fmt.Errorf("Failed to get layer metadata - %s", err)
+ }
+ layerFolder := m["dir"]
// TODO Windows: Factor out remainder of unused fields.
c.command = &execdriver.Command{
@@ -151,14 +148,6 @@ func (container *Container) AllocateNetwork() error {
return nil
}
-func (container *Container) ExportRw() (archive.Archive, error) {
- if container.IsRunning() {
- return nil, fmt.Errorf("Cannot export a running container.")
- }
- // TODO Windows. Implementation (different to Linux)
- return nil, nil
-}
-
func (container *Container) UpdateNetwork() error {
return nil
}
@@ -174,36 +163,6 @@ func (container *Container) UnmountVolumes(forceSyscall bool) error {
return nil
}
-func (container *Container) PrepareStorage() error {
- if wd, ok := container.daemon.driver.(*windows.WindowsGraphDriver); ok {
- // Get list of paths to parent layers.
- var ids []string
- if container.ImageID != "" {
- img, err := container.daemon.graph.Get(container.ImageID)
- if err != nil {
- return err
- }
-
- ids, err = container.daemon.graph.ParentLayerIds(img)
- if err != nil {
- return err
- }
- }
-
- if err := hcsshim.PrepareLayer(wd.Info(), container.ID, wd.LayerIdsToPaths(ids)); err != nil {
- return err
- }
- }
- return nil
-}
-
-func (container *Container) CleanupStorage() error {
- if wd, ok := container.daemon.driver.(*windows.WindowsGraphDriver); ok {
- return hcsshim.UnprepareLayer(wd.Info(), container.ID)
- }
- return nil
-}
-
// prepareMountPoints is a no-op on Windows
func (container *Container) prepareMountPoints() error {
return nil