synced_folders/nfs: specify nfs_udp false to disable udp [GH-2304]

This commit is contained in:
Mitchell Hashimoto 2013-11-23 13:43:48 -08:00
parent 1b8c3b62af
commit 23bdbd6fd8
4 changed files with 21 additions and 3 deletions

View File

@ -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:

View File

@ -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

View File

@ -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

View File

@ -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.