test suite reviews and discussions
 help / color / mirror / Atom feed
From: Yong Liu <yong.liu@intel.com>
To: dts@dpdk.org
Subject: [dts] [PATCH] Close host sessions if it existed after all case done
Date: Fri, 10 Jul 2015 18:58:36 +0800	[thread overview]
Message-ID: <1436525916-2147-1-git-send-email-yong.liu@intel.com> (raw)

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

Host session was created for addtional control of host crb.
Should close this session in the exit process.

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

diff --git a/framework/dut.py b/framework/dut.py
index 0f523c0..aaaaf36 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -65,7 +65,7 @@ class Dut(Crb):
         super(Dut, self).__init__(crb, serializer)
         self.NAME = 'dut'
 
-        self.host_init_flag = 0
+        self.host_init_flag = False
         self.logger = getLogger(self.NAME)
         self.session = SSHConnection(self.get_ip_address(), self.NAME,
                                      self.get_password())
@@ -93,7 +93,7 @@ class Dut(Crb):
                 self.NAME + '_host',
                 self.get_password())
             self.host_session.init_log(self.logger)
-            self.host_init_flag = 1
+            self.host_init_flag = True
 
     def change_config_option(self, target, parameter, value):
         """
@@ -849,3 +849,12 @@ class Dut(Crb):
         else:
             ports = [0, ]
         return ports[-1]
+
+    def close(self):
+        """
+        Close ssh session of DUT.
+        """
+        self.session.close()
+        self.alt_session.close()
+        if self.host_init_flag:
+            self.host_session.close()
diff --git a/framework/qemu_libvirt.py b/framework/qemu_libvirt.py
index 76626a2..339b380 100644
--- a/framework/qemu_libvirt.py
+++ b/framework/qemu_libvirt.py
@@ -502,3 +502,4 @@ class LibvirtKvm(VirtBase):
 
     def stop(self):
         self.__control_session("shutdown")
+        time.sleep(5)
diff --git a/framework/virt_base.py b/framework/virt_base.py
index 9787ed3..410bf28 100644
--- a/framework/virt_base.py
+++ b/framework/virt_base.py
@@ -346,12 +346,14 @@ class VirtBase(object):
             raise exception.VirtDutInitException(vm_dut)
             return None
 
+        self.vm_dut = vm_dut
         return vm_dut
 
     def stop(self):
         """
         Stop the VM.
         """
+        self.vm_dut.close_sessions()
         self._stop_vm()
         self.virt_pool.free_all_resource(self.vm_name)
 
diff --git a/framework/virt_dut.py b/framework/virt_dut.py
index 2ac9a1b..aa28f8b 100644
--- a/framework/virt_dut.py
+++ b/framework/virt_dut.py
@@ -316,7 +316,7 @@ class VirtDut(DPDKdut):
                 port_type = self.tester.ports_info[remotePort]['type']
                 # IXIA port should not check whether has vfs
                 if port_type != 'ixia':
-                    remoteport =  self.tester.ports_info[remotePort]['port']
+                    remoteport = self.tester.ports_info[remotePort]['port']
                     vfs = []
                     # vm_dut and tester in same dut
                     host_ip = self.crb['IP'].split(':')[0]
-- 
1.9.3

                 reply	other threads:[~2015-07-10 10:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1436525916-2147-1-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).