瀏覽代碼

Windows: Fix PR13278 compile break

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard 10 年之前
父節點
當前提交
71eadd4176
共有 3 個文件被更改,包括 36 次插入32 次删除
  1. 0 32
      daemon/volumes.go
  2. 32 0
      daemon/volumes_linux.go
  3. 4 0
      daemon/volumes_windows.go

+ 0 - 32
daemon/volumes.go

@@ -8,7 +8,6 @@ import (
 	"path/filepath"
 	"strings"
 
-	"github.com/Sirupsen/logrus"
 	"github.com/docker/docker/pkg/chrootarchive"
 	"github.com/docker/docker/runconfig"
 	"github.com/docker/docker/volume"
@@ -291,37 +290,6 @@ func (daemon *Daemon) verifyVolumesInfo(container *Container) error {
 	return container.ToDisk()
 }
 
-// migrateVolume moves the contents of a volume created pre Docker 1.7
-// to the location expected by the local driver. Steps:
-// 1. Save old directory that includes old volume's config json file.
-// 2. Move virtual directory with content to where the local driver expects it to be.
-// 3. Remove the backup of the old volume config.
-func (daemon *Daemon) migrateVolume(id, vfs string) error {
-	volumeInfo := filepath.Join(daemon.root, defaultVolumesPathName, id)
-	backup := filepath.Join(daemon.root, defaultVolumesPathName, id+".back")
-
-	var err error
-	if err = os.Rename(volumeInfo, backup); err != nil {
-		return err
-	}
-	defer func() {
-		// Put old configuration back in place in case one of the next steps fails.
-		if err != nil {
-			os.Rename(backup, volumeInfo)
-		}
-	}()
-
-	if err = os.Rename(vfs, volumeInfo); err != nil {
-		return err
-	}
-
-	if err = os.RemoveAll(backup); err != nil {
-		logrus.Errorf("Unable to remove volume info backup directory %s: %v", backup, err)
-	}
-
-	return nil
-}
-
 func createVolume(name, driverName string) (volume.Volume, error) {
 	vd, err := getVolumeDriver(driverName)
 	if err != nil {

+ 32 - 0
daemon/volumes_linux.go

@@ -8,6 +8,7 @@ import (
 	"sort"
 	"strings"
 
+	"github.com/Sirupsen/logrus"
 	"github.com/docker/docker/daemon/execdriver"
 	"github.com/docker/docker/pkg/system"
 )
@@ -68,3 +69,34 @@ func (m mounts) Swap(i, j int) {
 func (m mounts) parts(i int) int {
 	return len(strings.Split(filepath.Clean(m[i].Destination), string(os.PathSeparator)))
 }
+
+// migrateVolume moves the contents of a volume created pre Docker 1.7
+// to the location expected by the local driver. Steps:
+// 1. Save old directory that includes old volume's config json file.
+// 2. Move virtual directory with content to where the local driver expects it to be.
+// 3. Remove the backup of the old volume config.
+func (daemon *Daemon) migrateVolume(id, vfs string) error {
+	volumeInfo := filepath.Join(daemon.root, defaultVolumesPathName, id)
+	backup := filepath.Join(daemon.root, defaultVolumesPathName, id+".back")
+
+	var err error
+	if err = os.Rename(volumeInfo, backup); err != nil {
+		return err
+	}
+	defer func() {
+		// Put old configuration back in place in case one of the next steps fails.
+		if err != nil {
+			os.Rename(backup, volumeInfo)
+		}
+	}()
+
+	if err = os.Rename(vfs, volumeInfo); err != nil {
+		return err
+	}
+
+	if err = os.RemoveAll(backup); err != nil {
+		logrus.Errorf("Unable to remove volume info backup directory %s: %v", backup, err)
+	}
+
+	return nil
+}

+ 4 - 0
daemon/volumes_windows.go

@@ -12,3 +12,7 @@ func copyOwnership(source, destination string) error {
 func (container *Container) setupMounts() ([]execdriver.Mount, error) {
 	return nil, nil
 }
+
+func (daemon *Daemon) migrateVolume(id, vfs string) error {
+	return nil
+}