Switch to SUBNET from SUBNET_GATEWAY

We are trying to get rid of SUBNET_GATEWAY as a resource
independent from SUBNET since it's just an attribute. This
change should offer the same semantics as before while just
depending on the SUBNET callback.

Change-Id: Id7139317a6b20f8dfa65e5268d4f525f1bfdff23
Partial-Bug: #1690944
This commit is contained in:
Kevin Benton
2017-05-15 16:15:48 -07:00
committed by garyk
parent 7bc8518476
commit 46733938aa

View File

@@ -37,7 +37,7 @@ class EdgeLoadBalancerManager(base_mgr.EdgeLoadbalancerBaseManager):
super(EdgeLoadBalancerManager, self).__init__(vcns_driver)
registry.subscribe(
self._handle_subnet_gw_change,
resources.SUBNET_GATEWAY, events.AFTER_UPDATE)
resources.SUBNET, events.AFTER_UPDATE)
@log_helpers.log_method_call
def create(self, context, lb):
@@ -142,7 +142,11 @@ class EdgeLoadBalancerManager(base_mgr.EdgeLoadbalancerBaseManager):
# As the Edge appliance doesn't use DHCP, we should change the
# default gateway here when the subnet GW changes.
context = kwargs.get('context')
subnet_id = kwargs.get('subnet_id')
orig = kwargs['original_subnet']
updated = kwargs['subnet']
if orig['gateway_ip'] == updated['gateway_ip']:
return
subnet_id = updated['id']
subnet = self.core_plugin.get_subnet(context.elevated(), subnet_id)
filters = {'fixed_ips': {'subnet_id': [subnet_id]},