Merge "VM density feature"
This commit is contained in:
commit
b54f5ede47
20
scenarios/networking/l2_double_density.yaml
Normal file
20
scenarios/networking/l2_double_density.yaml
Normal 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
|
@ -29,9 +29,14 @@ LOG = logging.getLogger(__name__)
|
|||||||
def generate_agents(compute_nodes, vm_accommodation, unique):
|
def generate_agents(compute_nodes, vm_accommodation, unique):
|
||||||
cn_count = len(compute_nodes)
|
cn_count = len(compute_nodes)
|
||||||
iterations = cn_count
|
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:
|
if 'single_room' in vm_accommodation and 'pair' in vm_accommodation:
|
||||||
iterations //= 2
|
iterations //= 2
|
||||||
node_formulae = lambda x: compute_nodes[x % cn_count]
|
node_formula = lambda x: compute_nodes[x % cn_count]
|
||||||
|
|
||||||
agents = {}
|
agents = {}
|
||||||
|
|
||||||
@ -43,21 +48,21 @@ def generate_agents(compute_nodes, vm_accommodation, unique):
|
|||||||
slave = dict(id=slave_id, mode='slave', master_id=master_id)
|
slave = dict(id=slave_id, mode='slave', master_id=master_id)
|
||||||
|
|
||||||
if 'single_room' in vm_accommodation:
|
if 'single_room' in vm_accommodation:
|
||||||
master['node'] = node_formulae(i * 2)
|
master['node'] = node_formula(i * 2)
|
||||||
slave['node'] = node_formulae(i * 2 + 1)
|
slave['node'] = node_formula(i * 2 + 1)
|
||||||
elif 'double_room' in vm_accommodation:
|
elif 'double_room' in vm_accommodation:
|
||||||
master['node'] = node_formulae(i)
|
master['node'] = node_formula(i)
|
||||||
slave['node'] = node_formulae(i)
|
slave['node'] = node_formula(i)
|
||||||
elif 'mixed_room' in vm_accommodation:
|
elif 'mixed_room' in vm_accommodation:
|
||||||
master['node'] = node_formulae(i)
|
master['node'] = node_formula(i)
|
||||||
slave['node'] = node_formulae(i + 1)
|
slave['node'] = node_formula(i + 1)
|
||||||
|
|
||||||
agents[master['id']] = master
|
agents[master['id']] = master
|
||||||
agents[slave['id']] = slave
|
agents[slave['id']] = slave
|
||||||
else:
|
else:
|
||||||
if 'single_room' in vm_accommodation:
|
if 'single_room' in vm_accommodation:
|
||||||
agent_id = '%s_agent_%s' % (unique, i)
|
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')
|
mode='alone')
|
||||||
|
|
||||||
return agents
|
return agents
|
||||||
|
@ -124,6 +124,23 @@ class TestDeploy(testtools.TestCase):
|
|||||||
unique)
|
unique)
|
||||||
self.assertEqual(expected, actual)
|
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):
|
def test_filter_agents_all_deployed(self):
|
||||||
agents = {
|
agents = {
|
||||||
'UU1D_agent_0': {
|
'UU1D_agent_0': {
|
||||||
|
Loading…
Reference in New Issue
Block a user