Skip to content

Commit

Permalink
Merge pull request #6568 from mitchellh/b-faster-rsync
Browse files Browse the repository at this point in the history
synced_folders/rsync: SSH control for faster rsync
  • Loading branch information
mitchellh committed Nov 20, 2015
2 parents 2ade664 + 45a8a59 commit 6e6172e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions plugins/synced_folders/rsync/command/rsync_auto.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ def callback(paths, modified, added, removed)

ssh_info = opts[:machine].ssh_info
begin
start = Time.now
RsyncHelper.rsync_single(opts[:machine], ssh_info, opts[:opts])
finish = Time.now
@logger.info("Time spent in rsync: #{finish-start} (in seconds)")
rescue Vagrant::Errors::MachineGuestNotReady
# Error communicating to the machine, probably a reload or
# halt is happening. Just notify the user but don't fail out.
Expand Down
8 changes: 8 additions & 0 deletions plugins/synced_folders/rsync/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,17 @@ def self.rsync_single(machine, ssh_info, opts)
proxy_command = "-o ProxyCommand='#{ssh_info[:proxy_command]}' "
end

# Create the path for the control sockets. We used to do this
# in the machine data dir but this can result in paths that are
# too long for unix domain sockets.
controlpath = File.join(Dir.tmpdir, "ssh.#{rand(1000)}")

rsh = [
"ssh -p #{ssh_info[:port]} " +
proxy_command +
"-o ControlMaster=auto " +
"-o ControlPath=#{controlpath} " +
"-o ControlPersist=10m " +
"-o StrictHostKeyChecking=no " +
"-o IdentitiesOnly=true " +
"-o UserKnownHostsFile=/dev/null",
Expand Down

0 comments on commit 6e6172e

Please sign in to comment.