From: Lijuan Tu <lijuanx.a.tu@intel.com>
To: yong.liu@intel.com, dts@dpdk.org
Cc: Lijuan Tu <lijuanx.a.tu@intel.com>
Subject: [dts] [PATCH v2]framework: Delete NetDevice object after virtual machine shutdown
Date: Mon, 14 Mar 2016 15:21:52 +0800 [thread overview]
Message-ID: <1457940112-89008-1-git-send-email-lijuanx.a.tu@intel.com> (raw)
Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
framework/virt_dut.py | 4 ++++
nics/net_device.py | 14 ++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index 9bf75dc..df6c5fd 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -39,6 +39,7 @@ from settings import NICS, LOG_NAME_SEP, get_netdev
from project_dpdk import DPDKdut
from dut import Dut
from net_device import GetNicObj
+from net_device import RemoveNicObj
class VirtDut(DPDKdut):
@@ -77,8 +78,11 @@ class VirtDut(DPDKdut):
def close(self):
if self.session:
self.session.close()
+ self.session = None
if self.alt_session:
self.alt_session.close()
+ self.alt_session = None
+ RemoveNicObj(self)
def set_nic_type(self, nic_type):
"""
diff --git a/nics/net_device.py b/nics/net_device.py
index 73750f5..49b7a91 100644
--- a/nics/net_device.py
+++ b/nics/net_device.py
@@ -830,6 +830,14 @@ def get_from_list(host, 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, bus_id, devfun_id):
"""
@@ -862,3 +870,9 @@ def GetNicObj(crb, 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'])
--
2.5.0
next reply other threads:[~2016-03-14 7:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-14 7:21 Lijuan Tu [this message]
2016-03-18 7:21 ` Liu, Yong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457940112-89008-1-git-send-email-lijuanx.a.tu@intel.com \
--to=lijuanx.a.tu@intel.com \
--cc=dts@dpdk.org \
--cc=yong.liu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).