diff --git a/daemon/container_unix.go b/daemon/container_unix.go index 1c8a63ec8c..86155d0e01 100644 --- a/daemon/container_unix.go +++ b/daemon/container_unix.go @@ -509,7 +509,7 @@ func (container *Container) buildSandboxOptions() ([]libnetwork.SandboxOption, e return sboxOptions, nil } -func (container *Container) buildPortMapInfo(n libnetwork.Network, ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) { +func (container *Container) buildPortMapInfo(ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) { if ep == nil { return nil, fmt.Errorf("invalid endpoint while building port map info") } @@ -565,7 +565,7 @@ func (container *Container) buildPortMapInfo(n libnetwork.Network, ep libnetwork return networkSettings, nil } -func (container *Container) buildEndpointInfo(n libnetwork.Network, ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) { +func (container *Container) buildEndpointInfo(ep libnetwork.Endpoint, networkSettings *network.Settings) (*network.Settings, error) { if ep == nil { return nil, fmt.Errorf("invalid endpoint while building port map info") } @@ -636,12 +636,12 @@ func (container *Container) updateJoinInfo(ep libnetwork.Endpoint) error { func (container *Container) updateEndpointNetworkSettings(n libnetwork.Network, ep libnetwork.Endpoint) error { networkSettings := &network.Settings{NetworkID: n.ID(), EndpointID: ep.ID()} - networkSettings, err := container.buildPortMapInfo(n, ep, networkSettings) + networkSettings, err := container.buildPortMapInfo(ep, networkSettings) if err != nil { return err } - networkSettings, err = container.buildEndpointInfo(n, ep, networkSettings) + networkSettings, err = container.buildEndpointInfo(ep, networkSettings) if err != nil { return err } diff --git a/daemon/daemon.go b/daemon/daemon.go index c4599bf8bb..f5a0c035f3 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -170,13 +170,7 @@ func (daemon *Daemon) load(id string) (*Container, error) { } // Register makes a container object usable by the daemon as -// This is a wrapper for register func (daemon *Daemon) Register(container *Container) error { - return daemon.register(container, true) -} - -// register makes a container object usable by the daemon as -func (daemon *Daemon) register(container *Container, updateSuffixarray bool) error { if container.daemon != nil || daemon.Exists(container.ID) { return fmt.Errorf("Container is already loaded") } @@ -319,7 +313,7 @@ func (daemon *Daemon) restore() error { } } - if err := daemon.register(container, false); err != nil { + if err := daemon.Register(container); err != nil { logrus.Debugf("Failed to register container %s: %s", container.ID, err) } diff --git a/daemon/volumes_linux_unit_test.go b/daemon/volumes_linux_unit_test.go index 2f23de4470..35514bfea0 100644 --- a/daemon/volumes_linux_unit_test.go +++ b/daemon/volumes_linux_unit_test.go @@ -33,29 +33,28 @@ func TestGetVolumeDriver(t *testing.T) { func TestParseBindMount(t *testing.T) { cases := []struct { - bind string - driver string - expDest string - expSource string - expName string - expDriver string - mountLabel string - expRW bool - fail bool + bind string + driver string + expDest string + expSource string + expName string + expDriver string + expRW bool + fail bool }{ - {"/tmp:/tmp", "", "/tmp", "/tmp", "", "", "", true, false}, - {"/tmp:/tmp:ro", "", "/tmp", "/tmp", "", "", "", false, false}, - {"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", "", true, false}, - {"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", "", false, true}, - {"name:/tmp", "", "/tmp", "", "name", "local", "", true, false}, - {"name:/tmp", "external", "/tmp", "", "name", "external", "", true, false}, - {"name:/tmp:ro", "local", "/tmp", "", "name", "local", "", false, false}, - {"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", "", true, false}, - {"/tmp:tmp", "", "", "", "", "", "", true, true}, + {"/tmp:/tmp", "", "/tmp", "/tmp", "", "", true, false}, + {"/tmp:/tmp:ro", "", "/tmp", "/tmp", "", "", false, false}, + {"/tmp:/tmp:rw", "", "/tmp", "/tmp", "", "", true, false}, + {"/tmp:/tmp:foo", "", "/tmp", "/tmp", "", "", false, true}, + {"name:/tmp", "", "/tmp", "", "name", "local", true, false}, + {"name:/tmp", "external", "/tmp", "", "name", "external", true, false}, + {"name:/tmp:ro", "local", "/tmp", "", "name", "local", false, false}, + {"local/name:/tmp:rw", "", "/tmp", "", "local/name", "local", true, false}, + {"/tmp:tmp", "", "", "", "", "", true, true}, } for _, c := range cases { - m, err := parseBindMount(c.bind, c.mountLabel, c.driver) + m, err := parseBindMount(c.bind, c.driver) if c.fail { if err == nil { t.Fatalf("Expected error, was nil, for spec %s\n", c.bind) diff --git a/daemon/volumes_unix.go b/daemon/volumes_unix.go index d5ee0d3edd..5d8bb5fd8d 100644 --- a/daemon/volumes_unix.go +++ b/daemon/volumes_unix.go @@ -59,7 +59,7 @@ func (container *Container) setupMounts() ([]execdriver.Mount, error) { } // parseBindMount validates the configuration of mount information in runconfig is valid. -func parseBindMount(spec, mountLabel, volumeDriver string) (*mountPoint, error) { +func parseBindMount(spec, volumeDriver string) (*mountPoint, error) { bind := &mountPoint{ RW: true, } @@ -330,7 +330,7 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc // 3. Read bind mounts for _, b := range hostConfig.Binds { // #10618 - bind, err := parseBindMount(b, container.MountLabel, hostConfig.VolumeDriver) + bind, err := parseBindMount(b, hostConfig.VolumeDriver) if err != nil { return err }