mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
sshtunnels: Clarify tunnel vs direct connect host/port
This commit is contained in:
parent
f628c3e266
commit
28540b3854
@ -69,24 +69,29 @@ class ConnectionInfo(object):
|
|||||||
Return True if the guest is listening on localhost, but the libvirt
|
Return True if the guest is listening on localhost, but the libvirt
|
||||||
URI doesn't give us any way to tunnel the connection
|
URI doesn't give us any way to tunnel the connection
|
||||||
"""
|
"""
|
||||||
host = self.get_conn_host()[0]
|
|
||||||
if self.need_tunnel():
|
if self.need_tunnel():
|
||||||
return False
|
return False
|
||||||
|
host, ignore, ignore = self.get_conn_host()
|
||||||
return self.transport and self._is_listen_localhost(host)
|
return self.transport and self._is_listen_localhost(host)
|
||||||
|
|
||||||
def get_conn_host(self):
|
def get_conn_host(self):
|
||||||
host = self._connhost
|
"""
|
||||||
port = self._connport
|
Return host/port/tlsport needed for direct spice/vnc connection
|
||||||
tlsport = None
|
"""
|
||||||
|
host = self.gaddr
|
||||||
if not self.need_tunnel():
|
port = self.gport
|
||||||
port = self.gport
|
tlsport = self.gtlsport
|
||||||
tlsport = self.gtlsport
|
if self._is_listen_any():
|
||||||
if not self._is_listen_any():
|
host = self._connhost
|
||||||
host = self.gaddr
|
|
||||||
|
|
||||||
return host, port, tlsport
|
return host, port, tlsport
|
||||||
|
|
||||||
|
def get_tunnel_host(self):
|
||||||
|
"""
|
||||||
|
Physical host name/port needed for ssh tunnel connection
|
||||||
|
"""
|
||||||
|
return self._connhost, self._connport
|
||||||
|
|
||||||
def logstring(self):
|
def logstring(self):
|
||||||
return ("proto=%s trans=%s connhost=%s connuser=%s "
|
return ("proto=%s trans=%s connhost=%s connuser=%s "
|
||||||
"connport=%s gaddr=%s gport=%s gtlsport=%s gsocket=%s" %
|
"connport=%s gaddr=%s gport=%s gtlsport=%s gsocket=%s" %
|
||||||
@ -202,7 +207,7 @@ def _make_ssh_command(ginfo):
|
|||||||
if not ginfo.need_tunnel():
|
if not ginfo.need_tunnel():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
host, port, ignore = ginfo.get_conn_host()
|
host, port = ginfo.get_tunnel_host()
|
||||||
|
|
||||||
# Build SSH cmd
|
# Build SSH cmd
|
||||||
argv = ["ssh", "ssh"]
|
argv = ["ssh", "ssh"]
|
||||||
|
Loading…
Reference in New Issue
Block a user