test suite reviews and discussions
 help / color / mirror / Atom feed
* [dts] [PATCH] Close host sessions if it existed after all case done
@ 2015-07-10 10:58 Yong Liu
  0 siblings, 0 replies; only message in thread
From: Yong Liu @ 2015-07-10 10:58 UTC (permalink / raw)
  To: dts

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-10 10:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-10 10:58 [dts] [PATCH] Close host sessions if it existed after all case done Yong Liu

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).