mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
daemon: translateContainerdStartErr(): rename to setExitCodeFromError()
This should hopefully make it slightly clearer what it does. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -132,7 +132,7 @@ func (e startInvalidConfigError) Error() string {
|
||||
|
||||
func (e startInvalidConfigError) InvalidParameter() {} // Is this right???
|
||||
|
||||
// exitStatus is the exit-code as set by translateContainerdStartErr
|
||||
// exitStatus is the exit-code as set by setExitCodeFromError
|
||||
type exitStatus = int
|
||||
|
||||
const (
|
||||
@@ -141,11 +141,11 @@ const (
|
||||
exitUnknown exitStatus = 128 // unknown error
|
||||
)
|
||||
|
||||
// translateContainerdStartErr converts the error returned by containerd
|
||||
// setExitCodeFromError converts the error returned by containerd
|
||||
// when starting a container, and applies the corresponding exitStatus to the
|
||||
// container. It returns an errdefs error (either errdefs.ErrInvalidParameter
|
||||
// or errdefs.ErrUnknown).
|
||||
func translateContainerdStartErr(setExitCode func(exitStatus), err error) error {
|
||||
func setExitCodeFromError(setExitCode func(exitStatus), err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, optio
|
||||
close(ec.Started)
|
||||
if err != nil {
|
||||
defer ec.Unlock()
|
||||
return translateContainerdStartErr(ec.SetExitCode, err)
|
||||
return setExitCodeFromError(ec.SetExitCode, err)
|
||||
}
|
||||
ec.Unlock()
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ func (daemon *Daemon) containerStart(ctx context.Context, container *container.C
|
||||
|
||||
ctr, err := libcontainerd.ReplaceContainer(ctx, daemon.containerd, container.ID, spec, shim, createOptions)
|
||||
if err != nil {
|
||||
return translateContainerdStartErr(container.SetExitCode, err)
|
||||
return setExitCodeFromError(container.SetExitCode, err)
|
||||
}
|
||||
|
||||
// TODO(mlaventure): we need to specify checkpoint options here
|
||||
@@ -191,7 +191,7 @@ func (daemon *Daemon) containerStart(ctx context.Context, container *container.C
|
||||
logrus.WithError(err).WithField("container", container.ID).
|
||||
Error("failed to delete failed start container")
|
||||
}
|
||||
return translateContainerdStartErr(container.SetExitCode, err)
|
||||
return setExitCodeFromError(container.SetExitCode, err)
|
||||
}
|
||||
|
||||
container.HasBeenManuallyRestarted = false
|
||||
|
||||
@@ -17,7 +17,7 @@ func (daemon *Daemon) getLibcontainerdCreateOptions(container *container.Contain
|
||||
|
||||
rt, err := daemon.getRuntime(container.HostConfig.Runtime)
|
||||
if err != nil {
|
||||
return "", nil, translateContainerdStartErr(container.SetExitCode, err)
|
||||
return "", nil, setExitCodeFromError(container.SetExitCode, err)
|
||||
}
|
||||
|
||||
return rt.Shim.Binary, rt.Shim.Opts, nil
|
||||
|
||||
Reference in New Issue
Block a user