From 13708c39511f80aa0b428de23207e5e77c938d0b Mon Sep 17 00:00:00 2001 From: Tim Landscheidt Date: Fri, 20 Nov 2015 03:40:32 +0000 Subject: [PATCH] Add setting nfs_force_v3 to force NFS 3 Change-Id: Ie6a28e128ee06a3b2a02d0b8c83dff2b62050e26 --- Gemfile.lock | 2 +- Vagrantfile | 1 + features/config.feature | 3 +++ lib/mediawiki-vagrant/settings/definitions.rb | 6 ++++++ lib/mediawiki-vagrant/version.rb | 2 +- .../settings/definitions_spec.rb | 20 +++++++++++++++++++ 6 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0d7058935..8dbf54987 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -24,7 +24,7 @@ GIT PATH remote: . specs: - mediawiki-vagrant (0.13.2) + mediawiki-vagrant (0.14.0) GEM remote: https://rubygems.org/ diff --git a/Vagrantfile b/Vagrantfile index b0bd29890..afc19a057 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -145,6 +145,7 @@ Vagrant.configure('2') do |config| root_share_options[:type] = :nfs root_share_options[:mount_options] = ['noatime', 'rsize=32767', 'wsize=32767', 'async'] root_share_options[:mount_options] << 'fsc' if settings[:nfs_cache] + root_share_options[:mount_options] << 'vers=3' if settings[:nfs_force_v3] config.nfs.map_uid = Process.uid config.nfs.map_gid = Process.gid else diff --git a/features/config.feature b/features/config.feature index 2d002aa0d..223192369 100644 --- a/features/config.feature +++ b/features/config.feature @@ -29,6 +29,7 @@ Feature: Command line configuration | http_port | | https_port | | nfs_shares | + | nfs_force_v3 | | forward_agent | | forward_x11 | @@ -77,6 +78,7 @@ Feature: Command line configuration | https_port | 4433 | | host_ip | 0.0.0.0 | | nfs_shares | no | + | nfs_force_v3 | no | | nfs_cache | yes | | forward_agent | yes | | forward_x11 | no | @@ -90,6 +92,7 @@ Feature: Command line configuration | https_port | 4433 | | host_ip | 0.0.0.0 | | nfs_shares | no | + | nfs_force_v3 | no | | nfs_cache | yes | | forward_agent | yes | | forward_x11 | no | diff --git a/lib/mediawiki-vagrant/settings/definitions.rb b/lib/mediawiki-vagrant/settings/definitions.rb index 38917c4cd..b2952e536 100644 --- a/lib/mediawiki-vagrant/settings/definitions.rb +++ b/lib/mediawiki-vagrant/settings/definitions.rb @@ -47,6 +47,12 @@ module MediaWikiVagrant default: defined?(Vagrant::Util::Platform) ? !Vagrant::Util::Platform.windows? : true, coercion: ->(_setting, new) { !!(new.to_s =~ /^(true|t|yes|y|1)$/i) } + setting :nfs_force_v3, + description: 'Use NFS version 3', + help: "Enter 'yes' or 'no'.", + default: false, + coercion: ->(_setting, new) { !!(new.to_s =~ /^(true|t|yes|y|1)$/i) } + setting :nfs_cache, description: 'Use cachefilesd to speed up NFS file access (EXPERIMENTAL)', help: "Enter 'yes' or 'no'. If your VM is currently running, reload it after changing this setting.", diff --git a/lib/mediawiki-vagrant/version.rb b/lib/mediawiki-vagrant/version.rb index 248cebe1e..f401f2b2c 100644 --- a/lib/mediawiki-vagrant/version.rb +++ b/lib/mediawiki-vagrant/version.rb @@ -1,3 +1,3 @@ module MediaWikiVagrant - VERSION = '0.13.3' + VERSION = '0.14.0' end diff --git a/spec/mediawiki_vagrant/settings/definitions_spec.rb b/spec/mediawiki_vagrant/settings/definitions_spec.rb index c4232be5f..cfa59a00e 100644 --- a/spec/mediawiki_vagrant/settings/definitions_spec.rb +++ b/spec/mediawiki_vagrant/settings/definitions_spec.rb @@ -127,6 +127,26 @@ module MediaWikiVagrant end end + describe 'nfs_force_v3' do + subject { definitions[:nfs_force_v3] } + + context 'when a new value is set' do + it 'considers values "true", "t", "yes", "y", "1" all to be true' do + %w(true t yes y 1).each do |value| + subject.value = value + expect(subject.value).to be(true), "expected #{value} to be considered true" + end + end + + it 'considers values "false", "f", "no", "n", "0" to be false' do + %w(false f no n 0).each do |value| + subject.value = value + expect(subject.value).to be(false), "expected #{value} to be considered false" + end + end + end + end + describe 'forward_agent' do subject { definitions[:forward_agent] }