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

When defining os-data-network=10.10.1.0/24,
os-internal-network=10.12.1.0/24 and not defining os-data-space,
private-address of nova-compute units will be in 10.10.1.0/24 because
now 10.10.1.0/24 and 10.12.1.0/24 are all in internal-network.

nova-cloud-controller units can't collect public keys of nova-compute
units because they don't have NIC belonged to 10.10.1.0/24. This will
lead to some problems when resizing/migrating VM.

This problem can be fixed by defining os-internal-space for
cloud-compute because at this time private-address of nova-compute
units will be in 10.12.1.0/24.

    bindings:
      cloud-compute: *os-internal-space

However, the nova-compute charm has an os-internal-network option,
this should also be referenced as a way to do this since not
everybody uses spaces. This patch is used to deliver this point,
then we can fix this problem by running the following command:

juju config nova-compute os-internal-network='10.12.1.0/24'

Change-Id: I70b096fd709e5ec8d8a47d2d11f71ed3ea780c5d
Closes-Bug: 1686882
This commit is contained in:
Zhang Hua 2017-07-05 16:58:00 +08:00
parent a9be067bb2
commit 3bee167808
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

@ -432,7 +432,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):