summaryrefslogtreecommitdiffstats
path: root/testcases/testcase.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2016-01-15 08:06:20 +0000
committerMaryam Tahhan <maryam.tahhan@intel.com>2016-01-21 09:41:56 +0000
commita64311b5ba40d31e438732979eb97cc8e94e7a6e (patch)
treebe89417369f5199422d0faad59f899c63c8f69d0 /testcases/testcase.py
parent0b2d023df7c2ab79a39260d85fe3c775f7d618bc (diff)
bugfix: mount hugepages for PVP and PVVP scenarios
Hugepages are used by both DPDK and Qemu. However they were mounted only in case, that OVS with DPDK support was detected. Thus code has been modified to mount hugepages in case that either DPDK usage or QEMU usage is detected. Change-Id: I662a6f0918b7b8d4fc38c2ce3d0d82bba0b8b2b0 JIRA: VSPERF-170 Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Brian Castelli <brian.castelli@spirent.com>
Diffstat (limited to 'testcases/testcase.py')
-rw-r--r--testcases/testcase.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/testcases/testcase.py b/testcases/testcase.py
index 4b2751b5..7d5162e6 100644
--- a/testcases/testcase.py
+++ b/testcases/testcase.py
@@ -1,4 +1,4 @@
-# Copyright 2015 Intel Corporation.
+# Copyright 2015-2016 Intel Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ from core.results.results_constants import ResultsConstants
import core.component_factory as component_factory
from core.loader import Loader
from tools import tasks
+from tools import hugepages
from tools.report import report
from conf import settings as S
from tools.pkt_gen.trafficgen.trafficgenhelper import TRAFFIC_DEFAULTS
@@ -43,6 +44,7 @@ class TestCase(object):
values.
:param results_dir: Where the csv formatted results are written.
"""
+ self._hugepages_mounted = False
self._logger = logging.getLogger(__name__)
self.name = cfg['Name']
self.desc = cfg.get('Description', 'No description given.')
@@ -113,6 +115,9 @@ class TestCase(object):
"""
self._logger.debug(self.name)
+ # mount hugepages if needed
+ self._mount_hugepages()
+
# copy sources of l2 forwarding tools into VM shared dir if needed
self._copy_fwd_tools_for_guest()
@@ -154,6 +159,9 @@ class TestCase(object):
if not self._vswitch_none:
vswitch_ctl.dump_vswitch_flows()
+ # umount hugepages if mounted
+ self._umount_hugepages()
+
self._logger.debug("Traffic Results:")
traffic_ctl.print_results()
@@ -222,6 +230,21 @@ class TestCase(object):
counter += 1
+ def _mount_hugepages(self):
+ """Mount hugepages if usage of DPDK or Qemu is detected
+ """
+ # hugepages are needed by DPDK and Qemu
+ if not self._hugepages_mounted and \
+ (self.deployment.count('v') or S.getValue('VSWITCH').lower().count('dpdk')):
+ hugepages.mount_hugepages()
+ self._hugepages_mounted = True
+
+ def _umount_hugepages(self):
+ """Umount hugepages if they were mounted before
+ """
+ if self._hugepages_mounted:
+ hugepages.umount_hugepages()
+ self._hugepages_mounted = False
@staticmethod
def _write_result_to_file(results, output):