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
Implement Mount interface using mount(8) and umount(8) #6400
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA) at https://cla.developers.google.com/. If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check the information on your CLA or see this help article on setting the email on your git commits. Once you've done that, please reply here to let us know. If you signed the CLA as a corporation, please let us know the company's name. |
70ed977
to
e8fc2fd
Compare
CLAs look good, thanks! |
I am OK with this, but there's more agreement on https://github.com/GoogleCloudPlatform/kubernetes/pull/5506/files#r27799955 that maybe the right answer is just to implement it in terms of exec, and be done with it. If we do that, we probably want to change flags into []string opts or similar. @eparis @rootfs @markturansky @vishh I can't think of any good reason NOT to convert this to exec... |
IIRC, @calfonso uncovered compilation issues with syscall.Mount in the windows build. If so, that bolsters the generic "exec" argument. |
add @eparis |
No matter what, exec(mount) or syscall.mount() is not going to work on On Mon, Apr 6, 2015 at 8:16 AM, Mark Turansky notifications@github.com
|
I would prefer not using exec mainly to avoid any possible additional On Mon, Apr 6, 2015 at 8:26 AM, Tim Hockin notifications@github.com wrote:
|
problem with |
The proposal is to encapsulte the exec() into the package, keeping a mounting is not a fast-path operation usually, so I am not too concerned On Mon, Apr 6, 2015 at 8:32 AM, Vish Kannan notifications@github.com
|
|
@vishh But it doesn't even work for everything today. We're are only specifying "nfs" as the fstype. If you were running on a kernel without nfsv4 which expected the binary nfs mount options it would fail. I don't buy the argument that performance is an issue here, the mount(8) util is basically little more than a call to mount(2) if there is no helper. And if there is a helper we would need to either just call exec or redo everything that the mount helpers do. So we are talking about an exec() syscall and a couple of stat/access syscalls on what is hopefully not tooo critical of a path, even on a quickly changing system. I'd much rather see mount(8) used in the util/mount and it take a []string as arguments... |
Thanks for the feedback, I think mount(8) makes sense. To make the interface easier to use, let's do this: Mount(source string, target string, options []string) error I'll revisit the PR. |
Don't you need a 'type' arg there? mount -t $type -o strings.Join($opts, ",") $source $path On Thu, Apr 9, 2015 at 4:24 PM, Deyuan Deng notifications@github.com
|
e8fc2fd
to
5b89c69
Compare
The latest change includes fstype. When I posted the commend, I didn't look closely at our code. Based on I've changed the interface and its implementation. Still need to convert Glusterfs. One big problem is --bind with read-only. IIRC, this will mount the fs as read/write despite of the read-only flag. A quick search gives me this solution
Anyone knows if this is still the case now? I may need to double check with that. |
AFAIK bind mounts require a remount to be made read-only. On Thu, Apr 9, 2015 at 5:59 PM, Deyuan Deng notifications@github.com
|
I think you should detect if both bind and ro are set and if so, do the two Let me know when this is ready for review. On Thu, Apr 9, 2015 at 5:59 PM, Deyuan Deng notifications@github.com
|
5b89c69
to
8e1f560
Compare
8e1f560
to
f6293d9
Compare
@thockin Ready to review. Running e2e now. |
2c7b0cd
to
a5872ab
Compare
e2e passed |
if len(fstype) > 0 { | ||
mountArgs = append(mountArgs, "-t", fstype) | ||
} | ||
if options != nil && len(options) > 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 think you just want to check for len(options) != 0, which includes nil, but also catches a non-nil but empty slice.
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
ff74878
to
2519fea
Compare
Excited for this PR 👏 |
LGTM. Although in full bikeshedding mode, I would call it "args" for unmount. As they are not the same as "options" for mount.... |
@ddysher Would you like me to do a local e2e w/ selinux enforcing? |
2519fea
to
9d41025
Compare
@ddysher the emptydir tmpfs e2e test exercises selinux when it's enforcing
|
// Unmount unmounts target with given options. | ||
func (mounter *Mounter) Unmount(target string, options []string) error { | ||
glog.V(5).Infof("Unmounting %s %v", target, options) | ||
if len(options) != 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.
Let's just nuke the argument, then. Less is more.
LGTM except remove unmount options arg |
9d41025
to
b96eb4d
Compare
b96eb4d
to
6897095
Compare
Pulling this code down for a spot check on tmpfs and selinux |
I got a clean e2e run locally of emptyDir and secrets E2Es with selinux enforcing. |
@thockin updated @pmorie thanks. I got a trouble running local e2e using vagrant (bring up machines, enable selinux, then test).. 'isup' tells me e2e cluster is up, but run test tells me it's not up. :(
|
@ddysher I have some issues with that too -- I just ran the E2Es against a local cluster (ie, running directly on my host). |
@ddysher Not everything works perfectly against a local cluster for e2e -- I've been adding skips for things that shouldn't run, etc under local because I dream of a day when you can get a nice clean green e2e run against local. |
Yeah, local e2e would be quite useful. Thanks for verifying the patch. |
I am out of office. I just had the one request (drop options on unmount). @vishh can you final-review this?
|
LGTM. |
Implement Mount interface using mount(8) and umount(8)
@ddysher Thanks for doing this, it has made my life a lot easier! |
@pmorie You are welcome! |
Forked from #6269
We have mount_linux.go which implements mount interface for Linux using syscall. But NFS implements another version of linux mouter based on exec('mount'). To make code cleaner, we should only have one implementation per platform, not for different FS.
To make syscall.Mount works on NFS, we need to pass data param, which is this PR does. We can also implement linux mounter using mount command, once for all.
Open for discussion, if it's hard to make it right, then just scratch.
@thockin @calfonso