Skip to content

task: allow to specify namespaces which are restored externally#2425

Merged
crosbymichael merged 1 commit intocontainerd:masterfrom
avagin:docker-fixes
Jul 25, 2018
Merged

task: allow to specify namespaces which are restored externally#2425
crosbymichael merged 1 commit intocontainerd:masterfrom
avagin:docker-fixes

Conversation

@avagin
Copy link
Copy Markdown
Contributor

@avagin avagin commented Jun 27, 2018

Currently, C/R in https://github.com/moby/moby is completely broken. This pr is required to fix it.

Here is an example of how entirely fix looks like:
avagin/docker-ce@911c89f

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jun 27, 2018

Codecov Report

Merging #2425 into master will increase coverage by 0.27%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2425      +/-   ##
=========================================
+ Coverage   44.73%     45%   +0.27%     
=========================================
  Files          93      92       -1     
  Lines        9501    9412      -89     
=========================================
- Hits         4250    4236      -14     
+ Misses       4566    4493      -73     
+ Partials      685     683       -2
Flag Coverage Δ
#linux 49.23% <ø> (+0.28%) ⬆️
#windows 41.3% <ø> (+0.32%) ⬆️
Impacted Files Coverage Δ
remotes/docker/resolver.go 61.11% <0%> (-0.22%) ⬇️
archive/tar.go 43.05% <0%> (-0.06%) ⬇️
oci/spec_unix.go 98.37% <0%> (-0.03%) ⬇️
mount/temp_unix.go 0% <0%> (ø) ⬆️
sys/reaper.go 0% <0%> (ø) ⬆️
images/oci/exporter.go 0% <0%> (ø) ⬆️
services/server/config.go 0% <0%> (ø) ⬆️
sys/reaper_linux.go
services/server/server.go 2.2% <0%> (+0.53%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 394784b...fc2fcf6. Read the comment docs.

@avagin
Copy link
Copy Markdown
Contributor Author

avagin commented Jun 27, 2018

Cc: @kolyshkin

Comment thread task_opts.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So, why are we using interface{} type for CheckpointTaskInfo.Options field? Wouldn't it be cleaner for it to be of runctypes.CheckpointOptions? I.e. have

// TaskInfo sets options for task creation
type TaskInfo struct {
        // Checkpoint is the Descriptor for an existing checkpoint that can be used
        // to restore a task's runtime and memory state
        Checkpoint *types.Descriptor
        // RootFS is a list of mounts to use as the task's root filesystem
        RootFS []mount.Mount
        // Options hold runtime specific settings for task creation
        Options runctypes.CheckpointOptions
}

At least this way we'll avoid doing tricks like the one in here, as well as typecasting it every time.

@kolyshkin
Copy link
Copy Markdown
Contributor

Notes

  1. this also requires some changes to moby/moby for restore to start working again
  2. statically compiled containerd then segfaults on restore for the same reason as dockerd did (see https://github.com/kolyshkin/go-tar/blob/go-1.10/README.md; should be fixed by Go 1.11)
  3. Either this repo or moby (or both?) would benefit from having tests for cpt/rst

Comment thread task_opts.go Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The word "externally" here means "external to criu". I would change it to say

... a namespace which properties are not to be restored by criu

Also maybe add that this corresponds to criu --empty-ns option.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It doesn't matter what tools are used for C/R

@avagin
Copy link
Copy Markdown
Contributor Author

avagin commented Jun 28, 2018

Either this repo or moby (or both?) would benefit from having tests for cpt/rst

Here we have a few tests:
https://github.com/containerd/containerd/blob/master/container_checkpoint_test.go

Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread task.go Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we keep this generic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can. @kolyshkin and I could not understand this trick. Could you explain its idea?

Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin Jul 9, 2018

Choose a reason for hiding this comment

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

@crosbymichael from my perspective having interface{} here makes the rest of code unnecessary complicated (with extra casts and type checks). Can you elaborate on why you want this to be of interface{} type? I could (theoretically) anticipate a C/R engine other than CRIU but practically this is too far in the future I'd care for now.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

https://github.com/google/gvisor (runsc) also has checkpoint/restore capability, and we are actively working on hooking it up to docker (i.e. fixing moby and stuff) as well. See moby/moby#37360.

So there already is another C/R engine.

@avagin avagin force-pushed the docker-fixes branch 2 times, most recently from 69278c8 to bf848ff Compare July 20, 2018 20:18
@kolyshkin
Copy link
Copy Markdown
Contributor

Is there anything needed for this PR to go through?

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

@crosbymichael crosbymichael merged commit 26e2dd6 into containerd:master Jul 25, 2018
@Ace-Tang
Copy link
Copy Markdown
Contributor

Ace-Tang commented Aug 9, 2018

Hi , @avagin , from your example fix commit, you write that

checkpoint: don't restore a container network namespace
A network namespace should not be dumped and restored, it is created by
Docker even for restored containers.

Could you tell me why criu cannot dump and restore net ns, thanks.

@kolyshkin
Copy link
Copy Markdown
Contributor

@Ace-Tang criu can dump/restore netns, but it should not in this very case.

@Ace-Tang
Copy link
Copy Markdown
Contributor

Ace-Tang commented Aug 9, 2018

Thanks for your reply, @kolyshkin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants