From: Ondrej Lichtner <olichtne(a)redhat.com>
The devices property of a Namespace should only list the mapped devices
of the namespace, I added a device_database property to access all the
devices (including unmapped).
Signed-off-by: Ondrej Lichtner <olichtne(a)redhat.com>
---
lnst/Controller/Namespace.py | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/lnst/Controller/Namespace.py b/lnst/Controller/Namespace.py
index caee05b..3f99eaa 100644
--- a/lnst/Controller/Namespace.py
+++ b/lnst/Controller/Namespace.py
@@ -56,7 +56,16 @@ class Namespace(object):
@property
def devices(self):
- """List of devices available in the Namespace"""
+ """List of mapped devices available in the
Namespace"""
+ ret = []
+ for x in self._objects.values():
+ if isinstance(x, Device) and x.netns == self:
+ ret.append(x)
+ return ret
+
+ @property
+ def device_database(self):
+ """List of all devices (including unmapped) available in the
Namespace"""
ret = []
for x in self._machine._device_database.values():
if isinstance(x, Device) and x.netns == self:
--
2.17.0