X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sliver_libvirt.py;h=cf6b0c2888397bab3daf0a90826c097cf0f446d2;hb=c9377d38aa7abc0ded54af1b3d7ee69b672861ef;hp=f62c1a7a9e0d4d1144091d559833a0a5d2410613;hpb=1942ebeacd39e2558366cd9120442b5e3c79877e;p=nodemanager.git diff --git a/sliver_libvirt.py b/sliver_libvirt.py index f62c1a7..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() @@ -168,6 +189,7 @@ class Sliver_Libvirt(Account): bwlimit.ebtables("-A INPUT -i veth{} -j mark --set-mark {}" .format(self.xid, self.xid)) + ### this is confusing, because it seems it is not used in fact def stop(self): logger.verbose('sliver_libvirt: {} stop'.format(self.name))