Use ceph-public-address instead of private-address when relating to mon

This commit is contained in:
Felipe Reyes 2015-04-28 18:18:24 -03:00
parent 1940ca6bd6
commit 03f0526cfb
2 changed files with 10 additions and 7 deletions

View File

@ -199,11 +199,9 @@ def get_mon_hosts():
hosts = []
for relid in relation_ids('mon'):
for unit in related_units(relid):
hosts.append(
'{}:6789'.format(get_host_ip(
relation_get('private-address',
unit, relid)))
)
host_ip = get_host_ip(relation_get('ceph-public-address',
unit, relid))
hosts.append('{}:6789'.format(host_ip))
hosts.sort()
return hosts

View File

@ -213,8 +213,13 @@ class CephRadosGWTests(CharmTestCase):
def test_get_mon_hosts(self):
self.relation_ids.return_value = ['monrelid']
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'])
def test_get_conf(self):