X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tools.py;h=feb3e33ea9bfc955a39bf9057c242459104d890e;hb=89dfb68021ff0df3b8237f41981180360331125f;hp=8b4e23c7a4f2880a30e96d3312a1df0faff46994;hpb=decc019cb38701778589c311a8185b14f8e1a1a5;p=nodemanager.git diff --git a/tools.py b/tools.py index 8b4e23c..feb3e33 100644 --- a/tools.py +++ b/tools.py @@ -242,6 +242,11 @@ def get_sliver_ifconfig(slice_name, device="eth0"): side effects: adds "/usr/sbin" to sys.path """ + # See if setns is installed. If it's not then we're probably not running + # LXC. + if not os.path.exists("/usr/sbin/setns.so"): + return None + # setns is part of lxcsu and is installed to /usr/sbin if not "/usr/sbin" in sys.path: sys.path.append("/usr/sbin") @@ -252,7 +257,6 @@ def get_sliver_ifconfig(slice_name, device="eth0"): return None path = '/proc/%s/ns/net'%pid - r3 = setns.chcontext(path) result = None try: