Reviewed-By: Ramon Medeiros <ramonn(a)br.ibm.com>
On 05/28/2016 07:10 PM, Rodrigo Trujillo wrote:
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(a)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)
--
Ramon Nunes Medeiros
Kimchi Developer
Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn(a)br.ibm.com