From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id D4BC858D6 for ; Fri, 18 Mar 2016 08:20:36 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP; 18 Mar 2016 00:20:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,353,1455004800"; d="scan'208";a="68815367" Received: from stv-crb-56.sh.intel.com (HELO [10.239.128.116]) ([10.239.128.116]) by fmsmga004.fm.intel.com with ESMTP; 18 Mar 2016 00:20:35 -0700 Message-ID: <56EBAC89.9060605@intel.com> Date: Fri, 18 Mar 2016 15:21:45 +0800 From: "Liu, Yong" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Lijuan Tu , dts@dpdk.org References: <1457940112-89008-1-git-send-email-lijuanx.a.tu@intel.com> In-Reply-To: <1457940112-89008-1-git-send-email-lijuanx.a.tu@intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dts] [PATCH v2]framework: Delete NetDevice object after virtual machine shutdown X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Mar 2016 07:20:37 -0000 Applied. Thanks. On 03/14/2016 03:21 PM, Lijuan Tu wrote: > Signed-off-by: Lijuan Tu > --- > 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'])