2016-03-18 21:53:27 +03:00
|
|
|
package daemon
|
|
|
|
|
|
|
|
import (
|
2016-04-02 03:02:38 +03:00
|
|
|
"fmt"
|
|
|
|
|
2016-03-18 21:53:27 +03: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-02 03:02:38 +03: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-07 04:07:01 +03:00
|
|
|
if e.ExitCode == 0 && e.UpdatePending {
|
2016-04-13 23:34:07 +03: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 21:11:43 +03:00
|
|
|
container.SetExitCode(-1)
|
2016-04-13 23:34:07 +03:00
|
|
|
return fmt.Errorf("Post-run update servicing failed: %s", err)
|
|
|
|
}
|
2016-04-02 03:02:38 +03:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|