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 CA650BDC2 for ; Thu, 4 Jun 2015 08:28:54 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 03 Jun 2015 23:28:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,551,1427785200"; d="scan'208";a="502536569" Received: from shvmail01.sh.intel.com ([10.239.29.42]) by FMSMGA003.fm.intel.com with ESMTP; 03 Jun 2015 23:28:53 -0700 Received: from shecgisg003.sh.intel.com (shecgisg003.sh.intel.com [10.239.29.90]) by shvmail01.sh.intel.com with ESMTP id t546SpPo018326; Thu, 4 Jun 2015 14:28:51 +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 t546SmSO002364; Thu, 4 Jun 2015 14:28:50 +0800 Received: (from yliu84x@localhost) by shecgisg003.sh.intel.com (8.13.6/8.13.6/Submit) id t546SmXH002360; Thu, 4 Jun 2015 14:28:48 +0800 From: Yong Liu To: dts@dpdk.org Date: Thu, 4 Jun 2015 14:28:36 +0800 Message-Id: <1433399319-2314-3-git-send-email-yong.liu@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1433399319-2314-1-git-send-email-yong.liu@intel.com> References: <1433399319-2314-1-git-send-email-yong.liu@intel.com> Subject: [dts] [PATCH 2/5] Change virtual machine default directory to host base_dir. 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, 04 Jun 2015 06:28:55 -0000 From: Marvin Liu Add islive function in virt_base module to check whether vm is alive. Signed-off-by: Marvin Liu diff --git a/framework/virt_base.py b/framework/virt_base.py index 12aa318..3daf42f 100644 --- a/framework/virt_base.py +++ b/framework/virt_base.py @@ -69,6 +69,8 @@ class VirtBase(object): # replace dut session self.host_session = self.host_dut.host_session self.host_logger = self.host_dut.logger + # base_dir existed for host dut has prepared it + self.host_session.send_expect("cd %s" % self.host_dut.base_dir, "# ") # init the host resouce pool for VM self.virt_pool = self.host_dut.virt_pool @@ -81,6 +83,7 @@ class VirtBase(object): self.virt_type = self.get_virt_type() self.params = [] + # default call back function is None self.callback = None @@ -141,6 +144,7 @@ class VirtBase(object): if key in param.keys(): param[key] = value return + self.params.append({key: value}) def compose_boot_param(self): @@ -193,6 +197,18 @@ class VirtBase(object): """ NotImplemented + def isalive(self): + """ + Check whether VM existed. + """ + vm_status = self.host_session.send_expect( + "ps aux | grep qemu | grep 'name %s '| grep -v grep" % self.vm_name, "# ") + + if self.vm_name in vm_status: + return True + else: + return False + def start(self): """ Start VM and instantiate the VM with VirtDut. -- 1.9.3