From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id AAD3637A4 for ; Thu, 14 Jul 2016 15:18:12 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 14 Jul 2016 06:17:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,362,1464678000"; d="scan'208";a="1021648921" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 14 Jul 2016 06:17:41 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id u6EDHdvG003442; Thu, 14 Jul 2016 21:17:39 +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 u6EDHbfc001319; Thu, 14 Jul 2016 21:17:39 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id u6EDHbDZ001315; Thu, 14 Jul 2016 21:17:37 +0800 From: Marvin Liu To: dts@dpdk.org Cc: Marvin Liu Date: Thu, 14 Jul 2016 21:17:27 +0800 Message-Id: <1468502253-1276-2-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1468502253-1276-1-git-send-email-yong.liu@intel.com> References: <1468502253-1276-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 1/7] framework: support close ssh session without logout 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: Thu, 14 Jul 2016 13:18:13 -0000 Session may not avaiable to logout like migration done. Add paramter to close connection forcely without logout action. Signed-off-by: Marvin Liu diff --git a/framework/ssh_connection.py b/framework/ssh_connection.py index 9f1aee1..edb8170 100644 --- a/framework/ssh_connection.py +++ b/framework/ssh_connection.py @@ -72,8 +72,8 @@ class SSHConnection(object): self.logger.debug(out) return out - def close(self): - self.session.close() + def close(self, force=False): + self.session.close(force) connection = {} connection[self.name] = self.session try: diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py index f0348b6..1abf8a1 100644 --- a/framework/ssh_pexpect.py +++ b/framework/ssh_pexpect.py @@ -129,9 +129,12 @@ class SSHPexpect(object): output.replace("[PEXPECT]", "") return output - def close(self): - if self.isalive(): - self.session.logout() + def close(self, force=False): + if force is True: + self.session.close() + else: + if self.isalive(): + self.session.logout() def isalive(self): return self.session.isalive() diff --git a/framework/virt_dut.py b/framework/virt_dut.py index cc86827..0010e08 100644 --- a/framework/virt_dut.py +++ b/framework/virt_dut.py @@ -75,12 +75,12 @@ class VirtDut(DPDKdut): def init_log(self): self.logger.config_suite(self.host_dut.test_classname, 'virtdut') - def close(self): + def close(self, force=False): if self.session: - self.session.close() + self.session.close(force) self.session = None if self.alt_session: - self.alt_session.close() + self.alt_session.close(force) self.alt_session = None RemoveNicObj(self) -- 1.9.3