aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2016-04-04 12:50:26 +0100
committerMaryam Tahhan <maryam.tahhan@intel.com>2016-04-05 12:01:22 +0000
commitea1b06e94edd6d328b6835e17b8c56cad74b4bc1 (patch)
treef92275a329eb195ec11cb4399cd0c27e5c878d57 /vnfs
parent6f38968022a7b1106015387618977de8c75bde19 (diff)
bugfix: Graceful shutdown of VMs
Cleanup phase of PVVP scenario sometimes causes server reboot. It seems, that forced kill of VMs is the root cause. So graceful shutdown of VMs was introduced. Change-Id: I427404406fd7174d2a034f3cf0b51fe0833f9ecf JIRA: VSPERF-271 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
Diffstat (limited to 'vnfs')
-rw-r--r--vnfs/qemu/qemu.py35
1 files changed, 25 insertions, 10 deletions
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py
index cb6d9ecc..ec728c5c 100644
--- a/vnfs/qemu/qemu.py
+++ b/vnfs/qemu/qemu.py
@@ -62,6 +62,10 @@ class IVnfQemu(IVnf):
else:
self._net2 = self._net2.split(',')[self._number]
+ # set guest loopback application based on VNF configuration
+ # cli option take precedence to config file values
+ self._guest_loopback = S.getValue('GUEST_LOOPBACK')[self._number]
+
name = 'Client%d' % self._number
vnc = ':%d' % self._number
@@ -116,6 +120,21 @@ class IVnfQemu(IVnf):
if self._timeout:
self._config_guest_loopback()
+ def stop(self):
+ """
+ Stops VNF instance gracefully first.
+ """
+ # exit testpmd if needed
+ if self._guest_loopback == 'testpmd':
+ self.execute_and_wait('stop', 120, "Done")
+ self.execute_and_wait('quit', 120, "bye")
+
+ # turn off VM
+ self.execute_and_wait('poweroff', 120, "Power down")
+
+ # just for case that graceful shutdown failed
+ super(IVnfQemu, self).stop()
+
# helper functions
def _login(self, timeout=120):
@@ -196,24 +215,20 @@ class IVnfQemu(IVnf):
def _config_guest_loopback(self):
"""
- Configure VM to run VNF (e.g. port forwarding application)
+ Configure VM to run VNF, e.g. port forwarding application based on the configuration
"""
- # set guest loopback application based on VNF configuration
- # cli option take precedence to config file values
- guest_loopback = S.getValue('GUEST_LOOPBACK')[self._number]
-
- if guest_loopback == 'testpmd':
+ if self._guest_loopback == 'testpmd':
self._login()
self._configure_testpmd()
- elif guest_loopback == 'l2fwd':
+ elif self._guest_loopback == 'l2fwd':
self._login()
self._configure_l2fwd()
- elif guest_loopback == 'linux_bridge':
+ elif self._guest_loopback == 'linux_bridge':
self._login()
self._configure_linux_bridge()
- elif guest_loopback != 'buildin':
+ elif self._guest_loopback != 'buildin':
self._logger.error('Unsupported guest loopback method "%s" was specified. Option'
- ' "buildin" will be used as a fallback.', guest_loopback)
+ ' "buildin" will be used as a fallback.', self._guest_loopback)
def wait(self, prompt=S.getValue('GUEST_PROMPT'), timeout=30):
super(IVnfQemu, self).wait(prompt=prompt, timeout=timeout)