Block endpoint reg if cluster partially formed

When an existing cluster of the service is scaled out the new unit
will join with keystone before it is fully clustered. In identity
joined hook the charmhelpers function canonical_url is called which
in turn uses another charmhelpers function, resolve_address.
resolve_address will only return the vip if the vip is set in config
AND the unit is clustered. This means that the units local address
is returned and that is then registered with keystone.

This change gates registering an endpoint if the cluster is
partially formed.

Change-Id: Ibe7d2286de130f045257ad6552f7a5b1279958b6
Partial-Bug: #1544959
This commit is contained in:
Liam Young
2017-10-02 10:43:13 +00:00
parent a332621052
commit 36e9518921
4 changed files with 21 additions and 7 deletions

View File

@@ -93,6 +93,7 @@ TO_PATCH = [
'update_dns_ha_resource_params',
'serial_console_settings',
'get_relation_ip',
'is_clustered',
]
@@ -499,6 +500,12 @@ class NovaCCHooksTests(CharmTestCase):
admin_url='http://127.0.0.1'
)
def test_identity_joined_partial_cluster(self):
self.is_clustered.return_value = False
self.test_config.set('vip', '10.0.0.10')
hooks.identity_joined()
self.assertFalse(self.relation_set.called)
def test_postgresql_nova_db_joined(self):
self.is_relation_made.return_value = False
hooks.pgsql_nova_db_joined()