From d1cd203f85b236fe0020e752537877d887d35a82 Mon Sep 17 00:00:00 2001 From: Hui Kang Date: Fri, 11 Sep 2015 05:06:52 +0000 Subject: [PATCH] Add a method to retrieve the interfaces in a sandbox Signed-off-by: Hui Kang hkang.sunysb@gmail.com --- libnetwork_test.go | 4 ++++ sandbox.go | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/libnetwork_test.go b/libnetwork_test.go index 8366761cca..17e55c6fb5 100644 --- a/libnetwork_test.go +++ b/libnetwork_test.go @@ -1188,6 +1188,10 @@ func (f *fakeSandbox) Delete() error { return nil } +func (f *fakeSandbox) Interfaces() []osl.Interface { + return nil +} + func (f *fakeSandbox) SetKey(key string) error { return nil } diff --git a/sandbox.go b/sandbox.go index 93d4a2f478..8d4e0a1fa8 100644 --- a/sandbox.go +++ b/sandbox.go @@ -36,6 +36,8 @@ type Sandbox interface { SetKey(key string) error // Delete destroys this container after detaching it from all connected endpoints. Delete() error + // Retrieve the interfaces in the sandbox, for restoring checkpointed container + Interfaces() []osl.Interface } // SandboxOption is a option setter function type used to pass varios options to @@ -165,6 +167,14 @@ func (sb *sandbox) Delete() error { return nil } +func (sb *sandbox) Interfaces() []osl.Interface { + if sb.osSbox == nil { + return nil + } + + return sb.osSbox.Info().Interfaces() +} + func (sb *sandbox) Refresh(options ...SandboxOption) error { // Store connected endpoints epList := sb.getConnectedEndpoints()