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 DE2385FEB for ; Fri, 10 Jul 2015 12:58:44 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 10 Jul 2015 03:58:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,446,1432623600"; d="scan'208";a="761884877" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by orsmga002.jf.intel.com with ESMTP; 10 Jul 2015 03:58:42 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t6AAweoj031534; Fri, 10 Jul 2015 18:58:40 +0800 Received: from shecgisg003.sh.intel.com (localhost [127.0.0.1]) by shecgisg003.sh.intel.com (8.13.6/8.13.6/SuSE Linux 0.8) with ESMTP id t6AAwcjN002183; Fri, 10 Jul 2015 18:58:40 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t6AAwcYM002179; Fri, 10 Jul 2015 18:58:38 +0800 From: Yong Liu To: dts@dpdk.org Date: Fri, 10 Jul 2015 18:58:36 +0800 Message-Id: <1436525916-2147-1-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 Subject: [dts] [PATCH] Close host sessions if it existed after all case done 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, 10 Jul 2015 10:58:45 -0000 From: Marvin Liu Host session was created for addtional control of host crb. Should close this session in the exit process. Signed-off-by: Marvin Liu diff --git a/framework/dut.py b/framework/dut.py index 0f523c0..aaaaf36 100644 --- a/framework/dut.py +++ b/framework/dut.py @@ -65,7 +65,7 @@ class Dut(Crb): super(Dut, self).__init__(crb, serializer) self.NAME = 'dut' - self.host_init_flag = 0 + self.host_init_flag = False self.logger = getLogger(self.NAME) self.session = SSHConnection(self.get_ip_address(), self.NAME, self.get_password()) @@ -93,7 +93,7 @@ class Dut(Crb): self.NAME + '_host', self.get_password()) self.host_session.init_log(self.logger) - self.host_init_flag = 1 + self.host_init_flag = True def change_config_option(self, target, parameter, value): """ @@ -849,3 +849,12 @@ class Dut(Crb): else: ports = [0, ] return ports[-1] + + def close(self): + """ + Close ssh session of DUT. + """ + self.session.close() + self.alt_session.close() + if self.host_init_flag: + self.host_session.close() diff --git a/framework/qemu_libvirt.py b/framework/qemu_libvirt.py index 76626a2..339b380 100644 --- a/framework/qemu_libvirt.py +++ b/framework/qemu_libvirt.py @@ -502,3 +502,4 @@ class LibvirtKvm(VirtBase): def stop(self): self.__control_session("shutdown") + time.sleep(5) diff --git a/framework/virt_base.py b/framework/virt_base.py index 9787ed3..410bf28 100644 --- a/framework/virt_base.py +++ b/framework/virt_base.py @@ -346,12 +346,14 @@ class VirtBase(object): raise exception.VirtDutInitException(vm_dut) return None + self.vm_dut = vm_dut return vm_dut def stop(self): """ Stop the VM. """ + self.vm_dut.close_sessions() self._stop_vm() self.virt_pool.free_all_resource(self.vm_name) diff --git a/framework/virt_dut.py b/framework/virt_dut.py index 2ac9a1b..aa28f8b 100644 --- a/framework/virt_dut.py +++ b/framework/virt_dut.py @@ -316,7 +316,7 @@ class VirtDut(DPDKdut): port_type = self.tester.ports_info[remotePort]['type'] # IXIA port should not check whether has vfs if port_type != 'ixia': - remoteport = self.tester.ports_info[remotePort]['port'] + remoteport = self.tester.ports_info[remotePort]['port'] vfs = [] # vm_dut and tester in same dut host_ip = self.crb['IP'].split(':')[0] -- 1.9.3