Merge "VM density feature"

This commit is contained in:
Jenkins 2015-03-16 20:52:41 +00:00 committed by Gerrit Code Review
commit b54f5ede47
3 changed files with 50 additions and 8 deletions

View File

@ -0,0 +1,20 @@
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

View File

@ -29,9 +29,14 @@ LOG = logging.getLogger(__name__)
def generate_agents(compute_nodes, vm_accommodation, unique):
cn_count = len(compute_nodes)
iterations = cn_count
for s in vm_accommodation:
if isinstance(s, dict) and s.get('density'):
iterations *= s.get('density')
if 'single_room' in vm_accommodation and 'pair' in vm_accommodation:
iterations //= 2
node_formulae = lambda x: compute_nodes[x % cn_count]
node_formula = lambda x: compute_nodes[x % cn_count]
agents = {}
@ -43,21 +48,21 @@ def generate_agents(compute_nodes, vm_accommodation, unique):
slave = dict(id=slave_id, mode='slave', master_id=master_id)
if 'single_room' in vm_accommodation:
master['node'] = node_formulae(i * 2)
slave['node'] = node_formulae(i * 2 + 1)
master['node'] = node_formula(i * 2)
slave['node'] = node_formula(i * 2 + 1)
elif 'double_room' in vm_accommodation:
master['node'] = node_formulae(i)
slave['node'] = node_formulae(i)
master['node'] = node_formula(i)
slave['node'] = node_formula(i)
elif 'mixed_room' in vm_accommodation:
master['node'] = node_formulae(i)
slave['node'] = node_formulae(i + 1)
master['node'] = node_formula(i)
slave['node'] = node_formula(i + 1)
agents[master['id']] = master
agents[slave['id']] = slave
else:
if 'single_room' in vm_accommodation:
agent_id = '%s_agent_%s' % (unique, i)
agents[agent_id] = dict(id=agent_id, node=node_formulae(i),
agents[agent_id] = dict(id=agent_id, node=node_formula(i),
mode='alone')
return agents

View File

@ -124,6 +124,23 @@ class TestDeploy(testtools.TestCase):
unique)
self.assertEqual(expected, actual)
def test_generate_agents_alone_single_room_double_density(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'],
['single_room', {'density': 2}],
unique)
self.assertEqual(expected, actual)
def test_filter_agents_all_deployed(self):
agents = {
'UU1D_agent_0': {