api: implement fetching the container status
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
parent
a7ef3e5313
commit
899a52d655
8 changed files with 190 additions and 112 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue