mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-05 15:37:02 +08:00
use criu cgroup mode const from go-criu
Signed-off-by: Xiaodong Liu <liuxiaodong@loongson.cn>
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
criu "github.com/checkpoint-restore/go-criu/v4/rpc"
|
||||||
"github.com/opencontainers/runc/libcontainer"
|
"github.com/opencontainers/runc/libcontainer"
|
||||||
"github.com/opencontainers/runc/libcontainer/system"
|
"github.com/opencontainers/runc/libcontainer/system"
|
||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"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 != "" {
|
if cgOpt := context.String("manage-cgroups-mode"); cgOpt != "" {
|
||||||
switch cgOpt {
|
switch cgOpt {
|
||||||
case "soft":
|
case "soft":
|
||||||
options.ManageCgroupsMode = libcontainer.CRIU_CG_MODE_SOFT
|
options.ManageCgroupsMode = criu.CriuCgMode_SOFT
|
||||||
case "full":
|
case "full":
|
||||||
options.ManageCgroupsMode = libcontainer.CRIU_CG_MODE_FULL
|
options.ManageCgroupsMode = criu.CriuCgMode_FULL
|
||||||
case "strict":
|
case "strict":
|
||||||
options.ManageCgroupsMode = libcontainer.CRIU_CG_MODE_STRICT
|
options.ManageCgroupsMode = criu.CriuCgMode_STRICT
|
||||||
default:
|
default:
|
||||||
fatal(errors.New("Invalid manage cgroups mode"))
|
fatal(errors.New("Invalid manage cgroups mode"))
|
||||||
}
|
}
|
||||||
|
@@ -1,14 +1,6 @@
|
|||||||
package libcontainer
|
package libcontainer
|
||||||
|
|
||||||
// cgroup restoring strategy provided by criu
|
import criu "github.com/checkpoint-restore/go-criu/v4/rpc"
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
type CriuPageServerInfo struct {
|
type CriuPageServerInfo struct {
|
||||||
Address string // IP address of CRIU page server
|
Address string // IP address of CRIU page server
|
||||||
@@ -32,7 +24,7 @@ type CriuOpts struct {
|
|||||||
PreDump bool // call criu predump to perform iterative checkpoint
|
PreDump bool // call criu predump to perform iterative checkpoint
|
||||||
PageServer CriuPageServerInfo // allow to dump to criu page server
|
PageServer CriuPageServerInfo // allow to dump to criu page server
|
||||||
VethPairs []VethPairName // pass the veth to criu when restore
|
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
|
EmptyNs uint32 // don't c/r properties for namespace from this mask
|
||||||
AutoDedup bool // auto deduplication for incremental dumps
|
AutoDedup bool // auto deduplication for incremental dumps
|
||||||
LazyPages bool // restore memory pages lazily using userfaultfd
|
LazyPages bool // restore memory pages lazily using userfaultfd
|
||||||
|
Reference in New Issue
Block a user