from neutron.agent.l3 import legacy_router
from neutron.agent.l3 import namespace_manager
from neutron.agent.l3 import namespaces
-from neutron.agent.l3 import router_info as rinf
from neutron.agent.l3 import router_processing_queue as queue
from neutron.agent.linux import external_process
from neutron.agent.linux import ip_lib
registry.notify(resources.ROUTER, events.AFTER_DELETE, self, router=ri)
- def update_fip_statuses(self, ri, existing_floating_ips, fip_statuses):
- # Identify floating IPs which were disabled
- ri.floating_ips = set(fip_statuses.keys())
- for fip_id in existing_floating_ips - ri.floating_ips:
- fip_statuses[fip_id] = l3_constants.FLOATINGIP_STATUS_DOWN
- # filter out statuses that didn't change
- fip_statuses = {f: stat for f, stat in fip_statuses.items()
- if stat != rinf.FLOATINGIP_STATUS_NOCHANGE}
- if not fip_statuses:
- return
- LOG.debug('Sending floating ip statuses: %s', fip_statuses)
- # Update floating IP status on the neutron server
- self.plugin_rpc.update_floatingip_statuses(
- self.context, ri.router_id, fip_statuses)
-
def router_deleted(self, context, router_id):
"""Deal with router deletion RPC message."""
LOG.debug('Got router deleted notification for %s', router_id)
def process_external(self, agent):
fip_statuses = {}
- existing_floating_ips = self.floating_ips
try:
with self.iptables_manager.defer_apply():
ex_gw_port = self.get_ex_gw_port()
LOG.exception(_LE("Failed to process floating IPs."))
fip_statuses = self.put_fips_in_error_state()
finally:
- agent.update_fip_statuses(
- self, existing_floating_ips, fip_statuses)
+ self.update_fip_statuses(agent, fip_statuses)
+
+ def update_fip_statuses(self, agent, fip_statuses):
+ # Identify floating IPs which were disabled
+ existing_floating_ips = self.floating_ips
+ self.floating_ips = set(fip_statuses.keys())
+ for fip_id in existing_floating_ips - self.floating_ips:
+ fip_statuses[fip_id] = l3_constants.FLOATINGIP_STATUS_DOWN
+ # filter out statuses that didn't change
+ fip_statuses = {f: stat for f, stat in fip_statuses.items()
+ if stat != FLOATINGIP_STATUS_NOCHANGE}
+ if not fip_statuses:
+ return
+ LOG.debug('Sending floating ip statuses: %s', fip_statuses)
+ # Update floating IP status on the neutron server
+ agent.plugin_rpc.update_floatingip_statuses(
+ agent.context, self.router_id, fip_statuses)
@common_utils.exception_logger()
def process(self, agent):