Interface: introduce status to runtime container

Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
HuKeping 2016-04-22 15:49:55 -04:00
parent b31b8a611e
commit 9d30093505
3 changed files with 13 additions and 0 deletions

View file

@ -52,6 +52,9 @@ type Container interface {
OOM() (OOM, error) OOM() (OOM, error)
// UpdateResource updates the containers resources to new values // UpdateResource updates the containers resources to new values
UpdateResources(*Resource) error UpdateResources(*Resource) error
// Status return the current status of the container.
Status() (State, error)
} }
type OOM interface { type OOM interface {

View file

@ -284,6 +284,11 @@ func (c *container) Stats() (*Stat, error) {
}, nil }, nil
} }
// Status implements the runtime Container interface.
func (c *container) Status() (State, error) {
return "running", nil
}
func (c *container) OOM() (OOM, error) { func (c *container) OOM() (OOM, error) {
container, err := c.getLibctContainer() container, err := c.getLibctContainer()
if err != nil { if err != nil {

View file

@ -61,6 +61,11 @@ func (c *container) Stats() (*Stat, error) {
return nil, errors.New("Stats not yet implemented on Windows") return nil, errors.New("Stats not yet implemented on Windows")
} }
// Status implements the runtime Container interface.
func (c *container) Status() (State, error) {
return "", errors.New("Status not yet implemented on Windows")
}
func (c *container) OOM() (OOM, error) { func (c *container) OOM() (OOM, error) {
return nil, errors.New("OOM not yet implemented on Windows") return nil, errors.New("OOM not yet implemented on Windows")
} }