OK.
I have talked to Paulo, and this seems to be a simpler solution. Thank you.
Sending a V2
Rodrigo
On 06/23/2016 10:01 AM, Paulo Ricardo Paz Vital wrote:
On Jun 22 05:04PM, 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 | 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(
Rodrigo, the call to register a new event is in a try/exception block. So, why
not just handle the exception when conn.get() is None, instead of check if it is
None? You can only extend the current exception to use the same wok_log.error.
> None,
> libvirt.VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON,
> self.event_enospc_cb,
> --
> 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/
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel