Reviewed-by: Paulo Ricardo Paz Vital <pvital(a)linux.vnet.ibm.com>
On Jun 23 10:50AM, Rodrigo Trujillo wrote:
When Wok starts up it loads Kimcho model, which tries to register
Libvirt events. A problem happens if Libvirt service is down when Wok
starts (usually manually/command line start up), because the connection
is None, raising an error that breaks Wok.
This patch fixes this problem and return a proper log message.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
model/libvirtevents.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/model/libvirtevents.py b/model/libvirtevents.py
index 632d399..dfd22c6 100644
--- a/model/libvirtevents.py
+++ b/model/libvirtevents.py
@@ -83,5 +83,9 @@ class LibvirtEvents(object):
self.event_enospc_cb,
libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON
)
- except libvirt.libvirtError as e:
- wok_log.error("Register of ENOSPC event failed: %s" % e.message)
+ except (libvirt.libvirtError, AttributeError) as e:
+ if type(e) == AttributeError:
+ reason = 'Libvirt service is not running'
+ else:
+ reason = e.message
+ wok_log.error("Register of ENOSPC event failed: %s" % reason)
--
2.1.0
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)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/