[Kimchi-devel] [PATCH][Kimchi] Avoid break Wok when register events, if Libvirt is down
Rodrigo Trujillo
rodrigo.trujillo at linux.vnet.ibm.com
Wed Jun 22 20:04:23 UTC 2016
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 at linux.vnet.ibm.com>
---
model/libvirtevents.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/model/libvirtevents.py b/model/libvirtevents.py
index 632d399..cb06cf0 100644
--- a/model/libvirtevents.py
+++ b/model/libvirtevents.py
@@ -76,8 +76,13 @@ class LibvirtEvents(object):
"""
Register Libvirt IO_ERROR_REASON event to handle host ENOSPC
"""
+ libv_conn = conn.get()
+ if libv_conn is None:
+ wok_log.error("Register of ENOSPC event failed because Libvirt "
+ "service seems to be not running")
+ return
try:
- conn.get().domainEventRegisterAny(
+ libv_conn.domainEventRegisterAny(
None,
libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
self.event_enospc_cb,
--
2.1.0
More information about the Kimchi-devel
mailing list