[Kimchi-devel] [PATCH] [Kimchi 2/3] Make Cheerypy up if not able to connect to libvirt

Paulo Ricardo Paz Vital pvital at linux.vnet.ibm.com
Mon May 9 13:48:48 UTC 2016


On May 09 10:38AM, Lucio Correia wrote:
>
>
> On 09-05-2016 09:56, pvital at linux.vnet.ibm.com wrote:
> > 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..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.
>

Yeap! I saw and reviewed it :-)
Will wait your patch be committed upstream then I send a V2 with the new import.

>
> >   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
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>

--
Paulo Ricardo Paz Vital
Linux Technology Center, IBM Systems
http://www.ibm.com/linux/ltc/




More information about the Kimchi-devel mailing list