Remove one call to get_ssh_client() - #710
Open
mykaul wants to merge 4 commits into
Open
Conversation
mykaul
force-pushed
the
one_less_ssh_only
branch
2 times, most recently
from
April 25, 2018 07:06
652856e to
fe3baaa
Compare
Since in ssh_reachable() we already get a SSH client connection, let's save it in the (unused so far) _ssh_client var. Then reuse it, in _scp() command.
mykaul
force-pushed
the
one_less_ssh_only
branch
from
April 25, 2018 07:18
fe3baaa to
b343dfd
Compare
Author
|
ci test please |
Author
|
ci test please |
Author
|
ci please test |
Author
|
ci test please |
gbenhaim
requested changes
May 9, 2018
| password=self._spec.get('ssh-password'), | ||
| ) | ||
| if self._ssh_client is not None: | ||
| client = self._ssh_client |
Member
There was a problem hiding this comment.
Can we use the same client in multiple threads?
Member
There was a problem hiding this comment.
I think that it would be better to add try/catch when trying to get the client in _scp.
It will prevent a case where:
- You check if the vm is ssh reachable
- Something makes the vm go offline
- You call the
_scpcontext manager.
Author
There was a problem hiding this comment.
What am I supposed to do in this case? What do I do in the catch? Nothing I can do then if the VM is offline - we'll fail miserably anyway.
Member
There was a problem hiding this comment.
- You can fall back to use
libguestfs. - Print an explanation about the failure. It's better than to see the entire stack trace on screen.
Author
There was a problem hiding this comment.
We cannot use the client in different threads - it is actually closed after the SCP.
I thought libguestfs doesn't work - but I guess I could once you get your new exception in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since in ssh_reachable() we already get a SSH client connection,
let's save it in the (unused so far) _ssh_client var.
Then reuse it, in _scp() command.