Signed-off-by: allencloud <allen.sun@daocloud.io>
(cherry picked from commit edc307cb9213d11d9c5911b08ebd921a097939c0)
Signed-off-by: Tibor Vass <tibor@docker.com>
... | ... |
@@ -7,7 +7,7 @@ import ( |
7 | 7 |
"github.com/spf13/cobra" |
8 | 8 |
) |
9 | 9 |
|
10 |
-// NoArgs validate args and returns an error if there are any args |
|
10 |
+// NoArgs validates args and returns an error if there are any args |
|
11 | 11 |
func NoArgs(cmd *cobra.Command, args []string) error { |
12 | 12 |
if len(args) == 0 { |
13 | 13 |
return nil |
... | ... |
@@ -195,7 +195,7 @@ func (s *State) ExitCode() int { |
195 | 195 |
return res |
196 | 196 |
} |
197 | 197 |
|
198 |
-// SetExitCode set current exitcode for the state. Take lock before if state |
|
198 |
+// SetExitCode sets current exitcode for the state. Take lock before if state |
|
199 | 199 |
// may be shared. |
200 | 200 |
func (s *State) SetExitCode(ec int) { |
201 | 201 |
s.exitCode = ec |
... | ... |
@@ -214,7 +214,7 @@ func (s *State) SetRunning(pid int, initial bool) { |
214 | 214 |
} |
215 | 215 |
} |
216 | 216 |
|
217 |
-// SetStoppedLocking locks the container state is sets it to "stopped". |
|
217 |
+// SetStoppedLocking locks the container state and sets it to "stopped". |
|
218 | 218 |
func (s *State) SetStoppedLocking(exitStatus *ExitStatus) { |
219 | 219 |
s.Lock() |
220 | 220 |
s.SetStopped(exitStatus) |
... | ... |
@@ -290,7 +290,7 @@ func (s *State) SetRemovalInProgress() bool { |
290 | 290 |
return false |
291 | 291 |
} |
292 | 292 |
|
293 |
-// ResetRemovalInProgress make the RemovalInProgress state to false. |
|
293 |
+// ResetRemovalInProgress makes the RemovalInProgress state to false. |
|
294 | 294 |
func (s *State) ResetRemovalInProgress() { |
295 | 295 |
s.Lock() |
296 | 296 |
s.RemovalInProgress = false |
... | ... |
@@ -324,7 +324,7 @@ func (daemon *Daemon) waitForNetworks(c *container.Container) { |
324 | 324 |
} |
325 | 325 |
// Make sure if the container has a network that requires discovery that the discovery service is available before starting |
326 | 326 |
for netName := range c.NetworkSettings.Networks { |
327 |
- // If we get `ErrNoSuchNetwork` here, it can assumed that it is due to discovery not being ready |
|
327 |
+ // If we get `ErrNoSuchNetwork` here, we can assume that it is due to discovery not being ready |
|
328 | 328 |
// Most likely this is because the K/V store used for discovery is in a container and needs to be started |
329 | 329 |
if _, err := daemon.netController.NetworkByName(netName); err != nil { |
330 | 330 |
if _, ok := err.(libnetwork.ErrNoSuchNetwork); !ok { |
... | ... |
@@ -611,10 +611,10 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error { |
611 | 611 |
// To terminate a process in freezer cgroup, we should send |
612 | 612 |
// SIGTERM to this process then unfreeze it, and the process will |
613 | 613 |
// force to terminate immediately. |
614 |
- logrus.Debugf("Found container %s is paused, sending SIGTERM before unpause it", c.ID) |
|
614 |
+ logrus.Debugf("Found container %s is paused, sending SIGTERM before unpausing it", c.ID) |
|
615 | 615 |
sig, ok := signal.SignalMap["TERM"] |
616 | 616 |
if !ok { |
617 |
- return fmt.Errorf("System doesn not support SIGTERM") |
|
617 |
+ return fmt.Errorf("System does not support SIGTERM") |
|
618 | 618 |
} |
619 | 619 |
if err := daemon.kill(c, int(sig)); err != nil { |
620 | 620 |
return fmt.Errorf("sending SIGTERM to container %s with error: %v", c.ID, err) |
... | ... |
@@ -623,7 +623,7 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error { |
623 | 623 |
return fmt.Errorf("Failed to unpause container %s with error: %v", c.ID, err) |
624 | 624 |
} |
625 | 625 |
if _, err := c.WaitStop(10 * time.Second); err != nil { |
626 |
- logrus.Debugf("container %s failed to exit in 10 second of SIGTERM, sending SIGKILL to force", c.ID) |
|
626 |
+ logrus.Debugf("container %s failed to exit in 10 seconds of SIGTERM, sending SIGKILL to force", c.ID) |
|
627 | 627 |
sig, ok := signal.SignalMap["KILL"] |
628 | 628 |
if !ok { |
629 | 629 |
return fmt.Errorf("System does not support SIGKILL") |
... | ... |
@@ -637,7 +637,7 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error { |
637 | 637 |
} |
638 | 638 |
// If container failed to exit in 10 seconds of SIGTERM, then using the force |
639 | 639 |
if err := daemon.containerStop(c, 10); err != nil { |
640 |
- return fmt.Errorf("Stop container %s with error: %v", c.ID, err) |
|
640 |
+ return fmt.Errorf("Failed to stop container %s with error: %v", c.ID, err) |
|
641 | 641 |
} |
642 | 642 |
|
643 | 643 |
c.WaitStop(-1 * time.Second) |