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 <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2017-03-22 14:23:53 +01:00
parent 1665042800
commit b9d8ee0940

View file

@ -44,6 +44,7 @@ func New(runtimePath string, runtimeHostPrivilegedPath string, conmonPath string
conmonPath: conmonPath, conmonPath: conmonPath,
conmonEnv: conmonEnv, conmonEnv: conmonEnv,
cgroupManager: cgroupManager, cgroupManager: cgroupManager,
networkReady: true,
} }
return r, nil return r, nil
} }
@ -56,6 +57,7 @@ type Runtime struct {
conmonPath string conmonPath string
conmonEnv []string conmonEnv []string
cgroupManager string cgroupManager string
networkReady bool
} }
// syncInfo is used to return data from monitor process to daemon // 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 // NetworkReady checks if the runtime network is up and ready to
// accept containers which require container network. // accept containers which require container network.
func (r *Runtime) NetworkReady() (bool, error) { 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
} }