Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: Remove useless startSandbox wrapper
Browse files Browse the repository at this point in the history
startSandbox() wraps a single operation (sandbox.Start()), so we can
remove it and make the code easier to read/follow.

Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
Samuel Ortiz authored and Eric Ernst committed Jan 7, 2019
1 parent a8e158c commit ebf8547
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions virtcontainers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,8 @@ func StartSandbox(ctx context.Context, sandboxID string) (VCSandbox, error) {
}
defer s.releaseStatelessSandbox()

return startSandbox(s)
}

func startSandbox(s *Sandbox) (*Sandbox, error) {
// Start it
err := s.Start()
err = s.Start()
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -285,6 +281,7 @@ func RunSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
span, ctx := trace(ctx, "RunSandbox")
defer span.Finish()

// Create the sandbox
s, err := createSandboxFromConfig(ctx, sandboxConfig, factory)
if err != nil {
return nil, err
Expand All @@ -297,7 +294,13 @@ func RunSandbox(ctx context.Context, sandboxConfig SandboxConfig, factory Factor
}
defer unlockSandbox(lockFile)

return startSandbox(s)
// Start the sandbox
err = s.Start()
if err != nil {
return nil, err
}

return s, nil
}

// ListSandbox is the virtcontainers sandbox listing entry point.
Expand Down

0 comments on commit ebf8547

Please sign in to comment.