Merge pull request #3625 from sciurus/check_nfs_usability

synced_folders/nfs: implement usable?
This commit is contained in:
Mitchell Hashimoto 2014-05-04 17:33:10 -07:00
commit fafab47178
4 changed files with 13 additions and 22 deletions

View File

@ -460,6 +460,10 @@ module Vagrant
error_key(:nfs_no_valid_ids)
end
class NFSNotSupported < VagrantError
error_key(:nfs_not_supported)
end
class NFSClientNotInstalledInGuest < VagrantError
error_key(:nfs_client_not_installed_in_guest)
end

View File

@ -513,7 +513,6 @@ module VagrantPlugins
end
end
has_nfs = false
used_guest_paths = Set.new
@__synced_folders.each do |id, options|
# If the shared folder is disabled then don't worry about validating it
@ -540,8 +539,6 @@ module VagrantPlugins
end
if options[:type] == :nfs
has_nfs = true
if options[:owner] || options[:group]
# Owner/group don't work with NFS
errors << I18n.t("vagrant.config.vm.shared_folder_nfs_owner_group",
@ -559,11 +556,6 @@ module VagrantPlugins
end
end
if has_nfs
errors << I18n.t("vagrant.config.vm.nfs_not_supported") if \
!machine.env.host.capability(:nfs_installed)
end
# Validate networks
has_fp_port_error = false
fp_used = Set.new

View File

@ -30,14 +30,9 @@ module VagrantPlugins
if !machine.config.nfs.functional
return false
end
# We don't currently support NFS on Windows
if Vagrant::Util::Platform.windows?
return false
end
# NFS is always available
true
return true if machine.env.host.capability(:nfs_installed)
return false if !raise_error
raise Vagrant::Errors::NFSNotSupported
end
def prepare(machine, folders, opts)

View File

@ -813,6 +813,12 @@ en:
No valid IDs were given to the NFS synced folder implementation to
prune. This is an internal bug with Vagrant and an issue should be
filed.
nfs_not_supported: |-
It appears your machine doesn't support NFS, or there is not an
adapter to enable NFS on this machine for Vagrant. Please verify
that `nfsd` is installed on your machine, and try again. If you're
on Windows, NFS isn't supported. If the problem persists, please
contact Vagrant support.
nfs_client_not_installed_in_guest: |-
No NFS client was detected as installed in your guest machine. This
is required for NFS synced folders to work. In addition to this, Vagrant
@ -1218,12 +1224,6 @@ en:
hostname_invalid_characters: |-
The hostname set for the VM should only contain letters, numbers,
hyphens or dots. It cannot start with a hyphen or dot.
nfs_not_supported: |-
It appears your machine doesn't support NFS, or there is not an
adapter to enable NFS on this machine for Vagrant. Please verify
that `nfsd` is installed on your machine, and try again. If you're
on Windows, NFS isn't supported. If the problem persists, please
contact Vagrant support.
network_ip_ends_in_one: |-
You assigned a static IP ending in ".1" to this machine.
This is very often used by the router and can cause the