Bläddra i källkod

Merge pull request #16191 from runcom/daemon-remove-unused-function-params

daemon: remove unused function params
David Calavera 9 år sedan
förälder
incheckning
65e43593f5
4 ändrade filer med 25 tillägg och 32 borttagningar
  1. 4 4
      daemon/container_unix.go
  2. 1 7
      daemon/daemon.go
  3. 18 19
      daemon/volumes_linux_unit_test.go
  4. 2 2
      daemon/volumes_unix.go

+ 4 - 4
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
 	}

+ 1 - 7
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 <container.ID>
-// 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 <container.ID>
-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)
 			}
 

+ 18 - 19
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)

+ 2 - 2
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
 		}