From 7da5a7eb6637222a313e9d6e7fbcd5dd472154e3 Mon Sep 17 00:00:00 2001 From: Arnaud Porterie Date: Tue, 19 May 2015 18:37:01 -0700 Subject: [PATCH] Disable -v overloading Signed-off-by: Arnaud Porterie (cherry picked from commit ec5a362fb93358244305067419589f602fd33807) --- daemon/volumes.go | 26 ++------------------------ daemon/volumes_unit_test.go | 33 +++------------------------------ 2 files changed, 5 insertions(+), 54 deletions(-) diff --git a/daemon/volumes.go b/daemon/volumes.go index 8ca985500..c6220249b 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -15,8 +15,6 @@ import ( volumedrivers "github.com/docker/docker/volume/drivers" ) -var localMountErr = fmt.Errorf("Invalid driver: %s driver doesn't support named volumes", volume.DefaultDriverName) - type mountPoint struct { Name string Destination string @@ -74,34 +72,14 @@ func parseBindMount(spec string, config *runconfig.Config) (*mountPoint, error) } if !filepath.IsAbs(arr[0]) { - bind.Driver, bind.Name = parseNamedVolumeInfo(arr[0], config) - if bind.Driver == volume.DefaultDriverName { - return nil, localMountErr - } - } else { - bind.Source = filepath.Clean(arr[0]) + return nil, fmt.Errorf("cannot bind mount volume: %s volume paths must be absolute.", spec) } + bind.Source = filepath.Clean(arr[0]) bind.Destination = filepath.Clean(bind.Destination) return bind, nil } -func parseNamedVolumeInfo(info string, config *runconfig.Config) (driver string, name string) { - p := strings.SplitN(info, "/", 2) - switch len(p) { - case 2: - driver = p[0] - name = p[1] - default: - if driver = config.VolumeDriver; len(driver) == 0 { - driver = volume.DefaultDriverName - } - name = p[0] - } - - return -} - func parseVolumesFrom(spec string) (string, string, error) { if len(spec) == 0 { return "", "", fmt.Errorf("malformed volumes-from specification: %s", spec) diff --git a/daemon/volumes_unit_test.go b/daemon/volumes_unit_test.go index ac17b292f..dba8b9d84 100644 --- a/daemon/volumes_unit_test.go +++ b/daemon/volumes_unit_test.go @@ -8,33 +8,6 @@ import ( volumedrivers "github.com/docker/docker/volume/drivers" ) -func TestParseNamedVolumeInfo(t *testing.T) { - cases := []struct { - driver string - name string - expDriver string - expName string - }{ - {"", "name", "local", "name"}, - {"external", "name", "external", "name"}, - {"", "external/name", "external", "name"}, - {"ignored", "external/name", "external", "name"}, - } - - for _, c := range cases { - conf := &runconfig.Config{VolumeDriver: c.driver} - driver, name := parseNamedVolumeInfo(c.name, conf) - - if driver != c.expDriver { - t.Fatalf("Expected %s, was %s\n", c.expDriver, driver) - } - - if name != c.expName { - t.Fatalf("Expected %s, was %s\n", c.expName, name) - } - } -} - func TestParseBindMount(t *testing.T) { cases := []struct { bind string @@ -51,9 +24,9 @@ func TestParseBindMount(t *testing.T) { {"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", true, false}, {"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", false, true}, {"name:/tmp", "", "", "", "", "", false, true}, - {"name:/tmp", "external", "/tmp", "", "name", "external", true, false}, - {"external/name:/tmp:rw", "", "/tmp", "", "name", "external", true, false}, - {"external/name:/tmp:ro", "", "/tmp", "", "name", "external", false, false}, + {"name:/tmp", "external", "/tmp", "", "name", "external", true, true}, + {"external/name:/tmp:rw", "", "/tmp", "", "name", "external", true, true}, + {"external/name:/tmp:ro", "", "/tmp", "", "name", "external", false, true}, {"external/name:/tmp:foo", "", "/tmp", "", "name", "external", false, true}, {"name:/tmp", "local", "", "", "", "", false, true}, {"local/name:/tmp:rw", "", "", "", "", "", true, true},