Added nat_source flag for networks.
In some more complex clouds there can not only be more than one valid network on a server that NAT can attach to, there can also be more than one valid network from which to get a NAT address. Allow flagging a network so that it can be found. Change-Id: I3d8dd6d734a1013d2d4a43e11c3538c3a345820b
This commit is contained in:
parent
bae63fca37
commit
6d8633f5dd
doc/source/user/config
openstack
releasenotes/notes
@ -58,3 +58,10 @@ by looking for a network that has subnets that have a gateway_ip. But it's
|
|||||||
possible to have more than one network that satisfies that condition, so the
|
possible to have more than one network that satisfies that condition, so the
|
||||||
user might want to tell programs which one to pick. There can be only one
|
user might want to tell programs which one to pick. There can be only one
|
||||||
`nat_destination` per cloud.
|
`nat_destination` per cloud.
|
||||||
|
|
||||||
|
`nat_source` is a boolean field that indicates which network floating
|
||||||
|
ips should be requested from. It defaults to false. Normally this can be
|
||||||
|
inferred by looking for a network that is attached to a router. But it's
|
||||||
|
possible to have more than one network that satisfies that condition, so the
|
||||||
|
user might want to tell programs which one to pick. There can be only one
|
||||||
|
`nat_source` per cloud.
|
||||||
|
@ -583,3 +583,10 @@ class CloudConfig(object):
|
|||||||
if net['nat_destination']:
|
if net['nat_destination']:
|
||||||
return net['name']
|
return net['name']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def get_nat_source(self):
|
||||||
|
"""Get network used for NAT source."""
|
||||||
|
for net in self.config['networks']:
|
||||||
|
if net.get('nat_source'):
|
||||||
|
return net['name']
|
||||||
|
return None
|
||||||
|
@ -550,6 +550,7 @@ class OpenStackConfig(object):
|
|||||||
network = dict(
|
network = dict(
|
||||||
name=name,
|
name=name,
|
||||||
routes_externally=get_boolean(net.get('routes_externally')),
|
routes_externally=get_boolean(net.get('routes_externally')),
|
||||||
|
nat_source=get_boolean(net.get('nat_source')),
|
||||||
nat_destination=get_boolean(net.get('nat_destination')),
|
nat_destination=get_boolean(net.get('nat_destination')),
|
||||||
default_interface=get_boolean(net.get('default_interface')),
|
default_interface=get_boolean(net.get('default_interface')),
|
||||||
)
|
)
|
||||||
|
@ -102,6 +102,7 @@ USER_CONF = {
|
|||||||
'networks': [{
|
'networks': [{
|
||||||
'name': 'a-public',
|
'name': 'a-public',
|
||||||
'routes_externally': True,
|
'routes_externally': True,
|
||||||
|
'nat_source': True,
|
||||||
}, {
|
}, {
|
||||||
'name': 'another-public',
|
'name': 'another-public',
|
||||||
'routes_externally': True,
|
'routes_externally': True,
|
||||||
|
@ -225,6 +225,7 @@ class TestConfig(base.TestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
['a-private', 'another-private', 'split-no-default'],
|
['a-private', 'another-private', 'split-no-default'],
|
||||||
cc.get_internal_networks())
|
cc.get_internal_networks())
|
||||||
|
self.assertEqual('a-public', cc.get_nat_source())
|
||||||
self.assertEqual('another-private', cc.get_nat_destination())
|
self.assertEqual('another-private', cc.get_nat_destination())
|
||||||
self.assertEqual('another-public', cc.get_default_network())
|
self.assertEqual('another-public', cc.get_default_network())
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
@ -240,6 +241,7 @@ class TestConfig(base.TestCase):
|
|||||||
cc = c.get_one_cloud('_test-cloud-domain-scoped_')
|
cc = c.get_one_cloud('_test-cloud-domain-scoped_')
|
||||||
self.assertEqual([], cc.get_external_networks())
|
self.assertEqual([], cc.get_external_networks())
|
||||||
self.assertEqual([], cc.get_internal_networks())
|
self.assertEqual([], cc.get_internal_networks())
|
||||||
|
self.assertIsNone(cc.get_nat_source())
|
||||||
self.assertIsNone(cc.get_nat_destination())
|
self.assertIsNone(cc.get_nat_destination())
|
||||||
self.assertIsNone(cc.get_default_network())
|
self.assertIsNone(cc.get_default_network())
|
||||||
|
|
||||||
@ -1020,6 +1022,7 @@ class TestBackwardsCompatibility(base.TestCase):
|
|||||||
'networks': [
|
'networks': [
|
||||||
{'name': 'private', 'routes_externally': False,
|
{'name': 'private', 'routes_externally': False,
|
||||||
'nat_destination': False, 'default_interface': False,
|
'nat_destination': False, 'default_interface': False,
|
||||||
|
'nat_source': False,
|
||||||
'routes_ipv4_externally': False,
|
'routes_ipv4_externally': False,
|
||||||
'routes_ipv6_externally': False},
|
'routes_ipv6_externally': False},
|
||||||
]
|
]
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- Added nat_source flag for networks. In some more complex clouds there
|
||||||
|
can not only be more than one valid network on a server that NAT can
|
||||||
|
attach to, there can also be more than one valid network from which to
|
||||||
|
get a NAT address. Allow flagging a network so that it can be found.
|
Loading…
x
Reference in New Issue
Block a user