api: implement fetching the container status

Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2017-03-02 09:42:55 +00:00
parent a7ef3e5313
commit 899a52d655
8 changed files with 190 additions and 112 deletions

View file

@ -106,6 +106,15 @@ func (p *initProcess) Status() int {
return p.status
}
// ContainerStatus return the state of the container (created, running, paused, stopped)
func (p *initProcess) ContainerStatus(ctx context.Context) (string, error) {
c, err := p.runc.State(ctx, p.id)
if err != nil {
return "", err
}
return c.Status, nil
}
func (p *initProcess) Start(context context.Context) error {
return p.runc.Start(context, p.id)
}