diff options
author | Fabricio Voznika <fvoznika@google.com> | 2020-05-28 14:45:52 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-05-28 14:49:06 -0700 |
commit | f7418e21590e271302a3c375323950c209ce5ced (patch) | |
tree | 856411630ca41d2ccc56888d464aa8d24e2c4ebd /runsc/container/container.go | |
parent | 7b79370c105b28a1cffa2d12d81898fc6b278728 (diff) |
Move Cleanup to its own package
PiperOrigin-RevId: 313663382
Diffstat (limited to 'runsc/container/container.go')
-rw-r--r-- | runsc/container/container.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/runsc/container/container.go b/runsc/container/container.go index 8539f252d..6d297d0df 100644 --- a/runsc/container/container.go +++ b/runsc/container/container.go @@ -31,6 +31,7 @@ import ( "github.com/cenkalti/backoff" specs "github.com/opencontainers/runtime-spec/specs-go" "gvisor.dev/gvisor/pkg/abi/linux" + "gvisor.dev/gvisor/pkg/cleanup" "gvisor.dev/gvisor/pkg/log" "gvisor.dev/gvisor/pkg/sentry/control" "gvisor.dev/gvisor/pkg/sentry/sighandling" @@ -293,7 +294,7 @@ func New(conf *boot.Config, args Args) (*Container, error) { } // The Cleanup object cleans up partially created containers when an error // occurs. Any errors occurring during cleanup itself are ignored. - cu := specutils.MakeCleanup(func() { _ = c.Destroy() }) + cu := cleanup.Make(func() { _ = c.Destroy() }) defer cu.Clean() // Lock the container metadata file to prevent concurrent creations of @@ -402,7 +403,7 @@ func (c *Container) Start(conf *boot.Config) error { if err := c.Saver.lock(); err != nil { return err } - unlock := specutils.MakeCleanup(func() { c.Saver.unlock() }) + unlock := cleanup.Make(func() { c.Saver.unlock() }) defer unlock.Clean() if err := c.requireStatus("start", Created); err != nil { @@ -506,7 +507,7 @@ func Run(conf *boot.Config, args Args) (syscall.WaitStatus, error) { } // Clean up partially created container if an error occurs. // Any errors returned by Destroy() itself are ignored. - cu := specutils.MakeCleanup(func() { + cu := cleanup.Make(func() { c.Destroy() }) defer cu.Clean() |