From: Thierry Parmentelat Date: Fri, 8 Jul 2016 12:11:28 +0000 (+0200) Subject: workaround for broken libvirt-python on f24 X-Git-Tag: nodemanager-5.2-19~2 X-Git-Url: http://git.onelab.eu/?p=nodemanager.git;a=commitdiff_plain;h=c9377d38aa7abc0ded54af1b3d7ee69b672861ef workaround for broken libvirt-python on f24 --- diff --git a/sliver_libvirt.py b/sliver_libvirt.py index e898c4b..cf6b0c2 100644 --- a/sliver_libvirt.py +++ b/sliver_libvirt.py @@ -24,12 +24,33 @@ STATES = { libvirt.VIR_DOMAIN_CRASHED: 'crashed', } -REASONS = { - libvirt.VIR_CONNECT_CLOSE_REASON_ERROR: 'Misc I/O error', - libvirt.VIR_CONNECT_CLOSE_REASON_EOF: 'End-of-file from server', - libvirt.VIR_CONNECT_CLOSE_REASON_KEEPALIVE: 'Keepalive timer triggered', - libvirt.VIR_CONNECT_CLOSE_REASON_CLIENT: 'Client requested it', -} +# with fedora24 and (broken) libvirt-python-1.3.3-3, +# the following symbols are not available +# kashyap on IRC reported that libvirt-python-1.3.5-1.fc24.x86_64 +# did not have the issue though +try: + REASONS = { + # 0 + libvirt.VIR_CONNECT_CLOSE_REASON_ERROR: 'Misc I/O error', + # 1 + libvirt.VIR_CONNECT_CLOSE_REASON_EOF: 'End-of-file from server', + # 2 + libvirt.VIR_CONNECT_CLOSE_REASON_KEEPALIVE: 'Keepalive timer triggered', + # 3 + libvirt.VIR_CONNECT_CLOSE_REASON_CLIENT: 'Client requested it', + } +except: + REASONS = { + # libvirt.VIR_CONNECT_CLOSE_REASON_ERROR + 0 : 'Misc I/O error', + # libvirt.VIR_CONNECT_CLOSE_REASON_EOF + 1 : 'End-of-file from server', + # libvirt.VIR_CONNECT_CLOSE_REASON_KEEPALIVE + 2 : 'Keepalive timer triggered', + # libvirt.VIR_CONNECT_CLOSE_REASON_CLIENT + 3 : 'Client requested it', + } + logger.log("WARNING : using hard-wired constants instead of symbolic names for CONNECT_CLOSE*") connections = dict()