mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
Merge pull request #3655 from kolyshkin/cpt-destroy-on-err
runc checkpoint: destroy only on success
This commit is contained in:
+7
-5
@@ -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
|
||||
@@ -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
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user