Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runc checkpoint: destroy only on success #3655

Merged
merged 1 commit into from
Nov 22, 2022
Merged
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
12 changes: 7 additions & 5 deletions checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ checkpointed.`,
return err
}

if !(options.LeaveRunning || options.PreDump) {
// destroy container unless we tell CRIU to keep it
defer destroy(container)
}
// these are the mandatory criu options for a container
if err := setPageServer(context, options); err != nil {
return err
Expand All @@ -81,7 +77,13 @@ checkpointed.`,
if err := setEmptyNsMask(context, options); err != nil {
return err
}
return container.Checkpoint(options)

err = container.Checkpoint(options)
if err == nil && !(options.LeaveRunning || options.PreDump) {
// Destroy the container unless we tell CRIU to keep it.
destroy(container)
}
return err
},
}

Expand Down