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

copy: use SSHArgs if copying to a single remote host. #194

Merged
merged 2 commits into from
Sep 3, 2021

Conversation

mook-as
Copy link
Contributor

@mook-as mook-as commented Sep 2, 2021

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 a ControlPath.

Having too many copies in parallel will still hit any limits imposed by MaxSessions (default 10), at which point scp falls back to not using the control connection (and may hit MaxStartups instead).

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>
Copy link
Member

@jandubois jandubois left a 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?

@mook-as
Copy link
Contributor Author

mook-as commented Sep 2, 2021

There will be some effect: MaxSessions defaults to 10. But most of the effect will be from bumping that up too.

@jandubois
Copy link
Member

There will be some effect: MaxSessions defaults to 10.

Your PR description said:

Having too many copies in parallel will still hit any limits imposed by MaxSessions (default 1),

which made it look like there is no effect (but I think I also remember that 10 is the actual default).

@mook-as
Copy link
Contributor Author

mook-as commented Sep 2, 2021

Sorry, that default 1 was a typo; fixed :)

@AkihiroSuda AkihiroSuda added this to the v0.6.2 milestone Sep 3, 2021
@@ -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)
Copy link
Member

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?

Copy link
Contributor Author

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.

@AkihiroSuda AkihiroSuda merged commit 2749877 into lima-vm:master Sep 3, 2021
loganprice pushed a commit to loganprice/lima that referenced this pull request Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants