-
Notifications
You must be signed in to change notification settings - Fork 949
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
Conversation
apis/server/container_bridge.go
Outdated
@@ -309,6 +309,13 @@ func (s *Server) getContainer(ctx context.Context, rw http.ResponseWriter, req * | |||
} | |||
} | |||
|
|||
if len(meta.Mounts) > 0 { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I add it.
There was a problem hiding this comment.
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.
daemon/mgr/spec_volume.go
Outdated
rootfspg := s.Linux.RootfsPropagation | ||
// Set rootfs propagation, default setting is private. | ||
switch pg { | ||
case "shared", "rshare": |
There was a problem hiding this comment.
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 Report
@@ 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
Continue to review full report at Codecov.
|
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>
Ⅰ. 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