Browse code

remove Register return value Since Register() will never return err,remove the return value

Signed-off-by: NickrenREN <yuquan.ren@easystack.cn>

NickrenREN authored on 2017/02/06 13:27:40
Showing 3 changed files
... ...
@@ -88,7 +88,7 @@ func (daemon *Daemon) load(id string) (*container.Container, error) {
88 88
 }
89 89
 
90 90
 // Register makes a container object usable by the daemon as <container.ID>
91
-func (daemon *Daemon) Register(c *container.Container) error {
91
+func (daemon *Daemon) Register(c *container.Container) {
92 92
 	// Attach to stdout and stderr
93 93
 	if c.Config.OpenStdin {
94 94
 		c.StreamConfig.NewInputPipes()
... ...
@@ -98,8 +98,6 @@ func (daemon *Daemon) Register(c *container.Container) error {
98 98
 
99 99
 	daemon.containers.Add(c.ID, c)
100 100
 	daemon.idIndex.Add(c.ID)
101
-
102
-	return nil
103 101
 }
104 102
 
105 103
 func (daemon *Daemon) newContainer(name string, config *containertypes.Config, hostConfig *containertypes.HostConfig, imgID image.ID, managed bool) (*container.Container, error) {
... ...
@@ -151,9 +151,7 @@ func (daemon *Daemon) create(params types.ContainerCreateConfig, managed bool) (
151 151
 		logrus.Errorf("Error saving new container to disk: %v", err)
152 152
 		return nil, err
153 153
 	}
154
-	if err := daemon.Register(container); err != nil {
155
-		return nil, err
156
-	}
154
+	daemon.Register(container)
157 155
 	daemon.LogContainerEvent(container, "create")
158 156
 	return container, nil
159 157
 }
... ...
@@ -168,11 +168,7 @@ func (daemon *Daemon) restore() error {
168 168
 			delete(containers, id)
169 169
 			continue
170 170
 		}
171
-		if err := daemon.Register(c); err != nil {
172
-			logrus.Errorf("Failed to register container %s: %s", c.ID, err)
173
-			delete(containers, id)
174
-			continue
175
-		}
171
+		daemon.Register(c)
176 172
 
177 173
 		// verify that all volumes valid and have been migrated from the pre-1.7 layout
178 174
 		if err := daemon.verifyVolumesInfo(c); err != nil {