Setting tag nodemanager-5.2-2
[nodemanager.git] / tools.py
index 8b4e23c..feb3e33 100644 (file)
--- 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: