Don't make client calls when adding dependencies
There is no point making client calls when adding RouterInterface dependencies in the same stack for RouterGateway or ExtraRoute resources, as both of them have only router_id property. Therefore, if it's from parameter or get_resource it would always be the router_id. Change-Id: I575b714c9a3c7b9c95f7a8e59c915accbf7972f4 Closes-Bug: #1626607
This commit is contained in:
parent
2fa8cc09d3
commit
b340c132a7
|
@ -65,10 +65,8 @@ class ExtraRoute(neutron.NeutronResource):
|
|||
# depend on any RouterInterface in this template with the same
|
||||
# router_id as this router_id
|
||||
if resource.has_interface('OS::Neutron::RouterInterface'):
|
||||
dep_router_id = self.client_plugin().resolve_router({
|
||||
'router': resource.properties.get('router'),
|
||||
'router_id': None}, 'router', 'router_id')
|
||||
router_id = self.properties[self.ROUTER_ID]
|
||||
dep_router_id = resource.properties['router']
|
||||
if dep_router_id == router_id:
|
||||
deps += (self, resource)
|
||||
# depend on any RouterGateway in this template with the same
|
||||
|
|
|
@ -595,13 +595,7 @@ class RouterGateway(neutron.NeutronResource):
|
|||
# depend on any RouterInterface in this template with the same
|
||||
# router_id as this router_id
|
||||
if resource.has_interface('OS::Neutron::RouterInterface'):
|
||||
# Since RouterInterface translates router_id property to
|
||||
# router, we should correctly resolve it for RouterGateway.
|
||||
dep_router_id = self.client_plugin().resolve_router({
|
||||
RouterInterface.ROUTER: resource.properties.get(
|
||||
RouterInterface.ROUTER),
|
||||
RouterInterface.ROUTER_ID: None}, RouterInterface.ROUTER,
|
||||
RouterInterface.ROUTER_ID)
|
||||
dep_router_id = resource.properties[RouterInterface.ROUTER]
|
||||
router_id = self.properties[self.ROUTER_ID]
|
||||
if dep_router_id == router_id:
|
||||
deps += (self, resource)
|
||||
|
@ -609,8 +603,7 @@ class RouterGateway(neutron.NeutronResource):
|
|||
# as this network_id, as the gateway implicitly creates a port
|
||||
# on that subnet
|
||||
if resource.has_interface('OS::Neutron::Subnet'):
|
||||
dep_network = resource.properties.get(
|
||||
subnet.Subnet.NETWORK)
|
||||
dep_network = resource.properties[subnet.Subnet.NETWORK]
|
||||
network = self.properties[self.NETWORK]
|
||||
if dep_network == network:
|
||||
deps += (self, resource)
|
||||
|
|
|
@ -484,17 +484,7 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||
|
||||
self.m.VerifyAll()
|
||||
|
||||
def _test_floating_dependancy(self):
|
||||
neutronV20.find_resourceid_by_name_or_id(
|
||||
mox.IsA(neutronclient.Client),
|
||||
'router',
|
||||
'subnet_uuid',
|
||||
cmd_resource=None,
|
||||
).MultipleTimes().AndReturn('subnet_uuid')
|
||||
self.m.ReplayAll()
|
||||
|
||||
def test_floatip_port_dependency_subnet(self):
|
||||
self._test_floating_dependancy()
|
||||
t = template_format.parse(neutron_floating_no_assoc_template)
|
||||
stack = utils.parse_stack(t)
|
||||
|
||||
|
@ -507,7 +497,6 @@ class NeutronFloatingIPTest(common.HeatTestCase):
|
|||
self.m.VerifyAll()
|
||||
|
||||
def test_floatip_port_dependency_network(self):
|
||||
self._test_floating_dependancy()
|
||||
t = template_format.parse(neutron_floating_no_assoc_template)
|
||||
del t['resources']['port_floating']['properties']['fixed_ips']
|
||||
stack = utils.parse_stack(t)
|
||||
|
|
|
@ -11,8 +11,6 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mox
|
||||
|
||||
from neutronclient.common import exceptions as qe
|
||||
from neutronclient.neutron import v2_0 as neutronV20
|
||||
from neutronclient.v2_0 import client as neutronclient
|
||||
|
@ -107,13 +105,6 @@ class NeutronNetTest(common.HeatTestCase):
|
|||
t = template_format.parse(neutron_template)
|
||||
stack = utils.parse_stack(t)
|
||||
|
||||
neutronV20.find_resourceid_by_name_or_id(
|
||||
mox.IsA(neutronclient.Client),
|
||||
'router',
|
||||
'792ff887-6c85-4a56-b518-23f24fa65581',
|
||||
cmd_resource=None,
|
||||
).MultipleTimes().AndReturn('792ff887-6c85-4a56-b518-23f24fa65581')
|
||||
|
||||
# Create script
|
||||
neutronclient.Client.create_network({
|
||||
'network': {
|
||||
|
|
Loading…
Reference in New Issue