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

feature: add bind mode #937

Merged
merged 1 commit into from
Mar 30, 2018
Merged

Conversation

rudyfly
Copy link
Collaborator

@rudyfly rudyfly commented Mar 21, 2018

Ⅰ. Describe what this PR did

Add bind mode, it contains:
"ro/rw/dr/rr/z/Z/nocopy/private/rprivate/slave/rslave/shared/rshared"

common mode for all bind are: "ro/rw","z/Z" will be supported later,
"dr/rr/nocopy" just for volume, dr means direct replace, rr means random replace, nocopy will be supported later.
"private/rprivate/slave/rslave/shared/rshared" just for rootfs.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how you did it

Ⅳ. Describe how to verify it

see test/cli_volume_test.go:TestVolumeBindReplaceMode

Ⅴ. Special notes for reviews

Signed-off-by: Rudy Zhang rudyflyzhang@gmail.com

@@ -309,6 +309,13 @@ func (s *Server) getContainer(ctx context.Context, rw http.ResponseWriter, req *
}
}

if len(meta.Mounts) > 0 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not think we need this judgement, the range will ignore the situation of length 0 automatically.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok

@@ -1290,3 +1348,49 @@ func checkBind(b string) ([]string, error) {

return arr, nil
}

func parseBindMode(mp *types.MountPoint, mode string) error {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am afraid that we need unit test for this function. 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ok, I add it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added unit tests. PTAL.

rootfspg := s.Linux.RootfsPropagation
// Set rootfs propagation, default setting is private.
switch pg {
case "shared", "rshare":
Copy link
Contributor

Choose a reason for hiding this comment

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

Only "shared" and "rshared" are valid?

@codecov-io
Copy link

codecov-io commented Mar 23, 2018

Codecov Report

Merging #937 into master will increase coverage by 0.2%.
The diff coverage is 19.44%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #937     +/-   ##
=========================================
+ Coverage   13.81%   14.02%   +0.2%     
=========================================
  Files         125      125             
  Lines        8395     8469     +74     
=========================================
+ Hits         1160     1188     +28     
- Misses       7135     7181     +46     
  Partials      100      100
Impacted Files Coverage Δ
daemon/mgr/spec_volume.go 0% <0%> (ø) ⬆️
cli/common_flags.go 0% <0%> (ø) ⬆️
daemon/mgr/container.go 5.21% <22.76%> (+3.15%) ⬆️

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 b06bc83...dfd00b2. Read the comment docs.

Add bind mode, it contains:
"ro/rw/dr/rr/z/Z/nocopy/private/rprivate/slave/rslave/shared/rshared"

common mode for all bind are: "ro/rw/z/Z",
"dr/rr/nocopy" just for volume,
"private/rprivate/slave/rslave/shared/rshared" just for rootfs.

Signed-off-by: Rudy Zhang <rudyflyzhang@gmail.com>
@Letty5411 Letty5411 merged commit 12435f4 into AliyunContainerService:master Mar 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants