Commit Graph

27 Commits

Author SHA1 Message Date
Cole Robinson
3086c7fda9 Drop python3 compat imports
We are going completely python3
2018-02-06 18:56:15 -05:00
Radostin Stoyanov
5854b7bb17 Replace "Queue" with "queue"
The Queue module has been renamed to queue in Python 3. [1]

[1] https://docs.python.org/2/library/queue.html
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
5553cbeb38 Replace ipaddr module with ipaddress
The `ipaddress` is available in Python 3.3+ [1] and backport for
Python 2 is available on PyPI [2].

The main differences between ipaddr and ipaddress are:

- ipaddress *Network classes are equivalent to the ipaddr *Network
  class counterparts with the strict flag set to True.
- ipaddress *Interface classes are equivalent to the ipaddr *Network
  class counterparts with the strict flag set to False.
- The factory functions in ipaddress were renamed to disambiguate them
  from classes.
- A few attributes were renamed to disambiguate their purpose as well.
  (eg. network -> network_address, numhosts -> num_addresses)
- A number of methods and functions which returned containers in ipaddr
  now return iterators. This includes subnets, address_exclude,
  summarize_address_range and collapse_address_list.

Another major difference is that in Python 2 the `ipaddress` module
must use unicode. [3]

[1] https://www.python.org/dev/peps/pep-3144/
[2] https://pypi.python.org/pypi/ipaddress
[3] https://github.com/phihag/ipaddress
2018-02-06 18:49:17 -05:00
Radostin Stoyanov
69c84bea47 Import reduce() from functools module
The built-in function reduce() [1] has been moved in the functools
module [2] [3].

[1] https://docs.python.org/2/library/functions.html#reduce
[2] https://docs.python.org/3/library/functools.html#functools.reduce
[3] https://docs.python.org/2/library/functools.html#functools.reduce
2017-10-20 13:18:31 -04:00
Pavel Hrdina
f1976155cd sshtunnels: use <listen> element to get UNIX socket for graphics
Graphics devices has a new XML element to configure UNIX socket path:

  <graphics type='vnc' socket='/path/to/socket'>
    <listen type='socket' socket='/path/to/socket'/>
  </graphics>

  <graphics type='spice'>
    <listen type='socket' socket='/path/to/socket'/>
  </graphics>

and as you can see SPICE uses only the new XML element.  For VNC the
old 'socket' attribute is for backward compatibility.

In order to connect to SPICE graphics on remote host using SSH tunnel
we need to get the UNIX socket path from <listen> element.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1441127

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2017-09-09 10:11:42 +02:00
Radostin Stoyanov
b93cc3bbc9 pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit,
KeyboardInterrupt, and GeneratorExit (which is not an error and should
not normally be caught by user code). In situations where you need to
catch all “normal” errors, you can catch the base class for all normal
exceptions, Exception [2].

[1] https://docs.python.org/2/howto/doanddont.html#except
[2] https://docs.python.org/2/library/exceptions.html#Exception
2017-08-02 13:57:43 -04:00
Cole Robinson
cd0e3a897c sshtunnels: Detect listen type=none for VNC (bz 1445714)
https://bugzilla.redhat.com/show_bug.cgi?id=1445714
2017-04-27 15:29:05 -04:00
Cole Robinson
8c2adb83ae console: Error for more non-working graphical configs
- If connecting remotely but graphics has no listen address,
    like the spice GL case.
- Trying to connect to a TLS using VM over an ssh tunnel, it doesn't
    seem to work: https://bugzilla.redhat.com/show_bug.cgi?id=1320331
2016-05-18 16:57:38 -04:00
Cole Robinson
ed666b21db sshtunnels: Drop 'ext' URI handling
Never really seen it used in practice, so drop this support. Would
probably take more work to make it actually work anyways
2016-05-18 16:06:04 -04:00
Cole Robinson
0bd73da4bb sshtunnels: Remove duplicate error strings
spice can open multiple tunnels, and in certain cases we may get
multiple duplicate errors from each tunnel. Try to strip them out
2016-05-16 16:22:35 -04:00
Cole Robinson
28540b3854 sshtunnels: Clarify tunnel vs direct connect host/port 2016-05-16 14:55:45 -04:00
Cole Robinson
7cc6141618 viewer: move vm from ConnectionInfo to Viewer
I don't really like the VM in Viewer either, since it will encourage
layering violations, but it's a better fit than in ConnectionInfo
2016-05-07 18:09:24 -04:00
Cole Robinson
7e34b022af sshtunnels: Remove column indent alignment 2016-05-07 17:44:34 -04:00
Cole Robinson
0a1d22f395 console: Remove console_active check
This is largely left over from the old days when a xen VM could
start up but still take a bit of time for the allocated VNC port
to be reflected in the XML.

This may still be an issue with old old xen, but I suspect it's
not relevant for anything modern, and it causes some issues with
listen=none behavior that spice supports. Just drop it and see if
anyone complains
2016-05-02 17:19:27 -04:00
Marc-André Lureau
5c451b6401 virt-manager: connect with openGraphicsFD
This allows to connect to VM without any display listening socket, the
fd passing is done through libvirt connection.

Furthermore, since it uses unix socket, spice can use virgl locally
with texture sharing. This effectively enables spice-gtk to display
local virgl rendering.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
2016-03-09 20:25:37 -05:00
Giuseppe Scrivano
ebcb7c064c sshtunnels: fix exception when the address is not an IP
bug introduced with commit a2d453f3e2

Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1218958

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-05-06 21:27:50 +02:00
Giuseppe Scrivano
a2d453f3e2 sshtunnels: use ipaddr to check if address is loopback or unspecified
It supports IPv6 addresses written as "0::0", "0:0::0".

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2015-04-24 11:39:04 +02:00
Cole Robinson
6ecf01a3bd console: Catch and handle password auth errors (bz 1151801) 2015-04-12 14:10:45 -04:00
Cole Robinson
f013453999 sshtunnels: Don't log the SSH command over and over
Just log it once at init time
2015-04-12 12:21:38 -04:00
Cole Robinson
e2cdfd651c sshtunnels: Don't use python socket for FD we pass to spice
Since socket objects close their FD when they are garbage collected,
this seems to lead to crashes like reported here:

https://bugzilla.redhat.com/show_bug.cgi?id=1135808
2015-04-11 22:36:04 -04:00
Cole Robinson
285e345f17 viewer: Simplify tunnel handling
- Cache ginfo, since it is tied to a single viewer instance
- Always create the sshtunnels object
- Track lock state so we can make it idempotent
2015-04-11 21:39:24 -04:00
Cole Robinson
4781ad6cd6 connection: Simplify manager row 'pretty name' handling
Unify all the callers, and use some UI ellipsizing to handle
crazy long hostnames.

This drops the conn name collision prevention stuff which can be
useful when you have lots of similar connection names. But upcoming
patches will make it mostly redundant.
2015-04-11 12:57:32 -04:00
Cole Robinson
fc171fc31d connection: Bunch of minor tweaks handling TCP URIs 2015-04-11 12:08:57 -04:00
Cole Robinson
7a1b7b69e3 Drop non-ascii text from files
Seems to be tripping up coverage output on f22
2015-03-23 15:56:55 -04:00
Marc-André Lureau
5daee287d9 tunnels: do not close unowned fd
The fd is handed to spice-gtk and gtk-vnc. They will close it when no
longer needed. Double closing leads to various race issues, since the
same fd may be opened for a different usage.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1081227
2014-11-16 12:09:02 -05:00
Cole Robinson
bf6af370c6 sshtunnels: Clarify a logging message 2014-09-29 08:55:47 -04:00
Cole Robinson
6a9aa6827b console: Break out tunnel handling to its own file 2014-09-21 13:38:53 -04:00