-
Notifications
You must be signed in to change notification settings - Fork 621
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
copy: use SSHArgs if copying to a single remote host. #194
Conversation
This lets us use ControlPath with the connection, so that if a small number of copies run in parallel we can reuse the connection, rather than failing when too many connections are in flight. Signed-off-by: Mark Yen <mark.yen@suse.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks fine, except I think it would be useful to have a comment in there that explains why the single instance code path is preferable.
Do I understand correctly that this change will have no effect at all unless you also modify the MaxSessions
setting as well?
There will be some effect: |
lima-vm#194 (review) Signed-off-by: Mark Yen <mark.yen@suse.com>
Your PR description said:
which made it look like there is no effect (but I think I also remember that |
Sorry, that |
@@ -172,7 +172,7 @@ func SSHArgs(instDir string, useDotSSH bool) ([]string, error) { | |||
return nil, err | |||
} | |||
args = append(args, | |||
"-l", u.Username, // guest and host have the same username, but we should specify the username explicitly (#85) | |||
"-o", fmt.Sprintf("User=%s", u.Username), // guest and host have the same username, but we should specify the username explicitly (#85) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
scp
doesn't support -l
(that means -l limit
, Limit the used bandwidth
instead). However, both ssh
and scp
does -o User=xxx
because it's the format from ~/.ssh/config
.
lima-vm#194 (review) Signed-off-by: Mark Yen <mark.yen@suse.com>
This lets us use
ControlPath
with the connection, so that if a small number of copies run in parallel we can reuse the connection, rather than failing when too many connections are in flight. Note that this only works if there's a single remote host; if the copy involves multiple hosts (limactl copy one:/some/path two:/some/path
), the syntax does not allow for separate configuration, so we have to fall back to the old way without aControlPath
.Having too many copies in parallel will still hit any limits imposed by
MaxSessions
(default 10), at which pointscp
falls back to not using the control connection (and may hitMaxStartups
instead).