From: Guilherme Sperb Machado Date: Fri, 3 Oct 2014 13:06:06 +0000 (+0200) Subject: small updates here and there in all three files. The X-Git-Tag: nodemanager-5.2-15~3^2 X-Git-Url: http://git.onelab.eu/?p=nodemanager.git;a=commitdiff_plain;h=8ab3434424c269cc2ec7cc47f7705099c9462117 small updates here and there in all three files. The update_ipv6addr-slivertag.py and ipv6.py were updated to support VS, since "import libvirt" raises error and fails the build on -f14. --- diff --git a/plugins/ipv6.py b/plugins/ipv6.py index a9df0e7..c97f2ff 100644 --- a/plugins/ipv6.py +++ b/plugins/ipv6.py @@ -12,7 +12,7 @@ Requirements: * The prefix specified on 'sliversipv6prefix' tag must be at least 64 It should vary between 1 and 64, since it is the minimum amount of bits to have native IPv6 auto-configuration. -* The ipv6_address on 'sliversipv6prefix' tag can be any valid IPv6 address. +* The ipv6_address in 'sliversipv6prefix' tag value can be any valid IPv6 address. E.g., 2002:1000:: or 2002:1000::1 * It is the node manager/admin responsibility to properly set the IPv6 routing, since slivers should receive/send any kind of traffic. @@ -24,11 +24,17 @@ import socket import re import tools -import libvirt import uuid -from sliver_libvirt import Sliver_Libvirt from xml.dom.minidom import parseString +# TODO: is there anything better to do if the "libvirt", "sliver_libvirt", +# and are not in place in the VS distro? +try: + import libvirt + from sliver_libvirt import Sliver_Libvirt +except: + logger.log("Could not import 'sliver_lxc' or 'libvirt'.") + priority=4 radvd_conf_file = '/etc/radvd.conf' diff --git a/plugins/update_ipv6addr_slivertag.py b/plugins/update_ipv6addr_slivertag.py index 859b13d..ccf9490 100644 --- a/plugins/update_ipv6addr_slivertag.py +++ b/plugins/update_ipv6addr_slivertag.py @@ -11,11 +11,17 @@ import socket import re import tools -import libvirt import uuid -from sliver_libvirt import Sliver_Libvirt from xml.dom.minidom import parseString +# TODO: is there anything better to do if the "libvirt", "sliver_libvirt", +# and are not in place in the VS distro? +try: + import libvirt + from sliver_libvirt import Sliver_Libvirt +except: + logger.log("Could not import 'sliver_lxc' or 'libvirt'.") + priority=150 ipv6addrtag = 'ipv6_address' @@ -31,6 +37,10 @@ def get_sliver_tag_id_value(slivertags): def SetSliverTag(plc, data, tagname): + virt=tools.get_node_virt() + if virt!='lxc': + return + for slice in data['slivers']: logger.log("update_ipv6addr_slivertag: starting with slice=%s" % (slice['name']) ) diff --git a/tools.py b/tools.py index 7dc2d1e..e88a1b2 100644 --- a/tools.py +++ b/tools.py @@ -236,8 +236,8 @@ def get_sliver_process(slice_name, process_cmdline): path = l.split(':')[0] comp = l.rsplit(':')[-1] slice_name_check = comp.rsplit('/')[-1] - # the lines above were added by Guilherme - # due to the ipv6 plugin requirements + # the lines below were added by Guilherme + # due to the ipv6 plugin requirements (LXC) virt=get_node_virt() if virt=='lxc': slice_name_check = slice_name_check.rsplit('.')[0]