2015-12-01 18:55:13 +00:00
|
|
|
package containerd
|
|
|
|
|
|
|
|
type StartEvent struct {
|
|
|
|
s *Supervisor
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *StartEvent) Handle(e *Event) error {
|
2015-12-11 01:07:21 +00:00
|
|
|
container, io, err := h.s.runtime.Create(e.ID, e.BundlePath)
|
2015-12-01 18:55:13 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2015-12-04 23:12:57 +00:00
|
|
|
h.s.containerGroup.Add(1)
|
2015-12-11 19:27:33 +00:00
|
|
|
h.s.containers[e.ID] = &containerInfo{
|
|
|
|
container: container,
|
|
|
|
}
|
2015-12-01 18:55:13 +00:00
|
|
|
ContainersCounter.Inc(1)
|
2015-12-04 00:07:53 +00:00
|
|
|
task := &StartTask{
|
2015-12-03 01:42:28 +00:00
|
|
|
Err: e.Err,
|
2015-12-11 01:07:21 +00:00
|
|
|
IO: io,
|
2015-12-03 01:42:28 +00:00
|
|
|
Container: container,
|
2015-12-14 22:15:26 +00:00
|
|
|
Stdout: e.Stdout,
|
|
|
|
Stderr: e.Stderr,
|
2015-12-01 18:55:13 +00:00
|
|
|
}
|
2015-12-04 00:07:53 +00:00
|
|
|
if e.Checkpoint != nil {
|
2015-12-04 22:00:07 +00:00
|
|
|
task.Checkpoint = e.Checkpoint.Name
|
2015-12-04 00:07:53 +00:00
|
|
|
}
|
|
|
|
h.s.tasks <- task
|
2015-12-01 18:55:13 +00:00
|
|
|
return errDeferedResponse
|
|
|
|
}
|