Signed-off-by: allencloud <allen.sun@daocloud.io>
| ... | ... |
@@ -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 |
| ... | ... |
@@ -326,7 +326,7 @@ func (daemon *Daemon) waitForNetworks(c *container.Container) {
|
| 326 | 326 |
} |
| 327 | 327 |
// Make sure if the container has a network that requires discovery that the discovery service is available before starting |
| 328 | 328 |
for netName := range c.NetworkSettings.Networks {
|
| 329 |
- // If we get `ErrNoSuchNetwork` here, it can assumed that it is due to discovery not being ready |
|
| 329 |
+ // If we get `ErrNoSuchNetwork` here, we can assume that it is due to discovery not being ready |
|
| 330 | 330 |
// Most likely this is because the K/V store used for discovery is in a container and needs to be started |
| 331 | 331 |
if _, err := daemon.netController.NetworkByName(netName); err != nil {
|
| 332 | 332 |
if _, ok := err.(libnetwork.ErrNoSuchNetwork); !ok {
|
| ... | ... |
@@ -613,10 +613,10 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error {
|
| 613 | 613 |
// To terminate a process in freezer cgroup, we should send |
| 614 | 614 |
// SIGTERM to this process then unfreeze it, and the process will |
| 615 | 615 |
// force to terminate immediately. |
| 616 |
- logrus.Debugf("Found container %s is paused, sending SIGTERM before unpause it", c.ID)
|
|
| 616 |
+ logrus.Debugf("Found container %s is paused, sending SIGTERM before unpausing it", c.ID)
|
|
| 617 | 617 |
sig, ok := signal.SignalMap["TERM"] |
| 618 | 618 |
if !ok {
|
| 619 |
- return fmt.Errorf("System doesn not support SIGTERM")
|
|
| 619 |
+ return fmt.Errorf("System does not support SIGTERM")
|
|
| 620 | 620 |
} |
| 621 | 621 |
if err := daemon.kill(c, int(sig)); err != nil {
|
| 622 | 622 |
return fmt.Errorf("sending SIGTERM to container %s with error: %v", c.ID, err)
|
| ... | ... |
@@ -625,7 +625,7 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error {
|
| 625 | 625 |
return fmt.Errorf("Failed to unpause container %s with error: %v", c.ID, err)
|
| 626 | 626 |
} |
| 627 | 627 |
if _, err := c.WaitStop(10 * time.Second); err != nil {
|
| 628 |
- logrus.Debugf("container %s failed to exit in 10 second of SIGTERM, sending SIGKILL to force", c.ID)
|
|
| 628 |
+ logrus.Debugf("container %s failed to exit in 10 seconds of SIGTERM, sending SIGKILL to force", c.ID)
|
|
| 629 | 629 |
sig, ok := signal.SignalMap["KILL"] |
| 630 | 630 |
if !ok {
|
| 631 | 631 |
return fmt.Errorf("System does not support SIGKILL")
|
| ... | ... |
@@ -639,7 +639,7 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error {
|
| 639 | 639 |
} |
| 640 | 640 |
// If container failed to exit in 10 seconds of SIGTERM, then using the force |
| 641 | 641 |
if err := daemon.containerStop(c, 10); err != nil {
|
| 642 |
- return fmt.Errorf("Stop container %s with error: %v", c.ID, err)
|
|
| 642 |
+ return fmt.Errorf("Failed to stop container %s with error: %v", c.ID, err)
|
|
| 643 | 643 |
} |
| 644 | 644 |
|
| 645 | 645 |
c.WaitStop(-1 * time.Second) |