diff --git a/CHANGELOG.md b/CHANGELOG.md index 500e11be2..62647d87e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ BACKWARDS INCOMPATIBILITY: - `config.vm.graceful_halt_retry_*` settings are gone. Instead, a single timeout is now used to wait for a graceful halt to work, specified by `config.vm.graceful_halt_timeout`. + - The ':extra' flag to shared folders for specifying arbitrary mount + options has been replaced with the `:mount_options` flag, which is now + an array of mount options. FEATURES: diff --git a/plugins/guests/linux/cap/mount_nfs.rb b/plugins/guests/linux/cap/mount_nfs.rb index 1abee3bdf..33e9fd798 100644 --- a/plugins/guests/linux/cap/mount_nfs.rb +++ b/plugins/guests/linux/cap/mount_nfs.rb @@ -18,8 +18,14 @@ module VagrantPlugins # Mount hostpath = opts[:hostpath].dup hostpath.gsub!("'", "'\\\\''") - mount_command = "mount -o udp,vers=#{opts[:nfs_version]} #{ip}:'#{hostpath}' #{expanded_guest_path}" + # Figure out any options + mount_opts = ["vers=#{opts[:nfs_version]}", "udp"] + if opts[:mount_options] + mount_opts = opts[:mount_options].dup + end + + mount_command = "mount -o '#{mount_opts.join(",")}' #{ip}:'#{hostpath}' #{expanded_guest_path}" retryable(:on => Vagrant::Errors::LinuxNFSMountFailed, :tries => 5, :sleep => 2) do machine.communicate.sudo(mount_command, :error_class => Vagrant::Errors::LinuxNFSMountFailed) diff --git a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb index 0c04d5f6b..25119571a 100644 --- a/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/linux/cap/mount_virtualbox_shared_folder.rb @@ -8,7 +8,10 @@ module VagrantPlugins # Determine the permission string to attach to the mount command mount_options = "-o uid=`id -u #{options[:owner]}`,gid=`getent group #{options[:group]} | cut -d: -f3`" - mount_options += ",#{options[:extra]}" if options[:extra] + if options[:mount_options] + mount_options += ",#{options[:mount_options].join(",")}" + end + mount_command = "mount -t vboxsf #{mount_options} #{name} #{expanded_guest_path}" # Create the guest path if it doesn't exist diff --git a/plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb index dacbee451..6ddf9d180 100644 --- a/plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/solaris/cap/mount_virtualbox_shared_folder.rb @@ -16,7 +16,10 @@ module VagrantPlugins # Mount the folder with the proper owner/group mount_options = "-o uid=`#{id_cmd} -u #{owner}`,gid=`#{id_cmd} -g #{group}`" - mount_options += ",#{options[:extra]}" if options[:extra] + if options[:mount_options] + mount_options += ",#{options[:mount_options].join(",")}" + end + machine.communicate.execute("#{machine.config.solaris.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}") # chown the folder to the proper owner/group diff --git a/plugins/guests/solaris11/cap/mount_virtualbox_shared_folder.rb b/plugins/guests/solaris11/cap/mount_virtualbox_shared_folder.rb index df0ae4af7..543350d17 100644 --- a/plugins/guests/solaris11/cap/mount_virtualbox_shared_folder.rb +++ b/plugins/guests/solaris11/cap/mount_virtualbox_shared_folder.rb @@ -20,7 +20,10 @@ module VagrantPlugins # Mount the folder with the proper owner/group mount_options = "-o uid=`#{id_cmd} -u #{owner}`,gid=`#{id_cmd} -g #{group}`" - mount_options += ",#{options[:extra]}" if options[:extra] + if options[:mount_options] + mount_options += ",#{options[:mount_options].join(",")}" + end + machine.communicate.execute("#{machine.config.solaris11.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}") # chown the folder to the proper owner/group diff --git a/plugins/kernel_v2/config/vm.rb b/plugins/kernel_v2/config/vm.rb index 89978cd39..019a6e6dd 100644 --- a/plugins/kernel_v2/config/vm.rb +++ b/plugins/kernel_v2/config/vm.rb @@ -379,6 +379,10 @@ module VagrantPlugins :path => options[:hostpath]) end end + + if options[:mount_options] && !options[:mount_options].is_a?(Array) + errors << I18n.t("vagrant.config.vm.shared_folder_mount_options_array") + end end if has_nfs diff --git a/templates/locales/en.yml b/templates/locales/en.yml index b23e09fd9..961b9d3e9 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -719,6 +719,9 @@ en: shared_folder_nfs_owner_group: |- Shared folder that have NFS enabled do no support owner/group attributes. Host path: %{path} + shared_folder_mount_options_array: |- + Shared folder mount options specified by 'mount_options' must + be an array of options. #------------------------------------------------------------------------------- # Translations for commands. e.g. `vagrant x`