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

@@ -41,6 +41,11 @@ var daemonFlags = []cli.Flag{
Value: defaultGRPCEndpoint,
Usage: "Address on which GRPC API will listen",
},
cli.StringFlag{
Name: "runtime,r",
Value: "runc",
Usage: "name of the OCI compliant runtime to use when executing containers",
},
}
func main() {
@@ -58,6 +63,7 @@ func main() {
context.String("state-dir"),
10,
context.Bool("oom-notify"), // TODO Windows: Remove oom-notify
context.String("runtime"),
); err != nil {
logrus.Fatal(err)
}
@@ -67,11 +73,11 @@ func main() {
}
}
func daemon(address, stateDir string, concurrency int, oom bool) error {
func daemon(address, stateDir string, concurrency int, oom bool, runtimeName string) error {
// setup a standard reaper so that we don't leave any zombies if we are still alive
// this is just good practice because we are spawning new processes
go reapProcesses()
sv, err := supervisor.New(stateDir, oom)
sv, err := supervisor.New(stateDir, oom, runtimeName)
if err != nil {
return err
}