From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 1DA92C55A for ; Thu, 18 Jun 2015 05:07:08 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 17 Jun 2015 20:07:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,636,1427785200"; d="scan'208";a="745553149" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by fmsmga002.fm.intel.com with ESMTP; 17 Jun 2015 20:07:08 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t5I376wF009082; Thu, 18 Jun 2015 11:07:06 +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 t5I3740S016938; Thu, 18 Jun 2015 11:07:06 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t5I373qm016934; Thu, 18 Jun 2015 11:07:03 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 18 Jun 2015 11:06:43 +0800 Message-Id: <1434596804-16846-9-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1434596804-16846-1-git-send-email-yong.liu@intel.com> References: <1434596804-16846-1-git-send-email-yong.liu@intel.com> Subject: [dts] [dts 8/9] Optimize ssh_pexpect and virt_resource module 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, 18 Jun 2015 03:07:09 -0000 From: Marvin Liu Signed-off-by: Marvin Liu diff --git a/framework/ssh_pexpect.py b/framework/ssh_pexpect.py index a474500..879b9de 100644 --- a/framework/ssh_pexpect.py +++ b/framework/ssh_pexpect.py @@ -18,8 +18,8 @@ class SSHPexpect(object): self.magic_prompt = "MAGIC PROMPT" try: self.session = pxssh.pxssh() - self.username = username self.host = host + self.username = username self.password = password if ':' in host: self.ip = host.split(':')[0] @@ -63,12 +63,13 @@ class SSHPexpect(object): if not int(ret_status): return ret else: + self.logger.error("Command: %s failure!" % command) self.logger.error(ret) - return ret_status + return int(ret_status) else: return ret - def get_session_before(self, timeout): + def get_session_before(self, timeout=15): """ Get all output before timeout """ diff --git a/framework/virt_resource.py b/framework/virt_resource.py index ce60751..b830f4e 100644 --- a/framework/virt_resource.py +++ b/framework/virt_resource.py @@ -161,6 +161,10 @@ class VirtResource(object): print "Alloc cpu request vitual machine name!!!" return cores + # if vm has been alloacted cores, just return them + if self.__vm_has_resource(vm, 'cores'): + return self.allocated_info[vm]['cores'] + if number != -1: for core in self.unused_cores: if core != -1 and number != 0: -- 1.9.3