mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00

This is an enhancement proposal for the checkpoint / restore feature of Podman that enables container migration across multiple systems with standard image distribution infrastructure. A new option `--create-image <image>` has been added to the `podman container checkpoint` command. This option tells Podman to create a container image. This is a standard image with a single layer, tar archive, that that contains all checkpoint files. This is similar to the current approach with checkpoint `--export`/`--import`. This image can be pushed to a container registry and pulled on a different system. It can also be exported locally with `podman image save` and inspected with `podman inspect`. Inspecting the image would display additional information about the host and the versions of Podman, criu, crun/runc, kernel, etc. `podman container restore` has also been extended to support image name or ID as input. Suggested-by: Adrian Reber <areber@redhat.com> Signed-off-by: Radostin Stoyanov <radostin@redhat.com>
52 lines
1.0 KiB
Go
52 lines
1.0 KiB
Go
//go:build linux
|
|
// +build linux
|
|
|
|
package criu
|
|
|
|
import (
|
|
"github.com/checkpoint-restore/go-criu/v5"
|
|
"github.com/checkpoint-restore/go-criu/v5/rpc"
|
|
|
|
"google.golang.org/protobuf/proto"
|
|
)
|
|
|
|
// MinCriuVersion for Podman at least CRIU 3.11 is required
|
|
const MinCriuVersion = 31100
|
|
|
|
// PodCriuVersion is the version of CRIU needed for
|
|
// checkpointing and restoring containers out of and into Pods.
|
|
const PodCriuVersion = 31600
|
|
|
|
// CheckForCriu uses CRIU's go bindings to check if the CRIU
|
|
// binary exists and if it at least the version Podman needs.
|
|
func CheckForCriu(version int) bool {
|
|
c := criu.MakeCriu()
|
|
result, err := c.IsCriuAtLeast(version)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
return result
|
|
}
|
|
|
|
func GetCriuVestion() (int, error) {
|
|
c := criu.MakeCriu()
|
|
return c.GetCriuVersion()
|
|
}
|
|
|
|
func MemTrack() bool {
|
|
features, err := criu.MakeCriu().FeatureCheck(
|
|
&rpc.CriuFeatures{
|
|
MemTrack: proto.Bool(true),
|
|
},
|
|
)
|
|
if err != nil {
|
|
return false
|
|
}
|
|
|
|
if features == nil || features.MemTrack == nil {
|
|
return false
|
|
}
|
|
|
|
return *features.MemTrack
|
|
}
|