virtManager/viewers: fix connection to remote SPICE with password

When connecting to remote SPICE we use ssh tunnel if the SPICE is
listening only on "localhost".  Our ssh tunnel scheduler uses locks
to serialize the requests for FD in order to not spam user for ssh
password.

However when the main_channel is connected and emits AUTH_ERROR
we ask user for password and request for new FD.  Unfortunately
after the new request is handled we didn't unlock the scheduler
and all other request would remain waiting for the lock.

We need to unlock every FD request for the SPICE main channel not
only the first one when the channel itself is created.

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

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2017-02-07 17:46:25 +01:00
parent 2b9d468176
commit b8dccf6aca
1 changed files with 2 additions and 1 deletions

View File

@ -562,6 +562,8 @@ class SpiceViewer(Viewer):
#####################
def _main_channel_event_cb(self, channel, event):
self._tunnels.unlock()
if event == SpiceClientGLib.ChannelEvent.CLOSED:
self._emit_disconnected()
elif event == SpiceClientGLib.ChannelEvent.ERROR_AUTH:
@ -614,7 +616,6 @@ class SpiceViewer(Viewer):
if (type(channel) == SpiceClientGLib.MainChannel and
not self._main_channel):
self._tunnels.unlock()
self._main_channel = channel
hid = self._main_channel.connect_after("channel-event",
self._main_channel_event_cb)