Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion shim/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (c *Container) kill(ctx context.Context) error {
return nil
}

func (c *Container) checkpoint(ctx context.Context) error {
func (c *Container) checkpoint(ctx context.Context) (retErr error) {
c.checkpointRestore.Lock()
defer c.checkpointRestore.Unlock()

Expand Down Expand Up @@ -107,6 +107,13 @@ func (c *Container) checkpoint(ctx context.Context) error {
opts.ImagePath = nodev1.SnapshotPath(c.ID())

beforeCheckpoint := time.Now()
c.setScaledDownFlag(true)
defer func() {
if retErr != nil {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retErr is always nil or am I missing something?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry i was testing something forgot to remove it.

c.setScaledDownFlag(false)
}
}()

if err := initProcess.Runtime().Checkpoint(ctx, c.ID(), opts); err != nil {
log.G(ctx).Errorf("error checkpointing container: %s", err)
b, err := os.ReadFile(path.Join(workDir, "dump.log"))
Expand Down
4 changes: 4 additions & 0 deletions shim/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ func (c *Container) setPhaseNotify(phase v1.ContainerPhase, duration time.Durati
c.sendEvent(c.Status())
}

func (c *Container) setScaledDownFlag(flag bool) {
c.scaledDown = flag
}

func (c *Container) SetSkipStart(skip bool) {
c.skipStart = skip
}
Expand Down