mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
Update libcontainerd to use containerd 1.0
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package daemon
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/docker/container"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// ContainerPause pauses a container
|
||||
@@ -33,7 +35,7 @@ func (daemon *Daemon) containerPause(container *container.Container) error {
|
||||
|
||||
// We cannot Pause the container which is already paused
|
||||
if container.Paused {
|
||||
return fmt.Errorf("Container %s is already paused", container.ID)
|
||||
return errNotPaused(container.ID)
|
||||
}
|
||||
|
||||
// We cannot Pause the container which is restarting
|
||||
@@ -41,9 +43,18 @@ func (daemon *Daemon) containerPause(container *container.Container) error {
|
||||
return errContainerIsRestarting(container.ID)
|
||||
}
|
||||
|
||||
if err := daemon.containerd.Pause(container.ID); err != nil {
|
||||
if err := daemon.containerd.Pause(context.Background(), container.ID); err != nil {
|
||||
return fmt.Errorf("Cannot pause container %s: %s", container.ID, err)
|
||||
}
|
||||
|
||||
container.Paused = true
|
||||
daemon.setStateCounter(container)
|
||||
daemon.updateHealthMonitor(container)
|
||||
daemon.LogContainerEvent(container, "pause")
|
||||
|
||||
if err := container.CheckpointTo(daemon.containersReplica); err != nil {
|
||||
logrus.WithError(err).Warn("could not save container to disk")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user