Fixes containerd-shim-runhcs State on exec id
Signed-off-by: Justin Terry (VM) <juterry@microsoft.com>
This commit is contained in:
parent
83437ef646
commit
772644e978
@ -204,14 +204,26 @@ func (s *service) State(ctx context.Context, r *taskAPI.StateRequest) (*taskAPI.
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tstatus string
|
||||||
|
|
||||||
|
// This is a container
|
||||||
|
if p.cid == p.id {
|
||||||
rhcs := newRunhcs(p.bundle)
|
rhcs := newRunhcs(p.bundle)
|
||||||
cs, err := rhcs.State(ctx, p.id)
|
cs, err := rhcs.State(ctx, p.id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
tstatus = cs.Status
|
||||||
|
} else {
|
||||||
|
if p.started {
|
||||||
|
tstatus = "running"
|
||||||
|
} else {
|
||||||
|
tstatus = "created"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status := task.StatusUnknown
|
status := task.StatusUnknown
|
||||||
switch cs.Status {
|
switch tstatus {
|
||||||
case "created":
|
case "created":
|
||||||
status = task.StatusCreated
|
status = task.StatusCreated
|
||||||
case "running":
|
case "running":
|
||||||
@ -224,8 +236,8 @@ func (s *service) State(ctx context.Context, r *taskAPI.StateRequest) (*taskAPI.
|
|||||||
pe := p.stat()
|
pe := p.stat()
|
||||||
return &taskAPI.StateResponse{
|
return &taskAPI.StateResponse{
|
||||||
ID: p.id,
|
ID: p.id,
|
||||||
Bundle: cs.Bundle,
|
Bundle: p.bundle,
|
||||||
Pid: uint32(cs.InitProcessPid),
|
Pid: p.pid,
|
||||||
Status: status,
|
Status: status,
|
||||||
Stdin: p.stdin,
|
Stdin: p.stdin,
|
||||||
Stdout: p.stdout,
|
Stdout: p.stdout,
|
||||||
|
Loading…
Reference in New Issue
Block a user