Skip to content

Conversation

@HusterWan
Copy link
Contributor

@HusterWan HusterWan commented Jun 5, 2018

Signed-off-by: Michael Wan [email protected]

Ⅰ. Describe what this PR did

Actually, the containerd support creating a container by just specifying the container rootfs, the feature is very useful when we want to take over the container created by other container hypervisor.

in order to distinguish container that created by specifying rootfs or snapshot, we add a flag RootFSProvided, when the flag set, the container is created by just specifying rootfs.

this feature is also needed by upgrade docker to PouchContainer, we must support taking over containers created by docker

we also should consider the abnormal situations like host crashed etc. so when starting a RootFSProvided container , we should check if the rootfs has mounted, if not, we must mount it.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

}

func (mgr *ContainerManager) ensureRootFSMounted(rootfs string, snapData map[string]string) error {
if rootfs == "" || snapData == nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

If it is better to use len(snapData) == 0? @HusterWan
Since snapData has possibility to be map[string]string{}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree :)

@codecov-io
Copy link

codecov-io commented Jun 5, 2018

Codecov Report

Merging #1474 into master will decrease coverage by 0.12%.
The diff coverage is 23.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1474      +/-   ##
==========================================
- Coverage   41.29%   41.17%   -0.13%     
==========================================
  Files         257      258       +1     
  Lines       16988    17038      +50     
==========================================
  Hits         7016     7016              
- Misses       9100     9145      +45     
- Partials      872      877       +5
Impacted Files Coverage Δ
daemon/mgr/container_types.go 76.11% <ø> (ø) ⬆️
pkg/mount/mount.go 0% <0%> (ø)
daemon/mgr/container.go 49.05% <19.04%> (-1.39%) ⬇️
ctrd/container.go 50% <47.05%> (-0.19%) ⬇️
ctrd/watch.go 75% <0%> (-3.13%) ⬇️
daemon/mgr/network.go 68.94% <0%> (-0.49%) ⬇️
daemon/logger/jsonfile/utils.go 73.17% <0%> (+1.62%) ⬆️

IO *containerio.IO
Spec *specs.Spec
BaseFS string
Takeover bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

More description for the whole Container struct. In addition, I wish that we could use CtrdContainer instead of Container, since we have already so many Container struct in pouchd.

Currently, with the change, this struct will handle two kinds of container, the first one is the original one, and the second is the ones from Moby and taken over by Pouch. This info is quite important to be added in the comments of this struct.

Also, every field needs comments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CtrdContainer will cause glint error: it recommands to use name Container :)

i will add more details description.

@allencloud
Copy link
Collaborator

ci/circleci: markdownlint-misspell-shellcheck — Your tests failed on CircleCI
Details

CI fails @HusterWan

BaseFS string
// Takeover specify if the containerd container is just
// taken over by pouch, not created by pouch
Takeover bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change this field. @HusterWan

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i think we can merge this pr now, and i will create a new pr to support create container by specify rootfs, WDTY?

@allencloud
Copy link
Collaborator

Please update this pull request soon, and we need to try merging this fast. @HusterWan

@HusterWan
Copy link
Contributor Author

Updated @allencloud

@HusterWan HusterWan force-pushed the master branch 3 times, most recently from 4a8b538 to 41464fa Compare June 15, 2018 02:05
@HusterWan HusterWan changed the title feature: support take over moby container feature: support creating container by only specifying rootfs Jun 15, 2018
@HusterWan HusterWan changed the title feature: support creating container by only specifying rootfs feature: support creating container by just specifying rootfs Jun 15, 2018
@allencloud
Copy link
Collaborator

LGTM

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

Labels

areas/test kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants