
On 09-05-2016 09:56, pvital@linux.vnet.ibm.com wrote:
From: Paulo Vital <pvital@linux.vnet.ibm.com>
Modified libvirtconnection.py to not stop Cherrypy server when not able to connect to libvirt. Now, a notification message is displayed in UI to warn user about libvirtd missing connection, making the web server available to provide the other plugins from wok.
This patch is part of the solution for Issue #201
Signed-off-by: Paulo Vital <pvital@linux.vnet.ibm.com> --- i18n.py | 2 ++ model/libvirtconnection.py | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/i18n.py b/i18n.py index db245c0..157f820 100644 --- a/i18n.py +++ b/i18n.py @@ -331,4 +331,6 @@ messages = {
"KCHLVMS0001E": _("Invalid volume group name parameter: %(name)s."),
+ "KCHCONN0001E": _("Unable to establish connection with libvirt. Please check your libvirt URI which is often defined in /etc/libvirt/libvirt.conf"), + } diff --git a/model/libvirtconnection.py b/model/libvirtconnection.py index e899a33..113378e 100644 --- a/model/libvirtconnection.py +++ b/model/libvirtconnection.py @@ -22,6 +22,7 @@ import libvirt import threading import time
+from wok.objectstore import add_notification
Paulo, I have a patch moving add_notification from objectstore to model.notifications.
from wok.utils import wok_log
@@ -101,8 +102,9 @@ class LibvirtConnection(object): "your libvirt URI which is often " "defined in " "/etc/libvirt/libvirt.conf") - cherrypy.engine.stop() - exit(1) + add_notification("KCHCONN0001E", + plugin_name="/plugins/kimchi") + return None time.sleep(2)
for name in dir(libvirt.virConnect):
-- Lucio Correia Software Engineer IBM LTC Brazil