Browse code

Disable -v overloading

Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
(cherry picked from commit ec5a362fb93358244305067419589f602fd33807)

Arnaud Porterie authored on 2015/05/20 10:37:01
Showing 2 changed files
... ...
@@ -15,8 +15,6 @@ import (
15 15
 	volumedrivers "github.com/docker/docker/volume/drivers"
16 16
 )
17 17
 
18
-var localMountErr = fmt.Errorf("Invalid driver: %s driver doesn't support named volumes", volume.DefaultDriverName)
19
-
20 18
 type mountPoint struct {
21 19
 	Name        string
22 20
 	Destination string
... ...
@@ -74,34 +72,14 @@ func parseBindMount(spec string, config *runconfig.Config) (*mountPoint, error)
74 74
 	}
75 75
 
76 76
 	if !filepath.IsAbs(arr[0]) {
77
-		bind.Driver, bind.Name = parseNamedVolumeInfo(arr[0], config)
78
-		if bind.Driver == volume.DefaultDriverName {
79
-			return nil, localMountErr
80
-		}
81
-	} else {
82
-		bind.Source = filepath.Clean(arr[0])
77
+		return nil, fmt.Errorf("cannot bind mount volume: %s volume paths must be absolute.", spec)
83 78
 	}
84 79
 
80
+	bind.Source = filepath.Clean(arr[0])
85 81
 	bind.Destination = filepath.Clean(bind.Destination)
86 82
 	return bind, nil
87 83
 }
88 84
 
89
-func parseNamedVolumeInfo(info string, config *runconfig.Config) (driver string, name string) {
90
-	p := strings.SplitN(info, "/", 2)
91
-	switch len(p) {
92
-	case 2:
93
-		driver = p[0]
94
-		name = p[1]
95
-	default:
96
-		if driver = config.VolumeDriver; len(driver) == 0 {
97
-			driver = volume.DefaultDriverName
98
-		}
99
-		name = p[0]
100
-	}
101
-
102
-	return
103
-}
104
-
105 85
 func parseVolumesFrom(spec string) (string, string, error) {
106 86
 	if len(spec) == 0 {
107 87
 		return "", "", fmt.Errorf("malformed volumes-from specification: %s", spec)
... ...
@@ -8,33 +8,6 @@ import (
8 8
 	volumedrivers "github.com/docker/docker/volume/drivers"
9 9
 )
10 10
 
11
-func TestParseNamedVolumeInfo(t *testing.T) {
12
-	cases := []struct {
13
-		driver    string
14
-		name      string
15
-		expDriver string
16
-		expName   string
17
-	}{
18
-		{"", "name", "local", "name"},
19
-		{"external", "name", "external", "name"},
20
-		{"", "external/name", "external", "name"},
21
-		{"ignored", "external/name", "external", "name"},
22
-	}
23
-
24
-	for _, c := range cases {
25
-		conf := &runconfig.Config{VolumeDriver: c.driver}
26
-		driver, name := parseNamedVolumeInfo(c.name, conf)
27
-
28
-		if driver != c.expDriver {
29
-			t.Fatalf("Expected %s, was %s\n", c.expDriver, driver)
30
-		}
31
-
32
-		if name != c.expName {
33
-			t.Fatalf("Expected %s, was %s\n", c.expName, name)
34
-		}
35
-	}
36
-}
37
-
38 11
 func TestParseBindMount(t *testing.T) {
39 12
 	cases := []struct {
40 13
 		bind      string
... ...
@@ -51,9 +24,9 @@ func TestParseBindMount(t *testing.T) {
51 51
 		{"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", true, false},
52 52
 		{"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", false, true},
53 53
 		{"name:/tmp", "", "", "", "", "", false, true},
54
-		{"name:/tmp", "external", "/tmp", "", "name", "external", true, false},
55
-		{"external/name:/tmp:rw", "", "/tmp", "", "name", "external", true, false},
56
-		{"external/name:/tmp:ro", "", "/tmp", "", "name", "external", false, false},
54
+		{"name:/tmp", "external", "/tmp", "", "name", "external", true, true},
55
+		{"external/name:/tmp:rw", "", "/tmp", "", "name", "external", true, true},
56
+		{"external/name:/tmp:ro", "", "/tmp", "", "name", "external", false, true},
57 57
 		{"external/name:/tmp:foo", "", "/tmp", "", "name", "external", false, true},
58 58
 		{"name:/tmp", "local", "", "", "", "", false, true},
59 59
 		{"local/name:/tmp:rw", "", "", "", "", "", true, true},