From b9d8ee0940c9b816e7e30e975e61397b78824bde Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Wed, 22 Mar 2017 14:23:53 +0100 Subject: [PATCH] oci: Add network readiness setter We want to be able to set the runtime network readiness flag, depending on the CNI plugin outcome. Signed-off-by: Samuel Ortiz --- oci/oci.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/oci/oci.go b/oci/oci.go index 5faf90c7..e68eec66 100644 --- a/oci/oci.go +++ b/oci/oci.go @@ -44,6 +44,7 @@ func New(runtimePath string, runtimeHostPrivilegedPath string, conmonPath string conmonPath: conmonPath, conmonEnv: conmonEnv, cgroupManager: cgroupManager, + networkReady: true, } return r, nil } @@ -56,6 +57,7 @@ type Runtime struct { conmonPath string conmonEnv []string cgroupManager string + networkReady bool } // syncInfo is used to return data from monitor process to daemon @@ -579,5 +581,10 @@ func (r *Runtime) RuntimeReady() (bool, error) { // NetworkReady checks if the runtime network is up and ready to // accept containers which require container network. func (r *Runtime) NetworkReady() (bool, error) { - return true, nil + return r.networkReady, nil +} + +// SetNetworkReady sets the runtime network readiness. +func (r *Runtime) SetNetworkReady(ready bool) { + r.networkReady = ready }