mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
libct/criu: simplify checkCriuFeatures
Since criu 2.12, rpcOpts is not needed when checking criu features. As we requires criu >= 3.0 in Checkpoint, we can remove rpcOpts. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
@@ -30,7 +30,7 @@ var criuFeatures *criurpc.CriuFeatures
|
||||
|
||||
var ErrCriuMissingFeatures = errors.New("criu is missing features")
|
||||
|
||||
func (c *Container) checkCriuFeatures(criuOpts *CriuOpts, rpcOpts *criurpc.CriuOpts, criuFeat *criurpc.CriuFeatures) error {
|
||||
func (c *Container) checkCriuFeatures(criuOpts *CriuOpts, criuFeat *criurpc.CriuFeatures) error {
|
||||
t := criurpc.CriuReqType_FEATURE_CHECK
|
||||
|
||||
// make sure the features we are looking for are really not from
|
||||
@@ -38,11 +38,7 @@ func (c *Container) checkCriuFeatures(criuOpts *CriuOpts, rpcOpts *criurpc.CriuO
|
||||
criuFeatures = nil
|
||||
|
||||
req := &criurpc.CriuReq{
|
||||
Type: &t,
|
||||
// Theoretically this should not be necessary but CRIU
|
||||
// segfaults if Opts is empty.
|
||||
// Fixed in CRIU 2.12
|
||||
Opts: rpcOpts,
|
||||
Type: &t,
|
||||
Features: criuFeat,
|
||||
}
|
||||
|
||||
@@ -397,7 +393,7 @@ func (c *Container) Checkpoint(criuOpts *CriuOpts) error {
|
||||
MemTrack: proto.Bool(true),
|
||||
}
|
||||
|
||||
if err := c.checkCriuFeatures(criuOpts, &rpcOpts, &feat); err != nil {
|
||||
if err := c.checkCriuFeatures(criuOpts, &feat); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -411,7 +407,7 @@ func (c *Container) Checkpoint(criuOpts *CriuOpts) error {
|
||||
feat := criurpc.CriuFeatures{
|
||||
LazyPages: proto.Bool(true),
|
||||
}
|
||||
if err := c.checkCriuFeatures(criuOpts, &rpcOpts, &feat); err != nil {
|
||||
if err := c.checkCriuFeatures(criuOpts, &feat); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user