-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add ability to specify arbitrary NFS mount options per share #1029
Conversation
Additional NFS mount options are specified as an array in the Vagrantfile and they are concatenated and passed to the mount command in the guest. Attempts to address hashicorp#844 and hashicorp#929.
What it looks like in my
I chose to make the options an array because some mount options may have values and others not. |
I like the flexibility with this approach better than individual nfs options. Although, it would be cleaner to just have one nfs related symbol in the command. For example: Would this address #822 (readonly) issue as well? |
@dkingofpa Yes, you're right - it would be much nicer with just a single Also, yes, it would deal with #822, as you could simply specify the
|
I dont really know if it's off topic, but when using a vagrant VM (ubuntu based) on my osx with a nfs_share to the VM. After a certain amount of time somehow file changes made on OSX isn't sent correctly to the apache browser, it's somehow caches between the nfs_share and the browser? Does it make any sense ? |
I maintain a number of projects that wrap around Vagrant, and I'd love to see this get in. Essentially, I need to be able to set 'no_root_squash' in order that I be able to 'chown' files in NFS shared folders from within the VM. @dansimau Does your current pull request support the single nfs: option discussed above? |
no_root_squash? I am running linux and it does an "all_squash". |
@ergonlogic no, sorry, I've haven't had a chance to update the pull request with the @dkingofpa's suggestions. It's not a huge change but my Ruby-fu is not great so it will probably take me longer than usual. I'll try and get to it soon unless someone wants to beat me to it. |
Instead of introducing nfs_mount_options in the Vagrantfile, just use the existing nfs option. A string or array of mount options is accepted in place of the boolean value.
Conflicts: plugins/guests/linux/guest.rb
These latest commits incorporate the changes that @dkingofpa suggested. Example Vagrantfile configurations look like: Enabling NFS with no additional options:
Enabling NFS but mounted read-only and with file attribute caching disabled:
etc. Would be happy for this to go in now. |
This looks great to me. I'm not home now but once I am I'll review this closer and merge. I'm sorry for the late response here. :) |
good changes, how can we know they get pushed? |
I really like this changes too. |
@mitchellh Any update on this? |
Any plans of merging this? |
This is a bump for merging this. |
+1 |
👍 for having this merged in Also, as a complete hack/work around for specifying additional mount options for the guest mount command you can simply append the options to the config.vm.synced_folder ".", "/vagrant", id: "vagrant-root",
nfs: true,
nfs_version: "3,nolock" |
I think it makes sense to allow to have both mount and exports options. Something like: config.vm.synced_folder ".", "/vagrant", :nfs => {
:mount_options => ['noatime'],
:exports_options => ['async'],
} What do you think? |
I agree with @p0deje, only allowing users to tweak NFS mount options fixes half of the problem. @mitchellh, any comments about this ? Would you accept a patch implementing @p0deje's suggestion ? Or is there any other points holding you back ? |
So I'm going through a bunch of NFS stuff now and want to get this all fixed up. My primary concern with this change is that it is so specific to the host system. I like @p0deje's suggestions as well. I wonder if the solution is to support this, but allow host-specific overrides:
(Vagrant already secretly supports this in various places) |
Merged this functionality in via ':mount_options' as @p0deje recommended. Next, working on NFS export options... |
Done. |
This was a good change, but the decision to break backward compatibility was unfortunate - my team has been forced to upgrade from 1.2.1 to 1.3.1 to take advantage of unrelated bugfixes, but having to also synchronize |
@alekstorm Just a reminder: http://docs.vagrantup.com/v2/installation/backwards-compatibility.html But I've typically been a bit more graceful (deprecate and warn for a release before removal). I'll make an effort to do this next time. |
on Ubuntu 12 host/Ubuntu 12 guest the following worked for me with discourse nfs_setting = RUBY_PLATFORM =~ /darwin/ || RUBY_PLATFORM =~ /linux/ note; I also had to add host IP determined by vagrant and guest IP determined by Vagrant to firewall exceptions |
Does anyone know where docs are for this? Googled to death! |
Agreed. Just made PR #5617 to add the documentation for these options. |
@jfbibeau legend! |
Additional NFS mount options are specified as an array in the Vagrantfile and they are concatenated and passed to the mount command in the guest.
This solution would address #844 and #929.