make sure to set node_affinity_policy for Mesos template definition

Fixes the problem with Mesos cluster creation where the
nodes_affinity_policy was not properly conveyed as it is required
in order to create the corresponding server group in Nova.

Change-Id: Ie8d73247ba95f20e24d6cae27963d18b35f8715a
story: 2005116
This commit is contained in:
Guang Yee 2019-03-01 15:49:06 -08:00
parent e256f87d1a
commit a47f5a3994
4 changed files with 22 additions and 0 deletions

View File

@ -13,8 +13,11 @@
# under the License.
import os
import magnum.conf
from magnum.drivers.heat import template_def
CONF = magnum.conf.CONF
class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
"""Mesos template for Ubuntu VM."""
@ -61,6 +64,8 @@ class UbuntuMesosTemplateDefinition(template_def.BaseTemplateDefinition):
extra_params['tenant_name'] = context.project_id
extra_params['domain_name'] = context.domain_name
extra_params['region_name'] = osc.cinder_region_name()
extra_params['nodes_affinity_policy'] = \
CONF.cluster.nodes_affinity_policy
label_list = ['rexray_preempt', 'mesos_slave_isolation',
'mesos_slave_image_providers',

View File

@ -141,6 +141,7 @@ class TestClusterConductorWithMesos(base.TestCase):
'mesos_slave_image_providers': 'docker',
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity'
}
self.assertEqual(expected, definition)
self.assertEqual(
@ -198,6 +199,7 @@ class TestClusterConductorWithMesos(base.TestCase):
'verify_ca': True,
'slave_flavor': 'flavor_id',
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity'
}
self.assertEqual(expected, definition)
self.assertEqual(
@ -261,6 +263,7 @@ class TestClusterConductorWithMesos(base.TestCase):
'mesos_slave_image_providers': 'docker',
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity'
}
self.assertEqual(expected, definition)
self.assertEqual(
@ -328,6 +331,7 @@ class TestClusterConductorWithMesos(base.TestCase):
'mesos_slave_image_providers': 'docker',
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity'
}
self.assertEqual(expected, definition)
self.assertEqual(
@ -393,6 +397,7 @@ class TestClusterConductorWithMesos(base.TestCase):
'mesos_slave_image_providers': 'docker',
'verify_ca': True,
'openstack_ca': '',
'nodes_affinity_policy': 'soft-anti-affinity'
}
self.assertEqual(expected, definition)
self.assertEqual(

View File

@ -1747,10 +1747,15 @@ class UbuntuMesosTemplateDefinitionTestCase(base.TestCase):
mesos_def = mesos_tdef.UbuntuMesosTemplateDefinition()
CONF.set_override('nodes_affinity_policy',
'anti-affinity',
group='cluster')
mesos_def.get_params(mock_context, mock_cluster_template, mock_cluster)
expected_kwargs = {'extra_params': {
'region_name': mock_osc.cinder_region_name.return_value,
'nodes_affinity_policy': 'anti-affinity',
'auth_url': 'http://192.168.10.10:5000/v3',
'username': 'mesos_user',
'tenant_name': 'admin',

View File

@ -0,0 +1,7 @@
---
fixes:
- |
Fixes the problem with Mesos cluster creation where the
nodes_affinity_policy was not properly conveyed as it is required
in order to create the corresponding server group in Nova.
https://storyboard.openstack.org/#!/story/2005116