diff --git a/CHANGELOG.md b/CHANGELOG.md index 71969ff3b..2a964d332 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Fix issue where Vagrant would sometimes "lose" a VM if an exception occurred. [GH-725] - `vagrant destroy` destroys virtual machines in reverse order. [GH-739] + - Add an `fsid` option to Linux NFS exports. [GH-736] ## 0.9.7 (February 9, 2012) diff --git a/lib/vagrant/action/vm/nfs.rb b/lib/vagrant/action/vm/nfs.rb index d888a836c..8aa81d31b 100644 --- a/lib/vagrant/action/vm/nfs.rb +++ b/lib/vagrant/action/vm/nfs.rb @@ -1,3 +1,4 @@ +require 'digest/md5' require 'fileutils' require 'pathname' @@ -93,6 +94,12 @@ module Vagrant opts[:map_gid] = prepare_permission(:gid, opts) opts[:nfs_version] ||= 3 + # The poor man's UUID. An MD5 hash here is sufficient since + # we need a 32 character "uuid" to represent the filesystem + # of an export. Hashing the host path is safe because two of + # the same host path will hash to the same fsid. + opts[:uuid] = Digest::MD5.hexdigest(opts[:hostpath]) + acc[key] = opts acc end diff --git a/templates/nfs/exports_linux.erb b/templates/nfs/exports_linux.erb index d4b88d406..60b632812 100644 --- a/templates/nfs/exports_linux.erb +++ b/templates/nfs/exports_linux.erb @@ -1,5 +1,5 @@ # VAGRANT-BEGIN: <%= uuid %> <% folders.each do |name, opts| %> -"<%= opts[:hostpath] %>" <%= ip %>(rw,no_subtree_check,all_squash<% if opts[:map_uid] %>,anonuid=<%= opts[:map_uid] %><% end %><% if opts[:map_gid] %>,anongid=<%= opts[:map_gid] %><% end %>) +"<%= opts[:hostpath] %>" <%= ip %>(rw,no_subtree_check,all_squash<% if opts[:map_uid] %>,anonuid=<%= opts[:map_uid] %><% end %><% if opts[:map_gid] %>,anongid=<%= opts[:map_gid] %><% end %>,fsid=<%= opts[:uuid] %>) <% end %> # VAGRANT-END: <%= uuid %> diff --git a/vagrant.gemspec b/vagrant.gemspec index ead755bf7..605d9b6d0 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -17,11 +17,11 @@ Gem::Specification.new do |s| s.add_dependency "archive-tar-minitar", "= 0.5.2" s.add_dependency "childprocess", "~> 0.3.1" s.add_dependency "erubis", "~> 2.7.0" + s.add_dependency "i18n", "~> 0.6.0" s.add_dependency "json", "~> 1.5.1" s.add_dependency "log4r", "~> 1.1.9" s.add_dependency "net-ssh", "~> 2.2.2" s.add_dependency "net-scp", "~> 1.0.4" - s.add_dependency "i18n", "~> 0.6.0" s.add_development_dependency "rake" s.add_development_dependency "contest", ">= 0.1.2"