Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

synced_folders/rsync: SSH control for faster rsync #6568

Merged
merged 1 commit into from
Nov 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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