Vinzenz Feenstra has uploaded a new change for review.
Change subject: vdsm: Delay desktop lock until we are sure it was a disconnect
......................................................................
vdsm: Delay desktop lock until we are sure it was a disconnect
This is a hack to mitigate the issue of spice-gtk not respecting the
configured secure channels. Spice-gtk is always connecting first to
a non-secure channel and the server tells the client then to connect
to a secure channel. However as a result of this we're getting events
of false positive disconnects and we need to ensure that we're really
having a disconnected client
This timer is supposed to delay the call to lock the desktop of the
guest. And only lock it, if it there was no new connect.
This is detected by the clientIp being set or not.
Change-Id: I6af5cf868dc9caaa07134b2b296d985f06cf15f2
Signed-off-by: Vinzenz Feenstra <vfeenstr(a)redhat.com>
---
M vdsm/vm.py
1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/98/13798/1
diff --git a/vdsm/vm.py b/vdsm/vm.py
index e327207..1f8fbe4 100644
--- a/vdsm/vm.py
+++ b/vdsm/vm.py
@@ -49,6 +49,8 @@
CONSOLE_DEVICES = 'console'
SMARTCARD_DEVICES = 'smartcard'
+_DESKTOP_LOCK_TIMEOUT = 2
+
"""
A module containing classes needed for VM communication.
"""
@@ -822,9 +824,24 @@
if clientIp:
self.conf['clientIp'] = clientIp
+ def _timedDesktopLock(self):
+ if not self.conf.get('clientIp', ''):
+ self.guestAgent.desktopLock()
+
def onDisconnect(self, detail=None):
- self.guestAgent.desktopLock()
self.conf['clientIp'] = ''
+ # This is a hack to mitigate the issue of spice-gtk not respecting the
+ # configured secure channels. Spice-gtk is always connecting first to
+ # a non-secure channel and the server tells the client then to connect
+ # to a secure channel. However as a result of this we're getting events
+ # of false positive disconnects and we need to ensure that we're really
+ # having a disconnected client
+ # This timer is supposed to delay the call to lock the desktop of the
+ # guest. And only lock it, if it there was no new connect.
+ # This is detected by the clientIp being set or not.
+ self._desktopLockTimer = threading.Timer(_DESKTOP_LOCK_TIMEOUT,
+ self._timedDesktopLock)
+ self._desktopLockTimer.start()
def _rtcUpdate(self, timeOffset):
self.log.debug('new rtc offset %s', timeOffset)
--
To view, visit
http://gerrit.ovirt.org/13798
To unsubscribe, visit
http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6af5cf868dc9caaa07134b2b296d985f06cf15f2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeenstr(a)redhat.com>