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:
parent
a332621052
commit
36e9518921
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,3 +10,4 @@ trusty/
|
||||
xenial/
|
||||
tests/cirros-*-disk.img
|
||||
func*.json
|
||||
.stestr
|
||||
|
@ -124,6 +124,7 @@ from nova_cc_utils import (
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
get_hacluster_config,
|
||||
https,
|
||||
is_clustered,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.openstack.ha.utils import (
|
||||
@ -514,12 +515,17 @@ def image_service_changed():
|
||||
|
||||
@hooks.hook('identity-service-relation-joined')
|
||||
def identity_joined(rid=None):
|
||||
public_url = canonical_url(CONFIGS, PUBLIC)
|
||||
internal_url = canonical_url(CONFIGS, INTERNAL)
|
||||
admin_url = canonical_url(CONFIGS, ADMIN)
|
||||
relation_set(relation_id=rid, **determine_endpoints(public_url,
|
||||
internal_url,
|
||||
admin_url))
|
||||
if config('vip') and not is_clustered():
|
||||
log('Defering registration until clustered', level=DEBUG)
|
||||
else:
|
||||
public_url = canonical_url(CONFIGS, PUBLIC)
|
||||
internal_url = canonical_url(CONFIGS, INTERNAL)
|
||||
admin_url = canonical_url(CONFIGS, ADMIN)
|
||||
relation_set(
|
||||
relation_id=rid,
|
||||
**determine_endpoints(public_url,
|
||||
internal_url,
|
||||
admin_url))
|
||||
|
||||
|
||||
@hooks.hook('identity-service-relation-changed')
|
||||
|
@ -22,7 +22,7 @@ python-openstackclient>=1.7.0
|
||||
python-swiftclient>=2.6.0
|
||||
pika>=0.10.0,<1.0
|
||||
distro-info
|
||||
git+https://github.com/juju/charm-helpers#egg=charmhelpers
|
||||
git+https://github.com/juju/charm-helpers.git#egg=charmhelpers
|
||||
# END: Amulet OpenStack Charm Helper Requirements
|
||||
# NOTE: workaround for 14.04 pip/tox
|
||||
pytz
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user