test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH 2/5] Change virtual machine default directory to host base_dir.
Date: Thu,  4 Jun 2015 14:28:36 +0800	[thread overview]
Message-ID: <1433399319-2314-3-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1433399319-2314-1-git-send-email-yong.liu@intel.com>

From: Marvin Liu <yong.liu@intel.com>

Add islive function in virt_base module to check whether vm is alive.

Signed-off-by: Marvin Liu <yong.liu@intel.com>

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

  parent reply	other threads:[~2015-06-04  6:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04  6:28 [dts] [PATCH 0/5] Optimize virtualization automation framework Yong Liu
2015-06-04  6:28 ` [dts] [PATCH 1/5] Add virttype parameter into virtual machine instantiation Yong Liu
2015-06-04  6:28 ` Yong Liu [this message]
2015-06-04  6:28 ` [dts] [PATCH 3/5] Optimize qemu kvm module functions and code style Yong Liu
2015-06-04  6:28 ` [dts] [PATCH 4/5] Add session close function in virt_dut module Yong Liu
2015-06-04  6:28 ` [dts] [PATCH 5/5] Support dynamic load test case in debug mode. Use can use "rerun" command to re-run the interrupted case Yong Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1433399319-2314-3-git-send-email-yong.liu@intel.com \
    --to=yong.liu@intel.com \
    --cc=dts@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).