Vinzenz Feenstra has uploaded a new change for review.

Change subject: Speed up GetSession in LockActiveSession script
......................................................................

Speed up GetSession in LockActiveSession script

Trying to access a non-existing dbus service turns out to be very slow
which can give a very bad user experience when locking the screen as the
screen lock is executed multiple times due to an issue of detecting the
display session close event.

This patch checks for the presence of /usr/bin/loginctl to know wheter
to expect logind available or not.
If loginctl exists logind is installed and should be used.

Change-Id: Iaaf01e5c6c612178f207e3acfc877d30e0a09ec8
Bug-Url: https://bugzilla.redhat.com/1097390
Signed-off-by: Vinzenz Feenstra <[email protected]>
---
M ovirt-guest-agent/LockActiveSession.py
1 file changed, 5 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-guest-agent 
refs/changes/01/28201/1

diff --git a/ovirt-guest-agent/LockActiveSession.py 
b/ovirt-guest-agent/LockActiveSession.py
index 919e975..74079f9 100755
--- a/ovirt-guest-agent/LockActiveSession.py
+++ b/ovirt-guest-agent/LockActiveSession.py
@@ -18,6 +18,7 @@
 import dbus
 import logging
 import os
+import os.path
 
 
 class SessionWrapper(object):
@@ -88,13 +89,10 @@
 
 def GetActiveSession():
     bus = dbus.SystemBus()
-    ARGS = (('ConsoleKit', True, lambda *a: a[0]),
-            ('login1', False, SessionWrapper))
-    for args in ARGS:
-        session = GetSession(bus, *args)
-        if session:
-            break
-    return session
+    args = ('ConsoleKit', True, lambda *a: a[0])
+    if os.path.exists('/usr/bin/loginctl'):
+        args = ('login1', False, SessionWrapper)
+    return GetSession(bus, *args)
 
 
 def GetScreenSaver():


-- 
To view, visit http://gerrit.ovirt.org/28201
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iaaf01e5c6c612178f207e3acfc877d30e0a09ec8
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-guest-agent
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to