summaryrefslogtreecommitdiff
path: root/nics
diff options
context:
space:
mode:
Diffstat (limited to 'nics')
-rw-r--r--nics/net_device.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/nics/net_device.py b/nics/net_device.py
index 8a1f621..afd6036 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -864,6 +864,14 @@ def get_from_list(host, domain_id, bus_id, devfun_id):
return nic['port']
return None
+def remove_from_list(host):
+ """
+ Remove network device object from global structure
+ Parameter will by host ip
+ """
+ for nic in NICS_LIST:
+ if host == nic['host']:
+ NICS_LIST.remove(nic)
def GetNicObj(crb, domain_id, bus_id, devfun_id):
"""
@@ -896,3 +904,9 @@ def GetNicObj(crb, domain_id, bus_id, devfun_id):
add_to_list(crb.crb['My IP'], obj)
return obj
+
+def RemoveNicObj(crb):
+ """
+ Remove network device object.
+ """
+ remove_from_list(crb.crb['My IP'])