diff --git a/checkpoint.go b/checkpoint.go index 740650bc..5b473098 100644 --- a/checkpoint.go +++ b/checkpoint.go @@ -9,6 +9,7 @@ import ( "strconv" "strings" + criu "github.com/checkpoint-restore/go-criu/v4/rpc" "github.com/opencontainers/runc/libcontainer" "github.com/opencontainers/runc/libcontainer/system" "github.com/opencontainers/runtime-spec/specs-go" @@ -109,11 +110,11 @@ func setManageCgroupsMode(context *cli.Context, options *libcontainer.CriuOpts) if cgOpt := context.String("manage-cgroups-mode"); cgOpt != "" { switch cgOpt { case "soft": - options.ManageCgroupsMode = libcontainer.CRIU_CG_MODE_SOFT + options.ManageCgroupsMode = criu.CriuCgMode_SOFT case "full": - options.ManageCgroupsMode = libcontainer.CRIU_CG_MODE_FULL + options.ManageCgroupsMode = criu.CriuCgMode_FULL case "strict": - options.ManageCgroupsMode = libcontainer.CRIU_CG_MODE_STRICT + options.ManageCgroupsMode = criu.CriuCgMode_STRICT default: fatal(errors.New("Invalid manage cgroups mode")) } diff --git a/libcontainer/criu_opts_linux.go b/libcontainer/criu_opts_linux.go index 1d119246..11cbdb2d 100644 --- a/libcontainer/criu_opts_linux.go +++ b/libcontainer/criu_opts_linux.go @@ -1,14 +1,6 @@ package libcontainer -// cgroup restoring strategy provided by criu -type cgMode uint32 - -const ( - CRIU_CG_MODE_SOFT cgMode = 3 + iota // restore cgroup properties if only dir created by criu - CRIU_CG_MODE_FULL // always restore all cgroups and their properties - CRIU_CG_MODE_STRICT // restore all, requiring them to not present in the system - CRIU_CG_MODE_DEFAULT // the same as CRIU_CG_MODE_SOFT -) +import criu "github.com/checkpoint-restore/go-criu/v4/rpc" type CriuPageServerInfo struct { Address string // IP address of CRIU page server @@ -32,7 +24,7 @@ type CriuOpts struct { PreDump bool // call criu predump to perform iterative checkpoint PageServer CriuPageServerInfo // allow to dump to criu page server VethPairs []VethPairName // pass the veth to criu when restore - ManageCgroupsMode cgMode // dump or restore cgroup mode + ManageCgroupsMode criu.CriuCgMode // dump or restore cgroup mode EmptyNs uint32 // don't c/r properties for namespace from this mask AutoDedup bool // auto deduplication for incremental dumps LazyPages bool // restore memory pages lazily using userfaultfd