Comment 1 for bug 1891673

Revision history for this message
Edward Hope-Morley (hopem) wrote :

ok a bit more info, this problem only occurs if you restart the neutron-l3-agent in between adding and removing the floating ip. Looking at the code it looks like this is because the information needed to delete the fip is held in memory and comes from when the fip is added at which point it is added to floating_ips_dict which is never repopulated. So basically if you restart your l3-agent you lost all records of floating ips that need their ip rules deleted.

    def _add_floating_ip_rule(self, floating_ip, fixed_ip):
        rule_pr = self.fip_ns.allocate_rule_priority(floating_ip)
        self.floating_ips_dict[floating_ip] = (fixed_ip, rule_pr)

        ip_lib.add_ip_rule(namespace=self.ns_name, ip=fixed_ip,
                           table=dvr_fip_ns.FIP_RT_TBL,
                           priority=int(str(rule_pr)))

    def _remove_floating_ip_rule(self, floating_ip):
        if floating_ip in self.floating_ips_dict:
            fixed_ip, rule_pr = self.floating_ips_dict[floating_ip]
            ip_lib.delete_ip_rule(self.ns_name, ip=fixed_ip,
                                  table=dvr_fip_ns.FIP_RT_TBL,
                                  priority=int(str(rule_pr)))
            self.fip_ns.deallocate_rule_priority(floating_ip)
            # TODO(rajeev): Handle else case - exception/log?