test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [dts 8/9] Optimize ssh_pexpect and virt_resource module
Date: Thu, 18 Jun 2015 11:06:43 +0800	[thread overview]
Message-ID: <1434596804-16846-9-git-send-email-yong.liu@intel.com> (raw)
In-Reply-To: <1434596804-16846-1-git-send-email-yong.liu@intel.com>

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

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

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

  parent reply	other threads:[~2015-06-18  3:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18  3:06 [dts] [dts 0/9] Support virtual scenarios Yong Liu
2015-06-18  3:06 ` [dts] [dts 1/9] Optimize config load module with proper execption raised Yong Liu
2015-06-18  3:06 ` [dts] [dts 2/9] Implement virtual scenario module Yong Liu
2015-06-18  3:06 ` [dts] [dts 3/9] Support virtual scenario in dts main process Yong Liu
2015-06-18  3:06 ` [dts] [dts 4/9] Optimize network topology discovery routine in virtual scenario Yong Liu
2015-06-18  3:06 ` [dts] [dts 5/9] Optimize set_target function for " Yong Liu
2015-06-18  3:06 ` [dts] [dts 6/9] Support auto_map and set_target flag in vm initialization Yong Liu
2015-06-18  3:06 ` [dts] [dts 7/9] Optimize VF devices creation and network devices pass-through function Yong Liu
2015-06-18  3:06 ` Yong Liu [this message]
2015-06-18  3:06 ` [dts] [dts 9/9] Add three typical virtual scenario configuration files 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=1434596804-16846-9-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).