2016-03-18 14:53:27 -04:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
2016-04-01 20:02:38 -04:00
|
|
|
"fmt"
|
|
|
|
|
2016-03-18 14:53:27 -04:00
|
|
|
"github.com/docker/docker/container"
|
|
|
|
"github.com/docker/docker/libcontainerd"
|
|
|
|
)
|
|
|
|
|
|
|
|
// platformConstructExitStatus returns a platform specific exit status structure
|
|
|
|
func platformConstructExitStatus(e libcontainerd.StateInfo) *container.ExitStatus {
|
|
|
|
return &container.ExitStatus{
|
|
|
|
ExitCode: int(e.ExitCode),
|
|
|
|
}
|
|
|
|
}
|
2016-04-01 20:02:38 -04:00
|
|
|
|
|
|
|
// postRunProcessing perfoms any processing needed on the container after it has stopped.
|
|
|
|
func (daemon *Daemon) postRunProcessing(container *container.Container, e libcontainerd.StateInfo) error {
|
2016-06-06 21:07:01 -04:00
|
|
|
if e.ExitCode == 0 && e.UpdatePending {
|
2016-04-13 16:34:07 -04:00
|
|
|
spec, err := daemon.createSpec(container)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
servicingOption := &libcontainerd.ServicingOption{
|
|
|
|
IsServicing: true,
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create a new servicing container, which will start, complete the update, and merge back the
|
|
|
|
// results if it succeeded, all as part of the below function call.
|
|
|
|
if err := daemon.containerd.Create((container.ID + "_servicing"), *spec, servicingOption); err != nil {
|
2016-06-14 14:11:43 -04:00
|
|
|
container.SetExitCode(-1)
|
2016-04-13 16:34:07 -04:00
|
|
|
return fmt.Errorf("Post-run update servicing failed: %s", err)
|
|
|
|
}
|
2016-04-01 20:02:38 -04:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|