Use ceph-public-address instead of private-address when relating to mon
This commit is contained in:
parent
1940ca6bd6
commit
03f0526cfb
@ -199,11 +199,9 @@ def get_mon_hosts():
|
|||||||
hosts = []
|
hosts = []
|
||||||
for relid in relation_ids('mon'):
|
for relid in relation_ids('mon'):
|
||||||
for unit in related_units(relid):
|
for unit in related_units(relid):
|
||||||
hosts.append(
|
host_ip = get_host_ip(relation_get('ceph-public-address',
|
||||||
'{}:6789'.format(get_host_ip(
|
unit, relid))
|
||||||
relation_get('private-address',
|
hosts.append('{}:6789'.format(host_ip))
|
||||||
unit, relid)))
|
|
||||||
)
|
|
||||||
|
|
||||||
hosts.sort()
|
hosts.sort()
|
||||||
return hosts
|
return hosts
|
||||||
|
@ -213,8 +213,13 @@ class CephRadosGWTests(CharmTestCase):
|
|||||||
def test_get_mon_hosts(self):
|
def test_get_mon_hosts(self):
|
||||||
self.relation_ids.return_value = ['monrelid']
|
self.relation_ids.return_value = ['monrelid']
|
||||||
self.related_units.return_value = ['monunit']
|
self.related_units.return_value = ['monunit']
|
||||||
self.relation_get.return_value = '10.0.0.1'
|
|
||||||
self.get_host_ip.return_value = '10.0.0.1'
|
def rel_get(k, *args):
|
||||||
|
return {'private-address': '127.0.0.1',
|
||||||
|
'ceph-public-address': '10.0.0.1'}[k]
|
||||||
|
|
||||||
|
self.relation_get.side_effect = rel_get
|
||||||
|
self.get_host_ip.side_effect = lambda x: x
|
||||||
self.assertEquals(ceph_hooks.get_mon_hosts(), ['10.0.0.1:6789'])
|
self.assertEquals(ceph_hooks.get_mon_hosts(), ['10.0.0.1:6789'])
|
||||||
|
|
||||||
def test_get_conf(self):
|
def test_get_conf(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user