Some refactor and cleanup

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
This commit is contained in:
Zhang Wei
2016-10-20 17:57:37 +08:00
parent 3b4ff53867
commit c179b0ffc7
2 changed files with 3 additions and 9 deletions

View File

@@ -83,10 +83,7 @@ func (b *stoppedState) status() Status {
func (b *stoppedState) transition(s containerState) error { func (b *stoppedState) transition(s containerState) error {
switch s.(type) { switch s.(type) {
case *runningState: case *runningState, *restoredState:
b.c.state = s
return nil
case *restoredState:
b.c.state = s b.c.state = s
return nil return nil
case *stoppedState: case *stoppedState:
@@ -212,9 +209,7 @@ func (r *restoredState) status() Status {
func (r *restoredState) transition(s containerState) error { func (r *restoredState) transition(s containerState) error {
switch s.(type) { switch s.(type) {
case *stoppedState: case *stoppedState, *runningState:
return nil
case *runningState:
return nil return nil
} }
return newStateTransitionError(r, s) return newStateTransitionError(r, s)

View File

@@ -295,7 +295,6 @@ func startContainer(context *cli.Context, spec *specs.Spec, create bool) (int, e
if err != nil { if err != nil {
return -1, err return -1, err
} }
detach := context.Bool("detach")
// Support on-demand socket activation by passing file descriptors into the container init process. // Support on-demand socket activation by passing file descriptors into the container init process.
listenFDs := []*os.File{} listenFDs := []*os.File{}
if os.Getenv("LISTEN_FDS") != "" { if os.Getenv("LISTEN_FDS") != "" {
@@ -307,7 +306,7 @@ func startContainer(context *cli.Context, spec *specs.Spec, create bool) (int, e
container: container, container: container,
listenFDs: listenFDs, listenFDs: listenFDs,
console: context.String("console"), console: context.String("console"),
detach: detach, detach: context.Bool("detach"),
pidFile: context.String("pid-file"), pidFile: context.String("pid-file"),
create: create, create: create,
} }