checkpoint: remove error message with --leave-running

If checkpointing a container with '--leave-running' runc started to
print the following message:

 ERRO[0000] container is not destroyed

The message is correct, because CRIU did not terminate the process, but
as that was requested by the user the message is wrong.

So now the container is only destroyed if the user did not specify
'--leave-running'.

Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
Adrian Reber 2020-03-17 17:17:07 +00:00 committed by Adrian Reber
parent 939cd0b734
commit 87712d288e
No known key found for this signature in database
GPG Key ID: 82C9378ED3C4906A
1 changed files with 8 additions and 1 deletions

View File

@ -62,8 +62,15 @@ checkpointed.`,
if status == libcontainer.Created || status == libcontainer.Stopped { if status == libcontainer.Created || status == libcontainer.Stopped {
fatalf("Container cannot be checkpointed in %s state", status.String()) fatalf("Container cannot be checkpointed in %s state", status.String())
} }
defer destroy(container)
options := criuOptions(context) options := criuOptions(context)
if !options.LeaveRunning || !options.PreDump {
// destroy prints out an error if we tell CRIU to
// leave the container running:
// ERRO[0000] container is not destroyed
// The message is correct, but we actually do not want
// to destroy the container in this case.
defer destroy(container)
}
// these are the mandatory criu options for a container // these are the mandatory criu options for a container
setPageServer(context, options) setPageServer(context, options)
setManageCgroupsMode(context, options) setManageCgroupsMode(context, options)