Fix density processing

Change-Id: Idf1437fd5661d4455eb057a4a0c5631b2b517f04
This commit is contained in:
Ilya Shakhat 2015-03-24 15:23:02 +03:00
parent 82e23b123d
commit 3ed919553a
3 changed files with 11 additions and 2 deletions

View File

@ -5,7 +5,7 @@ description:
deployment:
template: l2.hot
vm_accommodation: [pair, double_room, density: 8, compute_nodes: 2]
vm_accommodation: [pair, single_room, density: 4, compute_nodes: 2]
execution:
size: 'quadratic_progression'

View File

@ -30,7 +30,8 @@ def generate_agents(compute_nodes, vm_accommodation, unique):
density = 1
for s in vm_accommodation:
if isinstance(s, dict):
density = s.get('density', 1)
if s.get('density'):
density = s.get('density')
if s.get('compute_nodes'):
compute_nodes = compute_nodes[:s.get('compute_nodes')]

View File

@ -176,6 +176,14 @@ class TestDeploy(testtools.TestCase):
unique)
self.assertEqual(expected, actual)
def test_generate_agents_pair_single_room_density_compute_nodes(self):
unique = 'UU1D'
actual = deploy.generate_agents(['uno', 'duo', 'tre'],
['pair', 'single_room',
{'density': 4}, {'compute_nodes': 2}],
unique)
self.assertEqual(8, len(actual))
def test_filter_agents_all_deployed(self):
agents = {
'UU1D_agent_0': {