mirror of
https://github.com/containers/podman.git
synced 2025-12-10 07:42:12 +08:00
Merge pull request #1848 from adrianreber/master
Add tcp-established to checkpoint/restore
This commit is contained in:
@@ -27,6 +27,10 @@ var (
|
||||
Name: "leave-running, R",
|
||||
Usage: "leave the container running after writing checkpoint to disk",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "tcp-established",
|
||||
Usage: "checkpoint a container with established TCP connections",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "all, a",
|
||||
Usage: "checkpoint all running containers",
|
||||
@@ -55,8 +59,9 @@ func checkpointCmd(c *cli.Context) error {
|
||||
defer runtime.Shutdown(false)
|
||||
|
||||
options := libpod.ContainerCheckpointOptions{
|
||||
Keep: c.Bool("keep"),
|
||||
KeepRunning: c.Bool("leave-running"),
|
||||
Keep: c.Bool("keep"),
|
||||
KeepRunning: c.Bool("leave-running"),
|
||||
TCPEstablished: c.Bool("tcp-established"),
|
||||
}
|
||||
|
||||
if err := checkAllAndLatest(c); err != nil {
|
||||
|
||||
@@ -26,6 +26,10 @@ var (
|
||||
// restore --all would make more sense if there would be
|
||||
// dedicated state for container which are checkpointed.
|
||||
// TODO: add ContainerStateCheckpointed
|
||||
cli.BoolFlag{
|
||||
Name: "tcp-established",
|
||||
Usage: "checkpoint a container with established TCP connections",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "all, a",
|
||||
Usage: "restore all checkpointed containers",
|
||||
@@ -53,16 +57,19 @@ func restoreCmd(c *cli.Context) error {
|
||||
}
|
||||
defer runtime.Shutdown(false)
|
||||
|
||||
keep := c.Bool("keep")
|
||||
options := libpod.ContainerCheckpointOptions{
|
||||
Keep: c.Bool("keep"),
|
||||
TCPEstablished: c.Bool("tcp-established"),
|
||||
}
|
||||
|
||||
if err := checkAllAndLatest(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
containers, lastError := getAllOrLatestContainers(c, runtime, libpod.ContainerStateRunning, "checkpointed")
|
||||
containers, lastError := getAllOrLatestContainers(c, runtime, libpod.ContainerStateExited, "checkpointed")
|
||||
|
||||
for _, ctr := range containers {
|
||||
if err = ctr.Restore(context.TODO(), keep); err != nil {
|
||||
if err = ctr.Restore(context.TODO(), options); err != nil {
|
||||
if lastError != nil {
|
||||
fmt.Fprintln(os.Stderr, lastError)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user