From 44f30011b7f1e61d5a09162ac79739a27a1e1cc1 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Thu, 19 Mar 2015 00:10:44 +0300 Subject: [PATCH] Allow to specify how many compute nodes need to be used Change-Id: I84ab43437b8c67ac19042233a28c552b8586560c --- scenarios/networking/l2_dense.yaml | 21 +++++++++++++ scenarios/networking/l2_double_density.yaml | 20 ------------ shaker/engine/deploy.py | 13 +++++--- tests/test_deploy.py | 35 +++++++++++++++++++++ 4 files changed, 64 insertions(+), 25 deletions(-) create mode 100644 scenarios/networking/l2_dense.yaml delete mode 100644 scenarios/networking/l2_double_density.yaml diff --git a/scenarios/networking/l2_dense.yaml b/scenarios/networking/l2_dense.yaml new file mode 100644 index 0000000..1d541b1 --- /dev/null +++ b/scenarios/networking/l2_dense.yaml @@ -0,0 +1,21 @@ +description: + This scenario launches several pairs of VMs on pair of compute nodes. + VM are plugged into the same private network. Useful for testing performance + degradation when the number of VMs grows. + +deployment: + template: l2.hot + vm_accommodation: [pair, double_room, density: 8, compute_nodes: 2] + +execution: + size: 'quadratic_progression' + tests: + - + title: Iperf TCP test + class: iperf_graph + time: 60 + - + title: Netperf TCP_STREAM + class: netperf + method: TCP_STREAM + time: 60 diff --git a/scenarios/networking/l2_double_density.yaml b/scenarios/networking/l2_double_density.yaml deleted file mode 100644 index c2fcc3a..0000000 --- a/scenarios/networking/l2_double_density.yaml +++ /dev/null @@ -1,20 +0,0 @@ -description: - This scenario launches pairs of VMs in the same private network. Every VM is - hosted on a separate compute node. - -deployment: - template: l2.hot - vm_accommodation: [pair, double_room, density: 2] - -execution: - size: 'linear_progression' - tests: - - - title: Iperf TCP test - class: iperf_graph - time: 60 - - - title: Netperf TCP_STREAM - class: netperf - method: TCP_STREAM - time: 60 diff --git a/shaker/engine/deploy.py b/shaker/engine/deploy.py index bf9c554..214fa4d 100644 --- a/shaker/engine/deploy.py +++ b/shaker/engine/deploy.py @@ -27,12 +27,15 @@ LOG = logging.getLogger(__name__) def generate_agents(compute_nodes, vm_accommodation, unique): - cn_count = len(compute_nodes) - iterations = cn_count - + density = 1 for s in vm_accommodation: - if isinstance(s, dict) and s.get('density'): - iterations *= s.get('density') + if isinstance(s, dict): + density = s.get('density', 1) + if s.get('compute_nodes'): + compute_nodes = compute_nodes[:s.get('compute_nodes')] + + cn_count = len(compute_nodes) + iterations = cn_count * density if 'single_room' in vm_accommodation and 'pair' in vm_accommodation: iterations //= 2 diff --git a/tests/test_deploy.py b/tests/test_deploy.py index 131d450..8ba62c0 100644 --- a/tests/test_deploy.py +++ b/tests/test_deploy.py @@ -141,6 +141,41 @@ class TestDeploy(testtools.TestCase): unique) self.assertEqual(expected, actual) + def test_generate_agents_alone_single_room_compute_nodes(self): + unique = 'UU1D' + expected = { + 'UU1D_agent_0': { + 'id': 'UU1D_agent_0', + 'mode': 'alone', + 'node': 'uno'}, + 'UU1D_agent_1': { + 'id': 'UU1D_agent_1', + 'mode': 'alone', + 'node': 'duo'}, + } + actual = deploy.generate_agents(['uno', 'duo', 'tre'], + ['single_room', {'compute_nodes': 2}], + unique) + self.assertEqual(expected, actual) + + def test_generate_agents_alone_single_room_density_compute_nodes(self): + unique = 'UU1D' + expected = { + 'UU1D_agent_0': { + 'id': 'UU1D_agent_0', + 'mode': 'alone', + 'node': 'uno'}, + 'UU1D_agent_1': { + 'id': 'UU1D_agent_1', + 'mode': 'alone', + 'node': 'uno'}, + } + actual = deploy.generate_agents(['uno', 'duo', 'tre'], + ['single_room', {'compute_nodes': 1}, + {'density': 2}], + unique) + self.assertEqual(expected, actual) + def test_filter_agents_all_deployed(self): agents = { 'UU1D_agent_0': {