Skip to content

Commit f611d7f

Browse files
ayushr2gvisor-bot
authored andcommitted
Add checkpointExtra and checkpointOptsExtra.
PiperOrigin-RevId: 823273040
1 parent 87373a8 commit f611d7f

File tree

5 files changed

+38
-0
lines changed

5 files changed

+38
-0
lines changed

runsc/cmd/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ go_library(
3737
"boot_impl.go",
3838
"capability.go",
3939
"checkpoint.go",
40+
"checkpoint_impl.go",
4041
"chroot.go",
4142
"cmd.go",
4243
"cpu_features.go",

runsc/cmd/checkpoint.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ type Checkpoint struct {
4545
// For example, if the checkpoint files will be stored on a network block
4646
// device, which will be detached after the checkpoint is done.
4747
direct bool
48+
49+
checkpointExtra
4850
}
4951

5052
// Name implements subcommands.Command.Name.
@@ -75,6 +77,7 @@ func (c *Checkpoint) SetFlags(f *flag.FlagSet) {
7577
// Unimplemented flags necessary for compatibility with docker.
7678
var wp string
7779
f.StringVar(&wp, "work-path", "", "ignored")
80+
c.setFlagsExtra(f)
7881
}
7982

8083
// Execute implements subcommands.Command.Execute.
@@ -109,6 +112,7 @@ func (c *Checkpoint) Execute(_ context.Context, f *flag.FlagSet, args ...any) su
109112
SaveRestoreExecTimeout: c.saveRestoreExecTimeout,
110113
SaveRestoreExecContainerID: id,
111114
}
115+
c.setCheckpointOptsExtra(&opts)
112116

113117
if err := cont.Checkpoint(conf, c.imagePath, opts); err != nil {
114118
util.Fatalf("checkpoint failed: %v", err)

runsc/cmd/checkpoint_impl.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2025 The gVisor Authors.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
//go:build !false
16+
// +build !false
17+
18+
package cmd
19+
20+
import (
21+
"gvisor.dev/gvisor/runsc/flag"
22+
"gvisor.dev/gvisor/runsc/sandbox"
23+
)
24+
25+
type checkpointExtra struct{}
26+
27+
func (c *Checkpoint) setFlagsExtra(f *flag.FlagSet) {}
28+
29+
func (c *Checkpoint) setCheckpointOptsExtra(opts *sandbox.CheckpointOpts) {}

runsc/sandbox/sandbox.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1516,6 +1516,8 @@ type CheckpointOpts struct {
15161516
SaveRestoreExecArgv string
15171517
SaveRestoreExecTimeout time.Duration
15181518
SaveRestoreExecContainerID string
1519+
1520+
checkpointOptsExtra
15191521
}
15201522

15211523
// Checkpoint sends the checkpoint call for a container in the sandbox.

runsc/sandbox/sandbox_impl.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func createSandboxProcessExtra(conf *config.Config, args *Args, cmd *exec.Cmd, d
3030
return nil
3131
}
3232

33+
type checkpointOptsExtra struct{}
34+
3335
func setCheckpointOptsImpl(conf *config.Config, imagePath string, opts CheckpointOpts, opt *control.SaveOpts) error {
3436
return setCheckpointOptsForLocalCheckpointFiles(conf, imagePath, opts, opt)
3537
}

0 commit comments

Comments
 (0)