Hi,

with the attached patch lxc-device can move a wireless device into a 
container. 

There was a related issue requesting this feature from lxc.conf 
https://github.com/lxc/lxc/issues/52

Gregor


-- 
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:[email protected]
>From 2d6c9c692386a46b9401bf36fd3a9375de618506 Mon Sep 17 00:00:00 2001
From: Gregor Beck <[email protected]>
Date: Fri, 21 Feb 2014 11:09:32 +0100
Subject: [PATCH] support lxc-device add wlan

Signed-off-by: Gregor Beck <[email protected]>
---
 src/python-lxc/lxc/__init__.py |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/src/python-lxc/lxc/__init__.py b/src/python-lxc/lxc/__init__.py
index 9eb27b6..0b982ab 100644
--- a/src/python-lxc/lxc/__init__.py
+++ b/src/python-lxc/lxc/__init__.py
@@ -160,6 +160,23 @@ class Container(_lxc.Container):
         if not self.running:
             return False
 
+
+        if os.path.exists("/sys/class/net/%s/phy80211/" % name):
+            f = open("/sys/class/net/%s/phy80211/name" % name)
+            phy = f.readline().strip()
+            f.close()
+            if subprocess.call(['iw', 'phy', phy, 'set', 'netns',
+                                str(self.init_pid)]) != 0:
+                return False
+            if destname:
+                # return subprocess.call(['ip', 'netns',
+                #                         'exec', str(self.init_pid),
+                #                         'ip', 'link', 'set',
+                #                         'dev', name,
+                #                         'name', destname]) == 0
+                return destname == name
+            return True
+
         if not destname:
             destname = name
 
-- 
1.7.9.5

_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to