[Kimchi-devel] [PATCH][Kimchi] Remove notification message if Libvirt is back
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Sat May 28 22:10:29 UTC 2016
If libvirt service stops and back again, the UI keeps showing the
notification message until user clicks on 'X' (close) button.
To avoid the wrong message, kimchi will remove the notification in
backend as soon as it notice that Libvirt is up and running.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
model/libvirtconnection.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/model/libvirtconnection.py b/model/libvirtconnection.py
index d11b8a6..d7c74bc 100644
--- a/model/libvirtconnection.py
+++ b/model/libvirtconnection.py
@@ -21,7 +21,8 @@ import libvirt
import threading
import time
-from wok.model.notifications import add_notification
+from wok.model.notifications import add_notification, del_notification
+from wok.model.notifications import notificationsStore
from wok.utils import wok_log
from wok.plugins.kimchi.utils import is_libvirtd_up
@@ -90,6 +91,12 @@ class LibvirtConnection(object):
wok_log.error('Libvirt service is not active.')
add_notification('KCHCONN0002E', plugin_name='/plugins/kimchi')
return None
+ elif (notificationsStore.get('KCHCONN0002E') is not None):
+ try:
+ del_notification('KCHCONN0002E')
+ except:
+ # If notification was not found, just ignore
+ pass
with LibvirtConnection._connectionLock:
conn = self._connections.get(conn_id)
--
2.1.0
More information about the Kimchi-devel
mailing list