virtcontainers: Remove useless startSandbox wrapper

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 <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2018-12-09 12:35:07 +01:00 committed by Eric Ernst
parent a8e158c9e3
commit ebf8547c38

View File

@ -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
}
@ -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
@ -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.