mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Windows: Cleanup HCS on restore
Signed-off-by: John Howard <jhoward@microsoft.com>
This ensures that any compute processes in HCS are cleanedup
during daemon restore. Note Windows cannot (currently) reconnect
to containers on restore.
(cherry picked from commit f59593cbd1
)
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
This commit is contained in:
parent
f99de4e30f
commit
0017cf150a
1 changed files with 15 additions and 1 deletions
|
@ -552,8 +552,22 @@ func (clnt *client) Stats(containerID string) (*Stats, error) {
|
||||||
|
|
||||||
// Restore is the handler for restoring a container
|
// Restore is the handler for restoring a container
|
||||||
func (clnt *client) Restore(containerID string, _ StdioCallback, unusedOnWindows ...CreateOption) error {
|
func (clnt *client) Restore(containerID string, _ StdioCallback, unusedOnWindows ...CreateOption) error {
|
||||||
// TODO Windows: Implement this. For now, just tell the backend the container exited.
|
|
||||||
logrus.Debugf("libcontainerd: Restore(%s)", containerID)
|
logrus.Debugf("libcontainerd: Restore(%s)", containerID)
|
||||||
|
|
||||||
|
// TODO Windows: On RS1, a re-attach isn't possible.
|
||||||
|
// However, there is a scenario in which there is an issue.
|
||||||
|
// Consider a background container. The daemon dies unexpectedly.
|
||||||
|
// HCS will still have the compute service alive and running.
|
||||||
|
// For consistence, we call in to shoot it regardless if HCS knows about it
|
||||||
|
// We explicitly just log a warning if the terminate fails.
|
||||||
|
// Then we tell the backend the container exited.
|
||||||
|
if hc, err := hcsshim.OpenContainer(containerID); err == nil {
|
||||||
|
if err := hc.Terminate(); err != nil {
|
||||||
|
if !hcsshim.IsPending(err) {
|
||||||
|
logrus.Warnf("libcontainerd: failed to terminate %s on restore - %q", containerID, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return clnt.backend.StateChanged(containerID, StateInfo{
|
return clnt.backend.StateChanged(containerID, StateInfo{
|
||||||
CommonStateInfo: CommonStateInfo{
|
CommonStateInfo: CommonStateInfo{
|
||||||
State: StateExit,
|
State: StateExit,
|
||||||
|
|
Loading…
Add table
Reference in a new issue