diff --git a/CHANGELOG.md b/CHANGELOG.md index 82f01412d..c7876f98e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ IMPROVEMENTS: - providers/virtualbox: Enable symlinks for VirtualBox 4.1. [GH-2414] - providers/virtualbox: default VM name now includes milliseconds with a random number to try to avoid conflicts in CI environments. [GH-2482] + - synced\_folders/nfs: Specify `nfs_udp` to false to disable UDP based + NFS folders. [GH-2304] BUG FIXES: diff --git a/plugins/guests/linux/cap/mount_nfs.rb b/plugins/guests/linux/cap/mount_nfs.rb index b9beaed56..fe730c0b4 100644 --- a/plugins/guests/linux/cap/mount_nfs.rb +++ b/plugins/guests/linux/cap/mount_nfs.rb @@ -20,7 +20,8 @@ module VagrantPlugins hostpath.gsub!("'", "'\\\\''") # Figure out any options - mount_opts = ["vers=#{opts[:nfs_version]}", "udp"] + mount_opts = ["vers=#{opts[:nfs_version]}"] + mount_opts << "udp" if opts[:nfs_udp] if opts[:mount_options] mount_opts = opts[:mount_options].dup end diff --git a/plugins/synced_folders/nfs/synced_folder.rb b/plugins/synced_folders/nfs/synced_folder.rb index db9aa13fe..bb4649a50 100644 --- a/plugins/synced_folders/nfs/synced_folder.rb +++ b/plugins/synced_folders/nfs/synced_folder.rb @@ -56,6 +56,7 @@ module VagrantPlugins def prepare_folder(machine, opts) opts[:map_uid] = prepare_permission(machine, :uid, opts) opts[:map_gid] = prepare_permission(machine, :gid, opts) + opts[:nfs_udp] = true if !opts.has_key?(:nfs_udp) opts[:nfs_version] ||= 3 # We use a CRC32 to generate a 32-bit checksum so that the diff --git a/website/docs/source/v2/synced-folders/nfs.html.md b/website/docs/source/v2/synced-folders/nfs.html.md index aa61c680c..f8b96bb7e 100644 --- a/website/docs/source/v2/synced-folders/nfs.html.md +++ b/website/docs/source/v2/synced-folders/nfs.html.md @@ -39,15 +39,29 @@ stop the NFS server daemon. ## Enabling NFS Synced Folders -To enable NFS, just add the `nfs: true` flag onto your synced folder: +To enable NFS, just add the `type: "nfs"` flag onto your synced folder: ```ruby Vagrant.configure("2") do |config| # ... - config.vm.synced_folder ".", "/vagrant", nfs: true + config.vm.synced_folder ".", "/vagrant", type: "nfs" end ``` If you add this to an existing Vagrantfile that has a running guest machine, be sure to `vagrant reload` to see your changes. + +## NFS Synced Folder Options + +NFS synced folders have a set of options that can be specified that are +unique to NFS. These are listed below. These options can be specified in +the final part of the `config.vm.synced_folder` definition, along with the +`type` option. + +* `nfs_udp` (boolean) - Whether or not to use UDP as the transport. UDP + is faster but has some limitations (see the NFS documentation for more + details). This defaults to true. + +* `nfs_version` (string | integer) - The NFS protocol version to use when + mounting the folder on the guest. This defaults to 3.