Merge "my_ip should belong to internal-network rather than data-network"

This commit is contained in:
Jenkins 2017-08-24 22:28:12 +00:00 committed by Gerrit Code Review
commit 8033d991e0
3 changed files with 6 additions and 3 deletions

View File

@ -630,7 +630,8 @@ class HostIPContext(context.OSContextGenerator):
ctxt = {}
# Use the address used in the cloud-compute relation in templates for
# this host
host_ip = get_relation_ip('cloud-compute')
host_ip = get_relation_ip('cloud-compute',
cidr_network=config('os-internal-network'))
if host_ip:
# NOTE: do not format this even for ipv6 (see bug 1499656)

View File

@ -316,7 +316,8 @@ def compute_joined(rid=None):
# add the hostname configured locally to the relation.
settings = {
'hostname': gethostname(),
'private-address': get_relation_ip('cloud-compute'),
'private-address': get_relation_ip(
'cloud-compute', cidr_network=config('os-internal-network')),
}
if migration_enabled():

View File

@ -443,7 +443,8 @@ class NovaComputeContextTests(CharmTestCase):
self.get_relation_ip.return_value = '172.24.0.79'
host_ip = context.HostIPContext()
self.assertEqual({'host_ip': '172.24.0.79'}, host_ip())
self.get_relation_ip.assert_called_with('cloud-compute')
self.get_relation_ip.assert_called_with('cloud-compute',
cidr_network=None)
@patch('subprocess.call')
def test_host_IP_context_ipv6(self, _call):