mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
78540d0d18
During the recent OCI changes, I mistakenly thought LayerFolderPath is only needed for Windows Server containers (isolation=process) and not for Hyper-V Containers, but it turns out it is also required for servicing containers used to finish installing updates. Since the servicing containers need to reuse the container's create options, this change makes it so that LayerFolderPath is always filled in for all containers as part of constructing the create options. Signed-off-by: Stefan J. Wernli <swernli@microsoft.com>
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package daemon
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"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),
|
|
}
|
|
}
|
|
|
|
// postRunProcessing perfoms any processing needed on the container after it has stopped.
|
|
func (daemon *Daemon) postRunProcessing(container *container.Container, e libcontainerd.StateInfo) error {
|
|
if e.ExitCode == 0 && e.UpdatePending {
|
|
spec, err := daemon.createSpec(container)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
newOpts := []libcontainerd.CreateOption{&libcontainerd.ServicingOption{
|
|
IsServicing: true,
|
|
}}
|
|
|
|
copts, err := daemon.getLibcontainerdCreateOptions(container)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if copts != nil {
|
|
newOpts = append(newOpts, *copts...)
|
|
}
|
|
|
|
// 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, newOpts...); err != nil {
|
|
container.SetExitCode(-1)
|
|
return fmt.Errorf("Post-run update servicing failed: %s", err)
|
|
}
|
|
}
|
|
return nil
|
|
}
|