From a64311b5ba40d31e438732979eb97cc8e94e7a6e Mon Sep 17 00:00:00 2001 From: Martin Klozik Date: Fri, 15 Jan 2016 08:06:20 +0000 Subject: 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 Reviewed-by: Maryam Tahhan Reviewed-by: Brian Castelli --- testcases/testcase.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'testcases') 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): -- cgit 1.2.3-korg