Merge pull request #1253 from snir911/fix-poststop

shimv2: log a warning and continue on post-stop hook failure
This commit is contained in:
James O. D. Hunt
2021-02-01 14:44:39 +00:00
committed by GitHub
2 changed files with 6 additions and 2 deletions

View File

@@ -29,7 +29,9 @@ func deleteContainer(ctx context.Context, s *service, c *container) error {
// Run post-stop OCI hooks. // Run post-stop OCI hooks.
if err := katautils.PostStopHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle); err != nil { if err := katautils.PostStopHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle); err != nil {
return err // log warning and continue, as defined in oci runtime spec
// https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#lifecycle
shimLog.WithError(err).Warn("Failed to run post-stop hooks")
} }
if c.mounted { if c.mounted {

View File

@@ -52,7 +52,9 @@ func startContainer(ctx context.Context, s *service, c *container) error {
return katautils.PostStartHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle) return katautils.PostStartHooks(ctx, *c.spec, s.sandbox.ID(), c.bundle)
}) })
if err != nil { if err != nil {
return err // log warning and continue, as defined in oci runtime spec
// https://github.com/opencontainers/runtime-spec/blob/master/runtime.md#lifecycle
shimLog.WithError(err).Warn("Failed to run post-start hooks")
} }
c.status = task.StatusRunning c.status = task.StatusRunning