Skip to content

Commit

Permalink
providers/virtualbox: define a sync_folders action to setup NFS
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Oct 22, 2014
1 parent 82f806f commit 7ccec33
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ BUG FIXES:
- providers/docker: Protocol is now honored in direct `ports settings.
- providers/docker: Images built using `build\_dir` will more robustly
capture the final image. [GH-4598]
- providers/docker: NFS synced folders now work. [GH-4344]
- providers/virtualbox: Show a human-friendly error if VirtualBox didn't
clean up an existing VM. [GH-4681]
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
Expand Down
10 changes: 10 additions & 0 deletions plugins/providers/virtualbox/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,16 @@ def self.action_suspend
end
end

# This is the action that is called to sync folders to a running
# machine without a reboot.
def self.action_sync_folders
Vagrant::Action::Builder.new.tap do |b|
b.use PrepareNFSValidIds
b.use SyncedFolders
b.use PrepareNFSSettings
end
end

# This action brings the machine up from nothing, including importing
# the box, configuring metadata, and booting.
def self.action_up
Expand Down
11 changes: 10 additions & 1 deletion plugins/providers/virtualbox/action/prepare_nfs_settings.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
require "vagrant/action/builtin/mixin_synced_folders"

module VagrantPlugins
module ProviderVirtualBox
module Action
class PrepareNFSSettings
include Vagrant::Action::Builtin::MixinSyncedFolders
include Vagrant::Util::Retryable

def initialize(app, env)
Expand All @@ -14,7 +17,13 @@ def call(env)

@app.call(env)

if using_nfs?
opts = {
cached: !!env[:synced_folders_cached],
config: env[:synced_folders_config],
}
folders = synced_folders(env[:machine], **opts)

if folders.has_key?(:nfs)
@logger.info("Using NFS, preparing NFS settings by reading host IP and machine IP")
add_ips_to_env!(env)
end
Expand Down

0 comments on commit 7ccec33

Please # to comment.