aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>2018-11-22 10:50:28 +0000
committerMytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>2018-11-22 12:03:53 +0000
commitd22be0ae16e1c7003b7fea0c63f42360164c62a8 (patch)
tree6d80c5841d413ac9807302f1eb0bb1be01a46417
parent289006de6407e1fdb285232bdccd995de2e182c6 (diff)
Fix OvS-DPDK context mem allocation problem
The hugepages allocated for OvS-DPDK context is not correct, thus it is causing an issue to allocate the required amount of memory for VM. JIRA: YARDSTICK-1538 Change-Id: I1a34199d4f78c999476603fa86d79ffc1fbf27c8 Signed-off-by: Mytnyk, Volodymyr <volodymyrx.mytnyk@intel.com>
-rw-r--r--yardstick/benchmark/contexts/standalone/ovs_dpdk.py16
-rw-r--r--yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py3
2 files changed, 13 insertions, 6 deletions
diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
index 42a275455..3a310f146 100644
--- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
+++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py
@@ -74,6 +74,11 @@ class OvsDpdkContext(base.Context):
self.wait_for_vswitchd = 10
super(OvsDpdkContext, self).__init__()
+ def get_dpdk_socket_mem_size(self, socket_id):
+ """Get the size of OvS DPDK socket memory (Mb)"""
+ ram = self.ovs_properties.get("ram", {})
+ return ram.get('socket_%d' % (socket_id), 2048)
+
def init(self, attrs):
"""initializes itself from the supplied arguments"""
super(OvsDpdkContext, self).init(attrs)
@@ -134,9 +139,6 @@ class OvsDpdkContext(base.Context):
if pmd_cpu_mask:
pmd_mask = pmd_cpu_mask
- socket0 = self.ovs_properties.get("ram", {}).get("socket_0", "2048")
- socket1 = self.ovs_properties.get("ram", {}).get("socket_1", "2048")
-
ovs_other_config = "ovs-vsctl {0}set Open_vSwitch . other_config:{1}"
detach_cmd = "ovs-vswitchd unix:{0}{1} --pidfile --detach --log-file={2}"
@@ -154,7 +156,9 @@ class OvsDpdkContext(base.Context):
("ovsdb-server --remote=punix:/{0}/{1} --remote=ptcp:6640"
" --pidfile --detach").format(vpath, ovs_sock_path),
ovs_other_config.format("--no-wait ", "dpdk-init=true"),
- ovs_other_config.format("--no-wait ", "dpdk-socket-mem='%s,%s'" % (socket0, socket1)),
+ ovs_other_config.format("--no-wait ", "dpdk-socket-mem='%d,%d'" % (
+ self.get_dpdk_socket_mem_size(0),
+ self.get_dpdk_socket_mem_size(1))),
lcore_mask,
detach_cmd.format(vpath, ovs_sock_path, log_path),
ovs_other_config.format("", "pmd-cpu-mask=%s" % pmd_mask),
@@ -399,7 +403,9 @@ class OvsDpdkContext(base.Context):
self.configure_nics_for_ovs_dpdk()
hp_total_mb = int(self.vm_flavor.get('ram', '4096')) * len(self.servers)
- common_utils.setup_hugepages(self.connection, hp_total_mb * 1024)
+ common_utils.setup_hugepages(self.connection, (hp_total_mb + \
+ self.get_dpdk_socket_mem_size(0) + \
+ self.get_dpdk_socket_mem_size(1)) * 1024)
self._check_hugepages()
diff --git a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
index 190e83d5f..b5051e90c 100644
--- a/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
+++ b/yardstick/tests/unit/benchmark/contexts/standalone/test_ovs_dpdk.py
@@ -430,7 +430,8 @@ class OvsDpdkContextTestCase(unittest.TestCase):
self.assertEqual([vnf_instance_2],
self.ovs_dpdk.setup_ovs_dpdk_context())
- mock_setup_hugepages.assert_called_once_with(self.ovs_dpdk.connection, 1024 * 1024)
+ mock_setup_hugepages.assert_called_once_with(self.ovs_dpdk.connection,
+ (1024 + 4096) * 1024) # ram + dpdk_socket0_mem + dpdk_socket1_mem
mock__check_hugepages.assert_called_once()
mock_create_vm.assert_called_once_with(
self.ovs_dpdk.connection, '/tmp/vm_ovs_0.xml')