)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"9565b7b6f4504cc43e53335503814bff6cad9734","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For L3 DVR HA router, the centralized floating IPs nat rules are not"},{"line_number":10,"context_line":"installed in every HA node snat namespace. So, install the rules to"},{"line_number":11,"context_line":"all the router snat-namespce on every scheduled HA router host."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-Bug: #1793527"},{"line_number":14,"context_line":"Change-Id: I08132510b3ed374a3f85146498f3624a103873d7"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3f79a3b5_b9b757d8","line":11,"range":{"start_line":11,"start_character":20,"end_line":11,"end_character":28},"updated":"2018-09-20 18:00:30.000000000","message":"namespace","commit_id":"fd8af767eed9f643c0da2f2ad2ed64c20487b4f5"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"f0e81133a241a2adb7ee7e2bc349da520846ba1c","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Install centralized floating IP nat rules to all ha nodes"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For L3 DVR HA router, the centralized floating IPs nat rules are not"},{"line_number":10,"context_line":"installed in every HA node snat namespace. So, install the rules to"},{"line_number":11,"context_line":"all the router snat-namespace on every scheduled HA router host."},{"line_number":12,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"3f79a3b5_c02b6830","line":9,"range":{"start_line":9,"start_character":49,"end_line":9,"end_character":51},"updated":"2018-10-01 17:47:08.000000000","message":"IP","commit_id":"9aca431ad74a4b830c05c3e82c973a3f1ddb2cd0"}],"neutron/agent/l3/dvr_edge_router.py":[{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ec1e4a49cb9562c644c2c5badef3cf74e84fb8e1","unresolved":false,"context_lines":[{"line_number":365,"context_line":"        if self._is_this_snat_host():"},{"line_number":366,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"},{"line_number":367,"context_line":""},{"line_number":368,"context_line":"    def process_snat_dnat_for_fip(self):"},{"line_number":369,"context_line":"        if self._is_this_snat_host():"},{"line_number":370,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_09f388e8","line":368,"updated":"2018-09-21 14:32:19.000000000","message":"What is the difference between process_floating_ip_nat_rules() and process_snat_dnat_for_fip()?  They look identical to me.","commit_id":"e0ff29263ff330f385c98b83741f3f92aa4853e2"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"c607dbffa9fa0058a1e9a77ec8902caf791a0b32","unresolved":false,"context_lines":[{"line_number":365,"context_line":"        if self._is_this_snat_host():"},{"line_number":366,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"},{"line_number":367,"context_line":""},{"line_number":368,"context_line":"    def process_snat_dnat_for_fip(self):"},{"line_number":369,"context_line":"        if self._is_this_snat_host():"},{"line_number":370,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_5fb7eed8","line":368,"in_reply_to":"3f79a3b5_09f388e8","updated":"2018-09-21 15:23:04.000000000","message":"OK, let\u0027s call process_floating_ip_nat_rules.","commit_id":"e0ff29263ff330f385c98b83741f3f92aa4853e2"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"7c8c5e7bdd18178619da15d65dd167fe09433c8e","unresolved":false,"context_lines":[{"line_number":361,"context_line":"        fip_ip \u003d fip[\u0027floating_ip_address\u0027]"},{"line_number":362,"context_line":"        return self._centralized_floating_forward_rules(fip_ip, fixed)"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"    def process_floating_ip_nat_rules(self):"},{"line_number":365,"context_line":"        if self._is_this_snat_host():"},{"line_number":366,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"},{"line_number":367,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_58306407","line":364,"updated":"2018-09-21 17:30:43.000000000","message":"Here when a call is being made to process_snat_dnat_for_fip or for \u0027process_floating_ip_nat_rules\u0027 do we really check if the floatingIP we are trying to configure is a centralized floatingIP.\nThe check you do below is just check if this is a snat host. \n\nWhere as \u0027add_centralized_floatingIP\u0027 determines that is floatingIP need to be centralized based on the port-binding.\n\nI have not tested this code, but was checking if you have tested it with a regular scenario were you have a mix of regular floatingIP and centralized floatingIP.","commit_id":"921e201c5c1d386a1b61f935f212af0edc21ddf8"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"e8a60fa2c746de37fb82cbf45a0052eb1f36dc4c","unresolved":false,"context_lines":[{"line_number":361,"context_line":"        fip_ip \u003d fip[\u0027floating_ip_address\u0027]"},{"line_number":362,"context_line":"        return self._centralized_floating_forward_rules(fip_ip, fixed)"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"    def process_floating_ip_nat_rules(self):"},{"line_number":365,"context_line":"        if self._is_this_snat_host():"},{"line_number":366,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"},{"line_number":367,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_5deb6f7a","line":364,"in_reply_to":"3f79a3b5_58306407","updated":"2018-09-22 00:53:24.000000000","message":"Yes, I\u0027m on that. The mixed `compute node` and `dvr snat node` could make the floating IP processing complex, maybe we need to add some agent_mode check or floating IP `DVR_SNAT_BOUND` check here in this function or dvr_local_router functions.","commit_id":"921e201c5c1d386a1b61f935f212af0edc21ddf8"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"fdf66f1f74e886d80904ed27da141e5821a5378c","unresolved":false,"context_lines":[{"line_number":361,"context_line":"        fip_ip \u003d fip[\u0027floating_ip_address\u0027]"},{"line_number":362,"context_line":"        return self._centralized_floating_forward_rules(fip_ip, fixed)"},{"line_number":363,"context_line":""},{"line_number":364,"context_line":"    def process_floating_ip_nat_rules(self):"},{"line_number":365,"context_line":"        if self._is_this_snat_host():"},{"line_number":366,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"},{"line_number":367,"context_line":""}],"source_content_type":"text/x-python","patch_set":4,"id":"3f79a3b5_de351947","line":364,"in_reply_to":"3f79a3b5_5deb6f7a","updated":"2018-09-24 22:29:34.000000000","message":"Thanks please update me on your testing. If you have any issues let me know, I can help you out.","commit_id":"921e201c5c1d386a1b61f935f212af0edc21ddf8"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"bb5a4c90edda121ca81245c61a9cf83b9a341312","unresolved":false,"context_lines":[{"line_number":354,"context_line":"        self.snat_iptables_manager.apply()"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"    def process_floating_ip_nat_rules(self):"},{"line_number":357,"context_line":"        if self._is_this_snat_host():"},{"line_number":358,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"        # Cover mixed dvr_snat and compute node, aka a dvr_snat node has both"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_e92588c0","line":357,"updated":"2018-09-27 04:35:43.000000000","message":"This is the question that I had earlier.\nWhen process_floating_ip_nat_rules is called from router_info, are there any check in here to make sure if the floating ip nat rules should be configured in the centralized snat namespace or the floatingip namespace.","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"143f5207167fc3de9877b770257e6b963854015e","unresolved":false,"context_lines":[{"line_number":354,"context_line":"        self.snat_iptables_manager.apply()"},{"line_number":355,"context_line":""},{"line_number":356,"context_line":"    def process_floating_ip_nat_rules(self):"},{"line_number":357,"context_line":"        if self._is_this_snat_host():"},{"line_number":358,"context_line":"            self.process_floating_ip_nat_rules_for_centralized_floatingip()"},{"line_number":359,"context_line":""},{"line_number":360,"context_line":"        # Cover mixed dvr_snat and compute node, aka a dvr_snat node has both"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_44310159","line":357,"in_reply_to":"3f79a3b5_e92588c0","updated":"2018-09-27 05:30:45.000000000","message":"This is for centralized floating IP:\nhttps://review.openstack.org/#/c/604094/11/neutron/agent/l3/dvr_edge_router.py@340","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"143f5207167fc3de9877b770257e6b963854015e","unresolved":false,"context_lines":[{"line_number":359,"context_line":""},{"line_number":360,"context_line":"        # Cover mixed dvr_snat and compute node, aka a dvr_snat node has both"},{"line_number":361,"context_line":"        # centralized and distributed floating IPs."},{"line_number":362,"context_line":"        super(DvrEdgeRouter, self).process_floating_ip_nat_rules()"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_64343d4a","line":362,"range":{"start_line":362,"start_character":8,"end_line":362,"end_character":66},"updated":"2018-09-27 05:30:45.000000000","message":"This is for distributed floating IP. And here has a check to make sure centralized floating IPs are not processed twice:\nhttps://review.openstack.org/#/c/604094/11/neutron/agent/l3/dvr_local_router.py@561","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"}],"neutron/agent/l3/dvr_local_router.py":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a5e9af4b3b55346606fe72faad2df44d17b6745c","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        ip_cidr \u003d common_utils.ip_to_cidr(fip[\u0027floating_ip_address\u0027])"},{"line_number":58,"context_line":"        self.floating_ip_removed_dist(ip_cidr)"},{"line_number":59,"context_line":"        # Floating IP migrate from centralized to distributed, so here"},{"line_number":60,"context_line":"        # needs to remove the snat bond key first, then next function"},{"line_number":61,"context_line":"        # can add policy route rules for it."},{"line_number":62,"context_line":"        fip.pop(lib_constants.DVR_SNAT_BOUND, None)"},{"line_number":63,"context_line":"        # Now add the floating_ip to the current host"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f79a3b5_532d70ac","line":60,"range":{"start_line":60,"start_character":10,"end_line":60,"end_character":39},"updated":"2018-09-25 16:26:07.000000000","message":"s/we need to remove the snat bound","commit_id":"4e7521e590c52cde358bc0ca5a80a0eec781ab43"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"c1515973ebe48657550cc7d8954468fb6fccf477","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        ip_cidr \u003d common_utils.ip_to_cidr(fip[\u0027floating_ip_address\u0027])"},{"line_number":58,"context_line":"        self.floating_ip_removed_dist(ip_cidr)"},{"line_number":59,"context_line":"        # Floating IP migrate from centralized to distributed, so here"},{"line_number":60,"context_line":"        # needs to remove the snat bond key first, then next function"},{"line_number":61,"context_line":"        # can add policy route rules for it."},{"line_number":62,"context_line":"        fip.pop(lib_constants.DVR_SNAT_BOUND, None)"},{"line_number":63,"context_line":"        # Now add the floating_ip to the current host"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f79a3b5_db9aee11","line":60,"range":{"start_line":60,"start_character":10,"end_line":60,"end_character":39},"in_reply_to":"3f79a3b5_532d70ac","updated":"2018-09-26 01:01:23.000000000","message":"Will rephrase this later.","commit_id":"4e7521e590c52cde358bc0ca5a80a0eec781ab43"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"37d5a84ba20c9c5903b7d874b3283167703d5f5d","unresolved":false,"context_lines":[{"line_number":57,"context_line":"        ip_cidr \u003d common_utils.ip_to_cidr(fip[\u0027floating_ip_address\u0027])"},{"line_number":58,"context_line":"        self.floating_ip_removed_dist(ip_cidr)"},{"line_number":59,"context_line":"        # Floating IP migrate from centralized to distributed, so here"},{"line_number":60,"context_line":"        # we need to remove the snat bond key first, then next function"},{"line_number":61,"context_line":"        # can add policy route rules for it."},{"line_number":62,"context_line":"        fip.pop(lib_constants.DVR_SNAT_BOUND, None)"},{"line_number":63,"context_line":"        # Now add the floating_ip to the current host"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_bc727eaf","line":60,"range":{"start_line":60,"start_character":37,"end_line":60,"end_character":41},"updated":"2018-09-26 13:32:11.000000000","message":"nit: bound","commit_id":"84d02a0b38adc58eb51d25b009dd5c003aab0409"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"bb5a4c90edda121ca81245c61a9cf83b9a341312","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # Floating IP migrate from centralized to distributed, so here"},{"line_number":60,"context_line":"        # we need to remove the snat bound key first, then next function"},{"line_number":61,"context_line":"        # can add policy route rules for it."},{"line_number":62,"context_line":"        fip.pop(lib_constants.DVR_SNAT_BOUND, None)"},{"line_number":63,"context_line":"        # Now add the floating_ip to the current host"},{"line_number":64,"context_line":"        self.floating_ip_added_dist(fip, ip_cidr)"},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_49103c5a","line":62,"updated":"2018-09-27 04:35:43.000000000","message":"Is this change required for this patch. Otherwise file an additional bug to address this change.","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"143f5207167fc3de9877b770257e6b963854015e","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # Floating IP migrate from centralized to distributed, so here"},{"line_number":60,"context_line":"        # we need to remove the snat bound key first, then next function"},{"line_number":61,"context_line":"        # can add policy route rules for it."},{"line_number":62,"context_line":"        fip.pop(lib_constants.DVR_SNAT_BOUND, None)"},{"line_number":63,"context_line":"        # Now add the floating_ip to the current host"},{"line_number":64,"context_line":"        self.floating_ip_added_dist(fip, ip_cidr)"},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_841079ad","line":62,"in_reply_to":"3f79a3b5_49103c5a","updated":"2018-09-27 05:30:45.000000000","message":"It is required. Since this functional case `test_floating_ip_migration_from_unbound_to_bound` is really a tough one, \nhttps://review.openstack.org/#/c/604094/11/neutron/tests/functional/agent/l3/test_dvr_router.py@1101","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"bb5a4c90edda121ca81245c61a9cf83b9a341312","unresolved":false,"context_lines":[{"line_number":71,"context_line":"        if fip.get(lib_constants.DVR_SNAT_BOUND):"},{"line_number":72,"context_line":"            return []"},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"        # For dvr_no_external node should not process any floating IP"},{"line_number":75,"context_line":"        # iptables rules."},{"line_number":76,"context_line":"        if (self.agent_conf.agent_mode \u003d\u003d"},{"line_number":77,"context_line":"                lib_constants.L3_AGENT_MODE_DVR_NO_EXTERNAL):"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_84fb9913","line":74,"range":{"start_line":74,"start_character":10,"end_line":74,"end_character":14},"updated":"2018-09-27 04:35:43.000000000","message":"Get rid of this For, does not make sense.","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"bb5a4c90edda121ca81245c61a9cf83b9a341312","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            return floating_ip_status"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"        # Let the `dvr` mode node check the host only."},{"line_number":125,"context_line":"        if (self.agent_conf.agent_mode \u003d\u003d lib_constants.L3_AGENT_MODE_DVR and"},{"line_number":126,"context_line":"                not self._check_if_floatingip_bound_to_host(fip)):"},{"line_number":127,"context_line":"            # TODO(Swami): Need to figure out what status"},{"line_number":128,"context_line":"            # should be returned when the floating IP is"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_64567d08","line":125,"range":{"start_line":125,"start_character":12,"end_line":125,"end_character":73},"updated":"2018-09-27 04:35:43.000000000","message":"By default all other agent modes should be \u0027DVR\u0027 mode should we need to check.","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"8e083d896062815988daa14420abc3eb74d88293","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            return floating_ip_status"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"        # Let the `dvr` mode node check the host only."},{"line_number":125,"context_line":"        if (self.agent_conf.agent_mode \u003d\u003d lib_constants.L3_AGENT_MODE_DVR and"},{"line_number":126,"context_line":"                not self._check_if_floatingip_bound_to_host(fip)):"},{"line_number":127,"context_line":"            # TODO(Swami): Need to figure out what status"},{"line_number":128,"context_line":"            # should be returned when the floating IP is"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_e66fdcc1","line":125,"range":{"start_line":125,"start_character":12,"end_line":125,"end_character":73},"in_reply_to":"3f79a3b5_44582189","updated":"2018-09-27 22:40:32.000000000","message":"For distributed floatingIP the host cannot be None, it should have a valid host.","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"143f5207167fc3de9877b770257e6b963854015e","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            return floating_ip_status"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"        # Let the `dvr` mode node check the host only."},{"line_number":125,"context_line":"        if (self.agent_conf.agent_mode \u003d\u003d lib_constants.L3_AGENT_MODE_DVR and"},{"line_number":126,"context_line":"                not self._check_if_floatingip_bound_to_host(fip)):"},{"line_number":127,"context_line":"            # TODO(Swami): Need to figure out what status"},{"line_number":128,"context_line":"            # should be returned when the floating IP is"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_44582189","line":125,"range":{"start_line":125,"start_character":12,"end_line":125,"end_character":73},"in_reply_to":"3f79a3b5_64567d08","updated":"2018-09-27 05:30:45.000000000","message":"1. If floating IP is centralized it will be processed in line 119 no matter the agent mode is.\n2. This method is floating_ip_added_dist, so only the dvr node can process the distributed floating IP. Then let it check the distributed \n floating IP binding host.\n3. For dvr_snat node, if it mixed with compute, then it may have both centralized floating IP and distributed floating IP. For distributed floating IP, the host can be empty or None, but it still need to to process as normal.","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"dc277555b68db04c9613b9d418ba372d3582fa95","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            return floating_ip_status"},{"line_number":123,"context_line":""},{"line_number":124,"context_line":"        # Let the `dvr` mode node check the host only."},{"line_number":125,"context_line":"        if (self.agent_conf.agent_mode \u003d\u003d lib_constants.L3_AGENT_MODE_DVR and"},{"line_number":126,"context_line":"                not self._check_if_floatingip_bound_to_host(fip)):"},{"line_number":127,"context_line":"            # TODO(Swami): Need to figure out what status"},{"line_number":128,"context_line":"            # should be returned when the floating IP is"}],"source_content_type":"text/x-python","patch_set":11,"id":"3f79a3b5_6ca40da4","line":125,"range":{"start_line":125,"start_character":12,"end_line":125,"end_character":73},"in_reply_to":"3f79a3b5_e66fdcc1","updated":"2018-09-28 01:52:35.000000000","message":"Thanks, I think maybe I was lost in the test case:\ntest_floating_ip_migration_from_unbound_to_bound\nhttps://github.com/openstack/neutron/blob/master/neutron/tests/functional/agent/l3/test_dvr_router.py#L1088","commit_id":"024c574ee2013fa2f02dae3b571c9ff21e7aca3c"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"f0e81133a241a2adb7ee7e2bc349da520846ba1c","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # Floating IP migrate from centralized to distributed, so here"},{"line_number":60,"context_line":"        # we need to remove the snat bound key first, then next function"},{"line_number":61,"context_line":"        # can add policy route rules for it."},{"line_number":62,"context_line":"        fip.pop(lib_constants.DVR_SNAT_BOUND, None)"},{"line_number":63,"context_line":"        # Now add the floating_ip to the current host"},{"line_number":64,"context_line":"        self.floating_ip_added_dist(fip, ip_cidr)"},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"3f79a3b5_00de40da","line":62,"range":{"start_line":62,"start_character":8,"end_line":62,"end_character":51},"updated":"2018-10-01 17:47:08.000000000","message":"Not sure why we should pop the DVR_SNAT_BOUND from the fip dict here.\nAfter migration if we are still getting a DVR_SNAT_BOUND in the fip dict, then it should be fixed in the Server side.\nMy understanding is that, if the fixed port has a binding, then the DVR_SNAT_BOUND should be removed in the Server side.\n\nThe only time this migration can happen is only for the \u0027dvr\u0027 mode agents and not for the \u0027dvr_no_external\u0027.","commit_id":"9aca431ad74a4b830c05c3e82c973a3f1ddb2cd0"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"f35889b9b6d3f10e02e8497eba142ee95973f2f6","unresolved":false,"context_lines":[{"line_number":59,"context_line":"        # Floating IP migrate from centralized to distributed, so here"},{"line_number":60,"context_line":"        # we need to remove the snat bound key first, then next function"},{"line_number":61,"context_line":"        # can add policy route rules for it."},{"line_number":62,"context_line":"        fip.pop(lib_constants.DVR_SNAT_BOUND, None)"},{"line_number":63,"context_line":"        # Now add the floating_ip to the current host"},{"line_number":64,"context_line":"        self.floating_ip_added_dist(fip, ip_cidr)"},{"line_number":65,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"3f79a3b5_d7b80513","line":62,"range":{"start_line":62,"start_character":8,"end_line":62,"end_character":51},"in_reply_to":"3f79a3b5_00de40da","updated":"2018-10-02 01:23:33.000000000","message":"I see, since I have adjusted the functional test data preparation, this can be remove. Keep in mind of this scenario: dvr_snat node mixed with the compute node, the floating IP was binded to a VM which hosted in a dvr_no_external node; and then this floating IP is binding to the VM hosted in this dvr_snat node.","commit_id":"9aca431ad74a4b830c05c3e82c973a3f1ddb2cd0"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"77778093f91c6e7d7e915742b7b345ebeea0a16c","unresolved":false,"context_lines":[{"line_number":551,"context_line":"            # If floating IP is snat_bound, then the iptables rule should"},{"line_number":552,"context_line":"            # not be installed to qrouter namespace, since the mixed snat"},{"line_number":553,"context_line":"            # namespace may already install it."},{"line_number":554,"context_line":"            if not fip.get(lib_constants.DVR_SNAT_BOUND):"},{"line_number":555,"context_line":"                # Rebuild iptables rules for the floating ip."},{"line_number":556,"context_line":"                for chain, rule in self.floating_forward_rules(fip):"},{"line_number":557,"context_line":"                    self.iptables_manager.ipv4[\u0027nat\u0027].add_rule("}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_902fc5a5","line":554,"updated":"2018-10-03 21:14:57.000000000","message":"nit: if you respin maybe change this to\n\nif fip.get(...):\n    continue\n\nthat way it matches the comment","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"72f1599568d85cf2a8b24eb96c4fd9e29241c54c","unresolved":false,"context_lines":[{"line_number":551,"context_line":"            # If floating IP is snat_bound, then the iptables rule should"},{"line_number":552,"context_line":"            # not be installed to qrouter namespace, since the mixed snat"},{"line_number":553,"context_line":"            # namespace may already install it."},{"line_number":554,"context_line":"            if not fip.get(lib_constants.DVR_SNAT_BOUND):"},{"line_number":555,"context_line":"                # Rebuild iptables rules for the floating ip."},{"line_number":556,"context_line":"                for chain, rule in self.floating_forward_rules(fip):"},{"line_number":557,"context_line":"                    self.iptables_manager.ipv4[\u0027nat\u0027].add_rule("}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_57258e15","line":554,"in_reply_to":"3f79a3b5_902fc5a5","updated":"2018-10-04 15:51:57.000000000","message":"Done","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"}],"neutron/tests/functional/agent/l3/test_dvr_router.py":[{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"ec1e4a49cb9562c644c2c5badef3cf74e84fb8e1","unresolved":false,"context_lines":[{"line_number":760,"context_line":"        # In the router namespace, check the iptables rules are set"},{"line_number":761,"context_line":"        # correctly"},{"line_number":762,"context_line":"        for fip in floating_ips:"},{"line_number":763,"context_line":"            expected_rules \u003d router.floating_forward_rules(fip)"},{"line_number":764,"context_line":"            if dvr_snat:"},{"line_number":765,"context_line":"                self._assert_iptables_rules_exist("},{"line_number":766,"context_line":"                    router.snat_iptables_manager, \u0027nat\u0027, expected_rules)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_a9fdb4b2","line":763,"updated":"2018-09-21 14:32:19.000000000","message":"Make this more efficient by moving L763, where expected_rules gets set, inside the else.  No need to compute it if we aren\u0027t going to use it.","commit_id":"e0ff29263ff330f385c98b83741f3f92aa4853e2"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"c607dbffa9fa0058a1e9a77ec8902caf791a0b32","unresolved":false,"context_lines":[{"line_number":760,"context_line":"        # In the router namespace, check the iptables rules are set"},{"line_number":761,"context_line":"        # correctly"},{"line_number":762,"context_line":"        for fip in floating_ips:"},{"line_number":763,"context_line":"            expected_rules \u003d router.floating_forward_rules(fip)"},{"line_number":764,"context_line":"            if dvr_snat:"},{"line_number":765,"context_line":"                self._assert_iptables_rules_exist("},{"line_number":766,"context_line":"                    router.snat_iptables_manager, \u0027nat\u0027, expected_rules)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_acdf02d5","line":763,"in_reply_to":"3f79a3b5_a9fdb4b2","updated":"2018-09-21 15:23:04.000000000","message":"`expected_rules` are using in every if-else branches.","commit_id":"e0ff29263ff330f385c98b83741f3f92aa4853e2"},{"author":{"_account_id":13995,"name":"Nate Johnston","email":"nate.johnston@redhat.com","username":"natejohnston"},"change_message_id":"7e94904a26e88184fc02643d8919d5abf5b40c77","unresolved":false,"context_lines":[{"line_number":760,"context_line":"        # In the router namespace, check the iptables rules are set"},{"line_number":761,"context_line":"        # correctly"},{"line_number":762,"context_line":"        for fip in floating_ips:"},{"line_number":763,"context_line":"            expected_rules \u003d router.floating_forward_rules(fip)"},{"line_number":764,"context_line":"            if dvr_snat:"},{"line_number":765,"context_line":"                self._assert_iptables_rules_exist("},{"line_number":766,"context_line":"                    router.snat_iptables_manager, \u0027nat\u0027, expected_rules)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f79a3b5_9d682e88","line":763,"in_reply_to":"3f79a3b5_acdf02d5","updated":"2018-09-21 16:23:31.000000000","message":"Huh, I don\u0027t know how I overlooked that.","commit_id":"e0ff29263ff330f385c98b83741f3f92aa4853e2"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"77778093f91c6e7d7e915742b7b345ebeea0a16c","unresolved":false,"context_lines":[{"line_number":543,"context_line":"        router[\u0027distributed\u0027] \u003d True"},{"line_number":544,"context_line":"        router[\u0027gw_port_host\u0027] \u003d agent.conf.host"},{"line_number":545,"context_line":"        for floating_ip in router[lib_constants.FLOATINGIP_KEY]:"},{"line_number":546,"context_line":"            if enable_floating_ip:"},{"line_number":547,"context_line":"                floating_ip[\u0027host\u0027] \u003d agent.conf.host"},{"line_number":548,"context_line":""},{"line_number":549,"context_line":"        if enable_floating_ip and enable_centralized_fip:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_abe7f645","line":546,"updated":"2018-10-03 21:14:57.000000000","message":"This should probably be checked before the for() loop since there is nothing to do otherwise it looks like.","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"72f1599568d85cf2a8b24eb96c4fd9e29241c54c","unresolved":false,"context_lines":[{"line_number":543,"context_line":"        router[\u0027distributed\u0027] \u003d True"},{"line_number":544,"context_line":"        router[\u0027gw_port_host\u0027] \u003d agent.conf.host"},{"line_number":545,"context_line":"        for floating_ip in router[lib_constants.FLOATINGIP_KEY]:"},{"line_number":546,"context_line":"            if enable_floating_ip:"},{"line_number":547,"context_line":"                floating_ip[\u0027host\u0027] \u003d agent.conf.host"},{"line_number":548,"context_line":""},{"line_number":549,"context_line":"        if enable_floating_ip and enable_centralized_fip:"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_37349249","line":546,"in_reply_to":"3f79a3b5_abe7f645","updated":"2018-10-04 15:51:57.000000000","message":"Done","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"77778093f91c6e7d7e915742b7b345ebeea0a16c","unresolved":false,"context_lines":[{"line_number":562,"context_line":"            router[lib_constants.FLOATINGIP_KEY][0][\u0027host\u0027] \u003d agent.conf.host"},{"line_number":563,"context_line":"            router[lib_constants.FLOATINGIP_KEY][1]["},{"line_number":564,"context_line":"                lib_constants.DVR_SNAT_BOUND] \u003d True"},{"line_number":565,"context_line":"            router[lib_constants.FLOATINGIP_KEY][1][\u0027host\u0027] \u003d None"},{"line_number":566,"context_line":""},{"line_number":567,"context_line":"        if enable_gw:"},{"line_number":568,"context_line":"            external_gw_port \u003d router[\u0027gw_port\u0027]"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_4bf2e2e4","line":565,"updated":"2018-10-03 21:14:57.000000000","message":"So this block back to L545 is getting complicated, it needs to be refactored since we first set \u0027host\u0027 (L547), then might clear it (L553), then might set it again (L562).\n\nI think we can:\n\nif enable_floating_ip:\n   for floating_ip in router[...]:\n       if enable_centralized_fip:\n           floating_ip[\u0027host\u0027] \u003d None\n       elif snat_bound_fip:\n           floating_ip[\u0027host\u0027] \u003d agent.conf.host\n\nBut then that doesn\u0027t account for the second floating IP :(  I\u0027m just trying to think of how to make this easier to understand for the next person.","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"9a22048a004101f6efc6b67bb80f7f9b8d245c8e","unresolved":false,"context_lines":[{"line_number":562,"context_line":"            router[lib_constants.FLOATINGIP_KEY][0][\u0027host\u0027] \u003d agent.conf.host"},{"line_number":563,"context_line":"            router[lib_constants.FLOATINGIP_KEY][1]["},{"line_number":564,"context_line":"                lib_constants.DVR_SNAT_BOUND] \u003d True"},{"line_number":565,"context_line":"            router[lib_constants.FLOATINGIP_KEY][1][\u0027host\u0027] \u003d None"},{"line_number":566,"context_line":""},{"line_number":567,"context_line":"        if enable_gw:"},{"line_number":568,"context_line":"            external_gw_port \u003d router[\u0027gw_port\u0027]"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_e153cd38","line":565,"in_reply_to":"3f79a3b5_4bf2e2e4","updated":"2018-10-04 00:03:06.000000000","message":"Yes, this is really a tough one for testing the migration.","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"}],"neutron/tests/unit/agent/l3/test_agent.py":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a5e9af4b3b55346606fe72faad2df44d17b6745c","unresolved":false,"context_lines":[{"line_number":626,"context_line":"            self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":627,"context_line":"            ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":628,"context_line":"            ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":629,"context_line":"                namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":630,"context_line":"            ri._create_dvr_gateway \u003d mock.Mock()"},{"line_number":631,"context_line":"            ri.get_snat_interfaces \u003d mock.Mock(return_value\u003dself.snat_ports)"},{"line_number":632,"context_line":"            ri.snat_ports \u003d self.snat_ports"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f79a3b5_5e06d7cf","line":629,"updated":"2018-09-25 16:26:07.000000000","message":"I\u0027m a little worried about adding this init in so many places.  Is there a code path that needs to just check \"if not self.snat_iptables_manager\" in the edge router code, or do we need to initialize it all the time now?","commit_id":"4e7521e590c52cde358bc0ca5a80a0eec781ab43"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"c1515973ebe48657550cc7d8954468fb6fccf477","unresolved":false,"context_lines":[{"line_number":626,"context_line":"            self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":627,"context_line":"            ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":628,"context_line":"            ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":629,"context_line":"                namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":630,"context_line":"            ri._create_dvr_gateway \u003d mock.Mock()"},{"line_number":631,"context_line":"            ri.get_snat_interfaces \u003d mock.Mock(return_value\u003dself.snat_ports)"},{"line_number":632,"context_line":"            ri.snat_ports \u003d self.snat_ports"}],"source_content_type":"text/x-python","patch_set":8,"id":"3f79a3b5_7bf63a60","line":629,"in_reply_to":"3f79a3b5_5e06d7cf","updated":"2018-09-26 01:01:23.000000000","message":"Any time the edge router is going to process the floating IP, the snat iptables manager must be init done. So I don\u0027t think that check is necessary. That check may hide some issue. Why adding the ri.snat_iptables_manager in the code, IMO, it\u0027s because the router was never processing the `external_gateway_added` (or this method is mocked) in the unit test code here, and then directly to process the floating IPs. Such scenario will never happen in the real deployment, so, in the unit test, let\u0027s init the snat_iptables_manager straight forward.","commit_id":"4e7521e590c52cde358bc0ca5a80a0eec781ab43"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"77778093f91c6e7d7e915742b7b345ebeea0a16c","unresolved":false,"context_lines":[{"line_number":626,"context_line":"            self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":627,"context_line":"            ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":628,"context_line":"            ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":629,"context_line":"                namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":630,"context_line":"            ri._create_dvr_gateway \u003d mock.Mock()"},{"line_number":631,"context_line":"            ri.get_snat_interfaces \u003d mock.Mock(return_value\u003dself.snat_ports)"},{"line_number":632,"context_line":"            ri.snat_ports \u003d self.snat_ports"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_abba96dd","line":629,"updated":"2018-10-03 21:14:57.000000000","message":"I know I had asked in an earlier version about setting this, just can\u0027t remember the rest of the context.  I think if you added the external gateway it wasn\u0027t needed?","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"9a22048a004101f6efc6b67bb80f7f9b8d245c8e","unresolved":false,"context_lines":[{"line_number":626,"context_line":"            self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":627,"context_line":"            ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":628,"context_line":"            ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":629,"context_line":"                namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":630,"context_line":"            ri._create_dvr_gateway \u003d mock.Mock()"},{"line_number":631,"context_line":"            ri.get_snat_interfaces \u003d mock.Mock(return_value\u003dself.snat_ports)"},{"line_number":632,"context_line":"            ri.snat_ports \u003d self.snat_ports"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_c1bfb15d","line":629,"in_reply_to":"3f79a3b5_abba96dd","updated":"2018-10-04 00:03:06.000000000","message":"This is really not the key point of this fix, for most of the case in this file the add_gateway or update_gateway are mocked.","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"77778093f91c6e7d7e915742b7b345ebeea0a16c","unresolved":false,"context_lines":[{"line_number":1074,"context_line":"        if not is_dvr_edge:"},{"line_number":1075,"context_line":"            ri.process_floating_ip_nat_rules.assert_called_with()"},{"line_number":1076,"context_line":"            ri.process_floating_ip_nat_rules.reset_mock()"},{"line_number":1077,"context_line":"        elif is_dvr_edge and ri.router.get(\u0027gw_port_host\u0027) \u003d\u003d agent.host:"},{"line_number":1078,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"},{"line_number":1079,"context_line":"                assert_called_with()"},{"line_number":1080,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_ab2cd649","line":1077,"range":{"start_line":1077,"start_character":13,"end_line":1077,"end_character":24},"updated":"2018-10-03 21:14:57.000000000","message":"this is implied to be true here","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"72f1599568d85cf2a8b24eb96c4fd9e29241c54c","unresolved":false,"context_lines":[{"line_number":1074,"context_line":"        if not is_dvr_edge:"},{"line_number":1075,"context_line":"            ri.process_floating_ip_nat_rules.assert_called_with()"},{"line_number":1076,"context_line":"            ri.process_floating_ip_nat_rules.reset_mock()"},{"line_number":1077,"context_line":"        elif is_dvr_edge and ri.router.get(\u0027gw_port_host\u0027) \u003d\u003d agent.host:"},{"line_number":1078,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"},{"line_number":1079,"context_line":"                assert_called_with()"},{"line_number":1080,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_974246ac","line":1077,"range":{"start_line":1077,"start_character":13,"end_line":1077,"end_character":24},"in_reply_to":"3f79a3b5_ab2cd649","updated":"2018-10-04 15:51:57.000000000","message":"Done","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"77778093f91c6e7d7e915742b7b345ebeea0a16c","unresolved":false,"context_lines":[{"line_number":1092,"context_line":"        if not is_dvr_edge:"},{"line_number":1093,"context_line":"            ri.process_floating_ip_nat_rules.assert_called_with()"},{"line_number":1094,"context_line":"            ri.process_floating_ip_nat_rules.reset_mock()"},{"line_number":1095,"context_line":"        elif is_dvr_edge and ri.router.get(\u0027gw_port_host\u0027) \u003d\u003d agent.host:"},{"line_number":1096,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"},{"line_number":1097,"context_line":"                assert_called_with()"},{"line_number":1098,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_cb2fd23b","line":1095,"range":{"start_line":1095,"start_character":13,"end_line":1095,"end_character":24},"updated":"2018-10-03 21:14:57.000000000","message":"this is implied to be true here","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"72f1599568d85cf2a8b24eb96c4fd9e29241c54c","unresolved":false,"context_lines":[{"line_number":1092,"context_line":"        if not is_dvr_edge:"},{"line_number":1093,"context_line":"            ri.process_floating_ip_nat_rules.assert_called_with()"},{"line_number":1094,"context_line":"            ri.process_floating_ip_nat_rules.reset_mock()"},{"line_number":1095,"context_line":"        elif is_dvr_edge and ri.router.get(\u0027gw_port_host\u0027) \u003d\u003d agent.host:"},{"line_number":1096,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"},{"line_number":1097,"context_line":"                assert_called_with()"},{"line_number":1098,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_b73f4221","line":1095,"range":{"start_line":1095,"start_character":13,"end_line":1095,"end_character":24},"in_reply_to":"3f79a3b5_cb2fd23b","updated":"2018-10-04 15:51:57.000000000","message":"Done","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"77778093f91c6e7d7e915742b7b345ebeea0a16c","unresolved":false,"context_lines":[{"line_number":1123,"context_line":"        if not is_dvr_edge:"},{"line_number":1124,"context_line":"            ri.process_floating_ip_nat_rules.assert_called_with()"},{"line_number":1125,"context_line":"            ri.process_floating_ip_nat_rules.reset_mock()"},{"line_number":1126,"context_line":"        elif is_dvr_edge and ri.router.get(\u0027gw_port_host\u0027) \u003d\u003d agent.host:"},{"line_number":1127,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"},{"line_number":1128,"context_line":"                assert_called_with()"},{"line_number":1129,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_8b255a5d","line":1126,"range":{"start_line":1126,"start_character":13,"end_line":1126,"end_character":24},"updated":"2018-10-03 21:14:57.000000000","message":"here too","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"72f1599568d85cf2a8b24eb96c4fd9e29241c54c","unresolved":false,"context_lines":[{"line_number":1123,"context_line":"        if not is_dvr_edge:"},{"line_number":1124,"context_line":"            ri.process_floating_ip_nat_rules.assert_called_with()"},{"line_number":1125,"context_line":"            ri.process_floating_ip_nat_rules.reset_mock()"},{"line_number":1126,"context_line":"        elif is_dvr_edge and ri.router.get(\u0027gw_port_host\u0027) \u003d\u003d agent.host:"},{"line_number":1127,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"},{"line_number":1128,"context_line":"                assert_called_with()"},{"line_number":1129,"context_line":"            ri.process_floating_ip_nat_rules_for_centralized_floatingip. \\"}],"source_content_type":"text/x-python","patch_set":13,"id":"3f79a3b5_7713eab8","line":1126,"range":{"start_line":1126,"start_character":13,"end_line":1126,"end_character":24},"in_reply_to":"3f79a3b5_8b255a5d","updated":"2018-10-04 15:51:57.000000000","message":"Done","commit_id":"fe251219ca15381363aa771bd33a7eb624405d1d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"5b785816c688b3737a4bde0e6dfcb7a1cbf9c673","unresolved":false,"context_lines":[{"line_number":626,"context_line":"            self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":627,"context_line":"            ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":628,"context_line":"            ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":629,"context_line":"                namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":630,"context_line":"            ri._create_dvr_gateway \u003d mock.Mock()"},{"line_number":631,"context_line":"            ri.get_snat_interfaces \u003d mock.Mock(return_value\u003dself.snat_ports)"},{"line_number":632,"context_line":"            ri.snat_ports \u003d self.snat_ports"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f79a3b5_d4c7f845","line":629,"updated":"2018-10-10 00:47:54.000000000","message":"This is actually only needed in the \u0027remove\u0027 case since we\u0027re calling _add_external_gateway() otherwise, so this code can move to inside the if() at L707","commit_id":"80c2fcb4f2c13fb74b59c94368d85aa2e4b87c90"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"99f985a5036e4e44217747ad9b356f22cb5b8e11","unresolved":false,"context_lines":[{"line_number":626,"context_line":"            self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":627,"context_line":"            ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":628,"context_line":"            ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":629,"context_line":"                namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":630,"context_line":"            ri._create_dvr_gateway \u003d mock.Mock()"},{"line_number":631,"context_line":"            ri.get_snat_interfaces \u003d mock.Mock(return_value\u003dself.snat_ports)"},{"line_number":632,"context_line":"            ri.snat_ports \u003d self.snat_ports"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f79a3b5_ef6021d3","line":629,"in_reply_to":"3f79a3b5_d4c7f845","updated":"2018-10-10 01:30:26.000000000","message":"Done","commit_id":"80c2fcb4f2c13fb74b59c94368d85aa2e4b87c90"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"5b785816c688b3737a4bde0e6dfcb7a1cbf9c673","unresolved":false,"context_lines":[{"line_number":2807,"context_line":"        self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":2808,"context_line":"        ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":2809,"context_line":"        ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":2810,"context_line":"            namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":2811,"context_line":"        ri.remove_floating_ip \u003d mock.Mock()"},{"line_number":2812,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":2813,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f79a3b5_742aa4e6","line":2810,"updated":"2018-10-10 00:47:54.000000000","message":"should add the external gateway instead, see below","commit_id":"80c2fcb4f2c13fb74b59c94368d85aa2e4b87c90"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"99f985a5036e4e44217747ad9b356f22cb5b8e11","unresolved":false,"context_lines":[{"line_number":2807,"context_line":"        self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":2808,"context_line":"        ri \u003d dvr_router.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":2809,"context_line":"        ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":2810,"context_line":"            namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":2811,"context_line":"        ri.remove_floating_ip \u003d mock.Mock()"},{"line_number":2812,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":2813,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f79a3b5_8f5f2d0e","line":2810,"in_reply_to":"3f79a3b5_742aa4e6","updated":"2018-10-10 01:30:26.000000000","message":"Done","commit_id":"80c2fcb4f2c13fb74b59c94368d85aa2e4b87c90"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"5b785816c688b3737a4bde0e6dfcb7a1cbf9c673","unresolved":false,"context_lines":[{"line_number":2811,"context_line":"        ri.remove_floating_ip \u003d mock.Mock()"},{"line_number":2812,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":2813,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"},{"line_number":2814,"context_line":"        del ri.router[\u0027gw_port\u0027]"},{"line_number":2815,"context_line":"        ri.fip_ns \u003d None"},{"line_number":2816,"context_line":"        nat \u003d ri.iptables_manager.ipv4[\u0027nat\u0027]"},{"line_number":2817,"context_line":"        nat.clear_rules_by_tag \u003d mock.Mock()"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f79a3b5_f4f0f494","line":2814,"updated":"2018-10-10 00:47:54.000000000","message":"+        ri.external_gateway_added(\n+            ri.ex_gw_port,\n+            ri.get_external_device_name(ri.ex_gw_port[\u0027id\u0027]))","commit_id":"80c2fcb4f2c13fb74b59c94368d85aa2e4b87c90"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"99f985a5036e4e44217747ad9b356f22cb5b8e11","unresolved":false,"context_lines":[{"line_number":2811,"context_line":"        ri.remove_floating_ip \u003d mock.Mock()"},{"line_number":2812,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":2813,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"},{"line_number":2814,"context_line":"        del ri.router[\u0027gw_port\u0027]"},{"line_number":2815,"context_line":"        ri.fip_ns \u003d None"},{"line_number":2816,"context_line":"        nat \u003d ri.iptables_manager.ipv4[\u0027nat\u0027]"},{"line_number":2817,"context_line":"        nat.clear_rules_by_tag \u003d mock.Mock()"}],"source_content_type":"text/x-python","patch_set":14,"id":"3f79a3b5_af5a291b","line":2814,"in_reply_to":"3f79a3b5_f4f0f494","updated":"2018-10-10 01:30:26.000000000","message":"Done","commit_id":"80c2fcb4f2c13fb74b59c94368d85aa2e4b87c90"}],"neutron/tests/unit/agent/l3/test_dvr_local_router.py":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"37d5a84ba20c9c5903b7d874b3283167703d5f5d","unresolved":false,"context_lines":[{"line_number":734,"context_line":"        self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":735,"context_line":"        ri \u003d dvr_edge_rtr.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":736,"context_line":"        ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":737,"context_line":"            namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":738,"context_line":"        ri.remove_floating_ip \u003d mock.Mock()"},{"line_number":739,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":740,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_976c3bd1","line":737,"updated":"2018-09-26 13:32:11.000000000","message":"Regarding the comment about adding this in the previous PS, fo this exposes that this test is maybe not setting things up properly, and adding this init just covers over the issue.\n\nFor example, the other way to fix this is to call ri.external_gateway_added() to add the gateway before trying to remove it.  See below.","commit_id":"84d02a0b38adc58eb51d25b009dd5c003aab0409"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"74232ba29424a4db556c796e7990281cf547da77","unresolved":false,"context_lines":[{"line_number":734,"context_line":"        self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":735,"context_line":"        ri \u003d dvr_edge_rtr.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":736,"context_line":"        ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":737,"context_line":"            namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":738,"context_line":"        ri.remove_floating_ip \u003d mock.Mock()"},{"line_number":739,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":740,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_979bdb15","line":737,"in_reply_to":"3f79a3b5_1774ab35","updated":"2018-09-26 13:48:37.000000000","message":"Great, and I\u0027m not sure about the other test cases, but they might have similar fixes as well.","commit_id":"84d02a0b38adc58eb51d25b009dd5c003aab0409"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"8e243293527fea30624a19d828800b46a6e16a94","unresolved":false,"context_lines":[{"line_number":734,"context_line":"        self._set_ri_kwargs(agent, router[\u0027id\u0027], router)"},{"line_number":735,"context_line":"        ri \u003d dvr_edge_rtr.DvrEdgeRouter(HOSTNAME, **self.ri_kwargs)"},{"line_number":736,"context_line":"        ri.snat_iptables_manager \u003d iptables_manager.IptablesManager("},{"line_number":737,"context_line":"            namespace\u003dri.snat_namespace.name, use_ipv6\u003dri.use_ipv6)"},{"line_number":738,"context_line":"        ri.remove_floating_ip \u003d mock.Mock()"},{"line_number":739,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":740,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_1774ab35","line":737,"in_reply_to":"3f79a3b5_976c3bd1","updated":"2018-09-26 13:42:37.000000000","message":"Yes, both works for me, but since this case is to test `remove gateway`, so it should add gateway first. So next patch set I will change this case to call external_gateway_added().","commit_id":"84d02a0b38adc58eb51d25b009dd5c003aab0409"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"37d5a84ba20c9c5903b7d874b3283167703d5f5d","unresolved":false,"context_lines":[{"line_number":739,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":740,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"},{"line_number":741,"context_line":"        del ri.router[\u0027gw_port\u0027]"},{"line_number":742,"context_line":"        ri.fip_ns \u003d None"},{"line_number":743,"context_line":"        nat \u003d ri.iptables_manager.ipv4[\u0027nat\u0027]"},{"line_number":744,"context_line":"        nat.clear_rules_by_tag \u003d mock.Mock()"},{"line_number":745,"context_line":"        nat.add_rule \u003d mock.Mock()"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_17bcab04","line":742,"updated":"2018-09-26 13:32:11.000000000","message":"Adding this code here also works, since it causes ri.snat_iptables_manager to get initialized when the gateway is added:\n\n        ri.external_gateway_added(\n            ri.ex_gw_port,\n            ri.get_external_device_name(ri.ex_gw_port[\u0027id\u0027]))\n\nI would rather do that in the tests than just insert the above code.  This is why I was wondering if there was a missing check somewhere in the code, since the stacktrace was:\n\nCaptured traceback:\n~~~~~~~~~~~~~~~~~~~\n    Traceback (most recent call last):\n      File \"neutron/tests/base.py\", line 137, in func\n        return f(self, *args, **kwargs)\n      File \"neutron/tests/unit/agent/l3/test_dvr_local_router.py\", line 773, in test_external_gateway_removed_ext_gw_port_and_fip\n        ri.get_external_device_name(ri.ex_gw_port[\u0027id\u0027]))\n      File \"neutron/agent/l3/dvr_edge_router.py\", line 92, in external_gateway_removed\n        self._external_gateway_removed(ex_gw_port, interface_name)\n      File \"neutron/agent/l3/dvr_edge_router.py\", line 80, in _external_gateway_removed\n        interface_name)\n      File \"neutron/agent/l3/dvr_local_router.py\", line 571, in external_gateway_removed\n        self.process_floating_ip_nat_rules()\n      File \"neutron/agent/l3/dvr_edge_router.py\", line 358, in process_floating_ip_nat_rules\n        self.process_floating_ip_nat_rules_for_centralized_floatingip()\n      File \"neutron/agent/l3/dvr_edge_router.py\", line 349, in process_floating_ip_nat_rules_for_centralized_floatingip\n        self.snat_iptables_manager.ipv4[\u0027nat\u0027].clear_rules_by_tag(\n    AttributeError: \u0027NoneType\u0027 object has no attribute \u0027ipv4\u0027\n\nThat shows we\u0027re hitting code that expects ri.snat_iptables_manager to be initialized, and it\u0027s triggered from your change in dvr_edge_router.","commit_id":"84d02a0b38adc58eb51d25b009dd5c003aab0409"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"8e243293527fea30624a19d828800b46a6e16a94","unresolved":false,"context_lines":[{"line_number":739,"context_line":"        agent._fetch_external_net_id \u003d mock.Mock(return_value\u003dexternal_net_id)"},{"line_number":740,"context_line":"        ri.ex_gw_port \u003d ri.router[\u0027gw_port\u0027]"},{"line_number":741,"context_line":"        del ri.router[\u0027gw_port\u0027]"},{"line_number":742,"context_line":"        ri.fip_ns \u003d None"},{"line_number":743,"context_line":"        nat \u003d ri.iptables_manager.ipv4[\u0027nat\u0027]"},{"line_number":744,"context_line":"        nat.clear_rules_by_tag \u003d mock.Mock()"},{"line_number":745,"context_line":"        nat.add_rule \u003d mock.Mock()"}],"source_content_type":"text/x-python","patch_set":9,"id":"3f79a3b5_37a447a3","line":742,"in_reply_to":"3f79a3b5_17bcab04","updated":"2018-09-26 13:42:37.000000000","message":"Yes, this is the trace. And I don\u0027t want hide that in the code, so the code does not have any snat_iptables_manager check there.","commit_id":"84d02a0b38adc58eb51d25b009dd5c003aab0409"}]}
