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) error_key(:nfs_no_valid_ids)
end end
class NFSNotSupported < VagrantError
error_key(:nfs_not_supported)
end
class NFSClientNotInstalledInGuest < VagrantError class NFSClientNotInstalledInGuest < VagrantError
error_key(:nfs_client_not_installed_in_guest) error_key(:nfs_client_not_installed_in_guest)
end end

View File

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

View File

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

View File

@ -813,6 +813,12 @@ en:
No valid IDs were given to the NFS synced folder implementation to 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 prune. This is an internal bug with Vagrant and an issue should be
filed. 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: |- nfs_client_not_installed_in_guest: |-
No NFS client was detected as installed in your guest machine. This 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 is required for NFS synced folders to work. In addition to this, Vagrant
@ -1218,12 +1224,6 @@ en:
hostname_invalid_characters: |- hostname_invalid_characters: |-
The hostname set for the VM should only contain letters, numbers, The hostname set for the VM should only contain letters, numbers,
hyphens or dots. It cannot start with a hyphen or dot. 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: |- network_ip_ends_in_one: |-
You assigned a static IP ending in ".1" to this machine. You assigned a static IP ending in ".1" to this machine.
This is very often used by the router and can cause the This is very often used by the router and can cause the