-
Notifications
You must be signed in to change notification settings - Fork 347
Get the mountInfo by 'LookupMount' in containerd #295
Conversation
|
There is something wrong in my local environment, |
| return false | ||
| } | ||
|
|
||
| //TODO: Replace with `mount.Lookup()`in containerd after #257 is marged |
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.
Why do we still need this loop?
LookupMount checks device id directly: https://github.com/containerd/containerd/blob/master/mount/lookup_unix.go
pkg/server/helpers.go
Outdated
| } | ||
|
|
||
| path := source | ||
| for { |
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.
@Random-Liu Do you mean this loop?
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.
Yeah
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.
Seems not necessary, I will remove this loop, Thanks :-)
|
Yeah
…On Sep 27, 2017 7:05 PM, "MiaoYanqiang" ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In pkg/server/helpers.go
<#295 (comment)>
:
> -//TODO: Replace with `mount.Lookup()`in containerd after #257 is marged
-func getMountInfo(mountInfos []*mount.Info, dir string) *mount.Info {
- for _, m := range mountInfos {
- if m.Mountpoint == dir {
- return m
- }
- }
- return nil
-}
-
-func getSourceMount(source string, mountInfos []*mount.Info) (string, string, error) {
- mountinfo := getMountInfo(mountInfos, source)
- if mountinfo != nil {
+func getSourceMount(source string, lookupMount func(string) (mount.Info, error)) (string, string, error) {
+ mountinfo, err := lookupMount(source)
+ if err == nil {
return source, mountinfo.Optional, nil
}
path := source
for {
@Random-Liu <https://github.com/random-liu> Do you mean this loop?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#295 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFjVu9MgpC_uxJFwfAlrk8X_ihhmRwqmks5smv7dgaJpZM4PlusT>
.
|
bb1ddde to
bcd0950
Compare
|
@Random-Liu Have updated the code based on #342, PTAL |
pkg/server/container_create.go
Outdated
| func ensureShared(path string, mountInfos []*mount.Info) error { | ||
| sourceMount, optionalOpts, err := getSourceMount(path, mountInfos) | ||
| func ensureShared(path string, lookupMount func(string) (mount.Info, error)) error { | ||
| sourceMount, optionalOpts, err := getSourceMount(path, lookupMount) |
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.
Do we still need getSourceMount? I think we could just call lookupMount directly here.
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.
Done.
pkg/server/container_create_test.go
Outdated
| "github.com/containerd/containerd/contrib/apparmor" | ||
| "github.com/containerd/containerd/contrib/seccomp" | ||
| "github.com/docker/docker/pkg/mount" | ||
| //"github.com/docker/docker/pkg/mount" |
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.
Remove the comment.
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.
Done.
|
@miaoyq LGTM overall other than the comments. |
bcd0950 to
c65921b
Compare
Signed-off-by: Yanqiang Miao <[email protected]>
|
/lgtm |
Signed-off-by: Yanqiang Miao [email protected]
Address this comment.
/cc @Random-Liu