mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
fix typos
Signed-off-by: allencloud <allen.sun@daocloud.io>
This commit is contained in:
parent
39536c4866
commit
edc307cb92
3 changed files with 9 additions and 9 deletions
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
// NoArgs validate args and returns an error if there are any args
|
// NoArgs validates args and returns an error if there are any args
|
||||||
func NoArgs(cmd *cobra.Command, args []string) error {
|
func NoArgs(cmd *cobra.Command, args []string) error {
|
||||||
if len(args) == 0 {
|
if len(args) == 0 {
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -195,7 +195,7 @@ func (s *State) ExitCode() int {
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetExitCode set current exitcode for the state. Take lock before if state
|
// SetExitCode sets current exitcode for the state. Take lock before if state
|
||||||
// may be shared.
|
// may be shared.
|
||||||
func (s *State) SetExitCode(ec int) {
|
func (s *State) SetExitCode(ec int) {
|
||||||
s.exitCode = ec
|
s.exitCode = ec
|
||||||
|
@ -214,7 +214,7 @@ func (s *State) SetRunning(pid int, initial bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetStoppedLocking locks the container state is sets it to "stopped".
|
// SetStoppedLocking locks the container state and sets it to "stopped".
|
||||||
func (s *State) SetStoppedLocking(exitStatus *ExitStatus) {
|
func (s *State) SetStoppedLocking(exitStatus *ExitStatus) {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
s.SetStopped(exitStatus)
|
s.SetStopped(exitStatus)
|
||||||
|
@ -290,7 +290,7 @@ func (s *State) SetRemovalInProgress() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResetRemovalInProgress make the RemovalInProgress state to false.
|
// ResetRemovalInProgress makes the RemovalInProgress state to false.
|
||||||
func (s *State) ResetRemovalInProgress() {
|
func (s *State) ResetRemovalInProgress() {
|
||||||
s.Lock()
|
s.Lock()
|
||||||
s.RemovalInProgress = false
|
s.RemovalInProgress = false
|
||||||
|
|
|
@ -326,7 +326,7 @@ func (daemon *Daemon) waitForNetworks(c *container.Container) {
|
||||||
}
|
}
|
||||||
// Make sure if the container has a network that requires discovery that the discovery service is available before starting
|
// Make sure if the container has a network that requires discovery that the discovery service is available before starting
|
||||||
for netName := range c.NetworkSettings.Networks {
|
for netName := range c.NetworkSettings.Networks {
|
||||||
// If we get `ErrNoSuchNetwork` here, it can assumed that it is due to discovery not being ready
|
// If we get `ErrNoSuchNetwork` here, we can assume that it is due to discovery not being ready
|
||||||
// Most likely this is because the K/V store used for discovery is in a container and needs to be started
|
// Most likely this is because the K/V store used for discovery is in a container and needs to be started
|
||||||
if _, err := daemon.netController.NetworkByName(netName); err != nil {
|
if _, err := daemon.netController.NetworkByName(netName); err != nil {
|
||||||
if _, ok := err.(libnetwork.ErrNoSuchNetwork); !ok {
|
if _, ok := err.(libnetwork.ErrNoSuchNetwork); !ok {
|
||||||
|
@ -613,10 +613,10 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error {
|
||||||
// To terminate a process in freezer cgroup, we should send
|
// To terminate a process in freezer cgroup, we should send
|
||||||
// SIGTERM to this process then unfreeze it, and the process will
|
// SIGTERM to this process then unfreeze it, and the process will
|
||||||
// force to terminate immediately.
|
// force to terminate immediately.
|
||||||
logrus.Debugf("Found container %s is paused, sending SIGTERM before unpause it", c.ID)
|
logrus.Debugf("Found container %s is paused, sending SIGTERM before unpausing it", c.ID)
|
||||||
sig, ok := signal.SignalMap["TERM"]
|
sig, ok := signal.SignalMap["TERM"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("System doesn not support SIGTERM")
|
return fmt.Errorf("System does not support SIGTERM")
|
||||||
}
|
}
|
||||||
if err := daemon.kill(c, int(sig)); err != nil {
|
if err := daemon.kill(c, int(sig)); err != nil {
|
||||||
return fmt.Errorf("sending SIGTERM to container %s with error: %v", c.ID, err)
|
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 {
|
||||||
return fmt.Errorf("Failed to unpause container %s with error: %v", c.ID, err)
|
return fmt.Errorf("Failed to unpause container %s with error: %v", c.ID, err)
|
||||||
}
|
}
|
||||||
if _, err := c.WaitStop(10 * time.Second); err != nil {
|
if _, err := c.WaitStop(10 * time.Second); err != nil {
|
||||||
logrus.Debugf("container %s failed to exit in 10 second of SIGTERM, sending SIGKILL to force", c.ID)
|
logrus.Debugf("container %s failed to exit in 10 seconds of SIGTERM, sending SIGKILL to force", c.ID)
|
||||||
sig, ok := signal.SignalMap["KILL"]
|
sig, ok := signal.SignalMap["KILL"]
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("System does not support SIGKILL")
|
return fmt.Errorf("System does not support SIGKILL")
|
||||||
|
@ -639,7 +639,7 @@ func (daemon *Daemon) shutdownContainer(c *container.Container) error {
|
||||||
}
|
}
|
||||||
// If container failed to exit in 10 seconds of SIGTERM, then using the force
|
// If container failed to exit in 10 seconds of SIGTERM, then using the force
|
||||||
if err := daemon.containerStop(c, 10); err != nil {
|
if err := daemon.containerStop(c, 10); err != nil {
|
||||||
return fmt.Errorf("Stop container %s with error: %v", c.ID, err)
|
return fmt.Errorf("Failed to stop container %s with error: %v", c.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
c.WaitStop(-1 * time.Second)
|
c.WaitStop(-1 * time.Second)
|
||||||
|
|
Loading…
Reference in a new issue