Refactor process.go for platform specific

Signed-off-by: John Howard <jhoward@microsoft.com>

Move process sorter to new file

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Sort containers by id

This will not be the most accurate sorting but atleast the list will be
consistent inbetween calls.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Allow runtime to be configurable via daemon start

This allows people to pass an alternate name or location to the runtime
binary to start containers.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Fix state output for containers

Return the proper state/status for a container by checking if the pid is
still alive.  Also fix the cleanup handling in the shim to make sure
containers are not left behind.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>

Properly wait for container start

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
John Howard 2016-02-25 12:59:34 -08:00 committed by Michael Crosby
parent 0ad7654f80
commit b044ff0f29
19 changed files with 323 additions and 206 deletions

View file

@ -144,7 +144,8 @@ func createAPIContainer(c runtime.Container, getPids bool) (*types.Container, er
procs = append(procs, appendToProcs)
}
var pids []int
if getPids {
state := c.State()
if getPids && (state == runtime.Running || state == runtime.Paused) {
if pids, err = c.Pids(); err != nil {
return nil, grpc.Errorf(codes.Internal, "get all pids for container")
}
@ -154,8 +155,9 @@ func createAPIContainer(c runtime.Container, getPids bool) (*types.Container, er
BundlePath: c.Path(),
Processes: procs,
Labels: c.Labels(),
Status: string(c.State()),
Status: string(state),
Pids: toUint32(pids),
Runtime: c.Runtime(),
}, nil
}