Browse Source

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
changes/56/640556/1
Guang Yee 2 years ago
parent
commit
a47f5a3994
  1. 5
      magnum/drivers/mesos_ubuntu_v1/template_def.py
  2. 5
      magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py
  3. 5
      magnum/tests/unit/drivers/test_template_definition.py
  4. 7
      releasenotes/notes/affinity-policy-for-mesos-template-def-82627eb231aa4d28.yaml

5
magnum/drivers/mesos_ubuntu_v1/template_def.py

@ -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',

5
magnum/tests/unit/conductor/handlers/test_mesos_cluster_conductor.py

@ -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(

5
magnum/tests/unit/drivers/test_template_definition.py

@ -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',

7
releasenotes/notes/affinity-policy-for-mesos-template-def-82627eb231aa4d28.yaml

@ -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
Loading…
Cancel
Save