[Kimchi-devel] [PATCH] [Kimchi 2/3] Make Cheerypy up if not able to connect to libvirt
pvital at linux.vnet.ibm.com
pvital at linux.vnet.ibm.com
Thu May 12 21:32:26 UTC 2016
From: Paulo Vital <pvital at 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 at 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..25e8d03 100644
--- a/model/libvirtconnection.py
+++ b/model/libvirtconnection.py
@@ -22,6 +22,7 @@ import libvirt
import threading
import time
+from wok.model.notifications import add_notification
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):
--
2.5.5
More information about the Kimchi-devel
mailing list