Add dependency on Router External Gateway property
FIP has dependecy for RouterGateway resource, but it was deperecated in
favor of Router property. So we should add corrsponding dependency for
FIP resource.
Change-Id: I5c45ddc96b17bb1f87188ae3e9aabf74e6e29e1d
Closes-Bug: #1399699
(cherry picked from commit 38d1b4fada
)
This commit is contained in:
parent
1339ac2050
commit
d6770de7cf
|
@ -135,6 +135,20 @@ class FloatingIP(neutron.NeutronResource):
|
|||
if port_on_subnet(d, interface_subnet):
|
||||
deps += (self, resource)
|
||||
break
|
||||
# depend on Router with EXTERNAL_GATEWAY_NETWORK property
|
||||
# this template with the same network_id as this
|
||||
# floating_network_id
|
||||
elif resource.has_interface('OS::Neutron::Router'):
|
||||
gateway = resource.properties.get(
|
||||
router.Router.EXTERNAL_GATEWAY)
|
||||
if gateway:
|
||||
gateway_network = gateway.get(
|
||||
router.Router.EXTERNAL_GATEWAY_NETWORK)
|
||||
floating_network = self.properties.get(
|
||||
self.FLOATING_NETWORK) or self.properties.get(
|
||||
self.FLOATING_NETWORK_ID)
|
||||
if gateway_network == floating_network:
|
||||
deps += (self, resource)
|
||||
|
||||
def validate(self):
|
||||
super(FloatingIP, self).validate()
|
||||
|
|
|
@ -473,6 +473,14 @@ neutron_subnet_and_external_gateway_template = '''
|
|||
"enable_dhcp": false
|
||||
}
|
||||
},
|
||||
"floating_ip": {
|
||||
"Type": "OS::Neutron::FloatingIP",
|
||||
"Properties": {
|
||||
"floating_network": {
|
||||
"Ref": "net_external"
|
||||
},
|
||||
}
|
||||
},
|
||||
"router": {
|
||||
"Type": "OS::Neutron::Router",
|
||||
"Properties": {
|
||||
|
@ -1525,6 +1533,8 @@ class NeutronRouterTest(HeatTestCase):
|
|||
stack = utils.parse_stack(t)
|
||||
deps = stack.dependencies[stack['subnet_external']]
|
||||
self.assertIn(stack['router'], deps)
|
||||
required_by = set(stack.dependencies.required_by(stack['router']))
|
||||
self.assertIn(stack['floating_ip'], required_by)
|
||||
|
||||
def test_router_interface(self):
|
||||
self._test_router_interface()
|
||||
|
|
Loading…
Reference in New Issue