Some refactor and cleanup
Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
parent
3b4ff53867
commit
c179b0ffc7
|
@ -83,10 +83,7 @@ func (b *stoppedState) status() Status {
|
|||
|
||||
func (b *stoppedState) transition(s containerState) error {
|
||||
switch s.(type) {
|
||||
case *runningState:
|
||||
b.c.state = s
|
||||
return nil
|
||||
case *restoredState:
|
||||
case *runningState, *restoredState:
|
||||
b.c.state = s
|
||||
return nil
|
||||
case *stoppedState:
|
||||
|
@ -212,9 +209,7 @@ func (r *restoredState) status() Status {
|
|||
|
||||
func (r *restoredState) transition(s containerState) error {
|
||||
switch s.(type) {
|
||||
case *stoppedState:
|
||||
return nil
|
||||
case *runningState:
|
||||
case *stoppedState, *runningState:
|
||||
return nil
|
||||
}
|
||||
return newStateTransitionError(r, s)
|
||||
|
|
|
@ -295,7 +295,6 @@ func startContainer(context *cli.Context, spec *specs.Spec, create bool) (int, e
|
|||
if err != nil {
|
||||
return -1, err
|
||||
}
|
||||
detach := context.Bool("detach")
|
||||
// Support on-demand socket activation by passing file descriptors into the container init process.
|
||||
listenFDs := []*os.File{}
|
||||
if os.Getenv("LISTEN_FDS") != "" {
|
||||
|
@ -307,7 +306,7 @@ func startContainer(context *cli.Context, spec *specs.Spec, create bool) (int, e
|
|||
container: container,
|
||||
listenFDs: listenFDs,
|
||||
console: context.String("console"),
|
||||
detach: detach,
|
||||
detach: context.Bool("detach"),
|
||||
pidFile: context.String("pid-file"),
|
||||
create: create,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue