)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"3dfcc6c376388c2ba3aa1375f8ca665d10a429cd","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Update default gateway in the fip namespace after subnet-update"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"After running the following command:"},{"line_number":10,"context_line":"    neutron subnet-update --gateway \u003cnew gateway IP\u003e \u003cext-net subnet ID\u003e"},{"line_number":11,"context_line":"the default gateway does not get set to \u003cnew gateway IP\u003e in the"},{"line_number":12,"context_line":"corresponding fip namespace until the l3-agent is restarted."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"The gateway does not get updated because the router is already"},{"line_number":15,"context_line":"subscribed to the fip namespace. On a restart, the fip namespace"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"dae33548_be67cbb5","line":12,"range":{"start_line":9,"start_character":0,"end_line":12,"end_character":60},"updated":"2016-02-17 18:48:39.000000000","message":"nit:  This probably goes in the bug report instead of the commit message.","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"}],"neutron/agent/l3/dvr_fip_ns.py":[{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"d7cf5f3223203df21c3ea1e395bf8e72bc5f0f54","unresolved":false,"context_lines":[{"line_number":192,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":193,"context_line":""},{"line_number":194,"context_line":"        self.create()"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"        self.update_gateway_port(agent_gateway_port)"},{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    def update_gateway_port(self, agent_gateway_port):"}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_379c2069","line":195,"updated":"2015-11-06 22:07:45.000000000","message":"Is there a conditional check in which you call the update_gateway_port or else just call update_gateway_port for every create_gateway_port.","commit_id":"a76b1c01e8c6c00fe363b6f53a41d8fa8d90be20"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"95dd724ba4fe8b3df5f661d5f6a4645ace282c16","unresolved":false,"context_lines":[{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":199,"context_line":"        iface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":200,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def _internal_ns_interface_added(self, ip_cidr,"},{"line_number":203,"context_line":"                                    interface_name, ns_name):"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba63e191_f3dde514","line":200,"updated":"2016-01-20 02:53:30.000000000","message":"Are you planning to create a new device or just update current default route? And would you please confirm that \"subnet-update --gateway\" will affect floatingip agent gateway port or not?\n\nIf that action will not affect current floatingip agent gateway port, maybe you just need update default route(if no fit method there, try IPRoute), because _gateway_added will cause unnecessary shell calls.\n\nIf that action will affect current floatingip agent gateway port, such as updating its mac, id, interface_name, by that a new device will be created in fip netns. But what about the old device? It\u0027s still there, no need to do some cleanup work for stale devices?\n\nBTW, the method name is update, but indeed the method body will do create job, not update.","commit_id":"b83096177d72d1b691d0a177ca7dd28eb845fb9d"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"792b419383a91efba913442d7e514881505ce240","unresolved":false,"context_lines":[{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":199,"context_line":"        iface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":200,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def _internal_ns_interface_added(self, ip_cidr,"},{"line_number":203,"context_line":"                                    interface_name, ns_name):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a68dd71_512bbbeb","line":200,"in_reply_to":"9a68dd71_0e74599a","updated":"2016-01-21 03:35:42.000000000","message":"Hi, Rawlin.\nFirst \"updates the default route in the fip namespace\" should be the point in this patch, I think I get your point and I\u0027m agree with that.\n\nWell, my previous concern is, whether \"subnet-update --gateway\" will change fip_agent_port(the floatingip agent gateway port) or not, specially port_id. I suppose not but I\u0027m not sure. For interface driver will create a new device based on interface_name, https://github.com/openstack/neutron/blob/master/neutron/agent/linux/interface.py#L238-L242 , if fip_agent_port isn\u0027t changed, that\u0027s cool, nothing should be worried. If not, I think we still need some cleanup code.\n\nIf just gateway_ip changed, no affect to fip_agent_port other attributes, I think it\u0027s pretty cool to refactor L119-124 and call here.\n\nThanks :)","commit_id":"b83096177d72d1b691d0a177ca7dd28eb845fb9d"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"e2c8e203983ba6e90d89a7a5eea07f17a8f026da","unresolved":false,"context_lines":[{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":199,"context_line":"        iface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":200,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def _internal_ns_interface_added(self, ip_cidr,"},{"line_number":203,"context_line":"                                    interface_name, ns_name):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a68dd71_30161cf2","line":200,"in_reply_to":"9a68dd71_49db0f7d","updated":"2016-01-21 17:02:18.000000000","message":"Thanks for verifying that! I will refactor in the next patchset.","commit_id":"b83096177d72d1b691d0a177ca7dd28eb845fb9d"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"8fe9cf238683aa6d3974cd8681bf86be4f130723","unresolved":false,"context_lines":[{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":199,"context_line":"        iface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":200,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def _internal_ns_interface_added(self, ip_cidr,"},{"line_number":203,"context_line":"                                    interface_name, ns_name):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a68dd71_49db0f7d","line":200,"in_reply_to":"9a68dd71_512bbbeb","updated":"2016-01-21 06:41:48.000000000","message":"Hi, Rawlin. I checked that, seems only \u0027gateway_ip\u0027 will be changed in fip_agent_port, not other fip_agent_port attributes, so nothing should be worried about device.\n\nAnd if you would like to refactor necessary code here, I may suggest to start from L113.","commit_id":"b83096177d72d1b691d0a177ca7dd28eb845fb9d"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"c99a14d5dea7efe90e3de4d1f22f26032099b717","unresolved":false,"context_lines":[{"line_number":197,"context_line":""},{"line_number":198,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":199,"context_line":"        iface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":200,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def _internal_ns_interface_added(self, ip_cidr,"},{"line_number":203,"context_line":"                                    interface_name, ns_name):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a68dd71_0e74599a","line":200,"in_reply_to":"ba63e191_f3dde514","updated":"2016-01-20 18:20:45.000000000","message":"Hi ZongKai, thank you for the review. The bug being fixed here is just that the default route in the fip namespace isn\u0027t being updated after a `subnet-update --gateway ...`. The default route IS updated in the snat namespace however. This code path runs when the l3-agent is restarted, which then updates the default route in the fip namespace. This patch just makes that bit of l3-agent restart code run after a `subnet-update --gateway ...` like it would during an l3-agent restart.\n\nSo updating the default route in the fip namespace will be the only change to the floatingip agent gateway port. I don\u0027t see a new device being created. _gateway_added does cause some extra shell calls in this case when (as far as the bug goes) the only thing needed is the IPRoute call to update the default gateway (L119-124).\n\nWould it be better to just refactor L119-124 into update_gateway_port, and remove the call to _gateway_added in update_gateway_port?","commit_id":"b83096177d72d1b691d0a177ca7dd28eb845fb9d"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"90508caba0acdb549cb221d8ee99b05503385e11","unresolved":false,"context_lines":[{"line_number":185,"context_line":"        iface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":186,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    def gateway_changed(self, new_agent_gateway_port):"},{"line_number":189,"context_line":"        new_gw_ip \u003d old_gw_ip \u003d \u0027\u0027"},{"line_number":190,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":191,"context_line":"            new_gw_ip \u003d new_subnet.get(\u0027gateway_ip\u0027)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_33152f9b","line":188,"range":{"start_line":188,"start_character":8,"end_line":188,"end_character":23},"updated":"2016-01-25 19:22:36.000000000","message":"This function is a private function so you can name it with a underscore.\n_check_for_gateway_ip_change","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"a8865a78f559230ce2128196719f176b1deca72b","unresolved":false,"context_lines":[{"line_number":185,"context_line":"        iface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":186,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"    def gateway_changed(self, new_agent_gateway_port):"},{"line_number":189,"context_line":"        new_gw_ip \u003d old_gw_ip \u003d \u0027\u0027"},{"line_number":190,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":191,"context_line":"            new_gw_ip \u003d new_subnet.get(\u0027gateway_ip\u0027)"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_4ed6fa4f","line":188,"range":{"start_line":188,"start_character":8,"end_line":188,"end_character":23},"in_reply_to":"9a68dd71_33152f9b","updated":"2016-01-25 20:52:34.000000000","message":"I\u0027m not sure what you mean by private function here. It needs to be called from DvrLocalRouter, so wouldn\u0027t that mean it\u0027s public?","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"90508caba0acdb549cb221d8ee99b05503385e11","unresolved":false,"context_lines":[{"line_number":191,"context_line":"            new_gw_ip \u003d new_subnet.get(\u0027gateway_ip\u0027)"},{"line_number":192,"context_line":"        for old_subnet in self.agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":193,"context_line":"            old_gw_ip \u003d old_subnet.get(\u0027gateway_ip\u0027)"},{"line_number":194,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":197,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_d3d933f4","line":194,"range":{"start_line":194,"start_character":28,"end_line":194,"end_character":37},"updated":"2016-01-25 19:22:36.000000000","message":"In this case what happens if you have more than one subnet? \nsince it is in a for loop, will it not override \u0027new_gw_ip\u0027 and \u0027old_gw_ip\u0027 and they will have the values only from the last subnet.","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"a8865a78f559230ce2128196719f176b1deca72b","unresolved":false,"context_lines":[{"line_number":191,"context_line":"            new_gw_ip \u003d new_subnet.get(\u0027gateway_ip\u0027)"},{"line_number":192,"context_line":"        for old_subnet in self.agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":193,"context_line":"            old_gw_ip \u003d old_subnet.get(\u0027gateway_ip\u0027)"},{"line_number":194,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":195,"context_line":""},{"line_number":196,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":197,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_6ec3be38","line":194,"range":{"start_line":194,"start_character":28,"end_line":194,"end_character":37},"in_reply_to":"9a68dd71_d3d933f4","updated":"2016-01-25 20:52:34.000000000","message":"Yes, that is what would happen with multiple subnets. I was following the logic of L206-211:\n\n        for subnet in agent_gateway_port[\u0027subnets\u0027]:\n            gw_ip \u003d subnet.get(\u0027gateway_ip\u0027)\n            if gw_ip:\n                ipd \u003d ip_lib.IPDevice(interface_name,\n                                      namespace\u003dns_name)\n                ipd.route.add_gateway(gw_ip)\n\nWith multiple subnets, the default route will be overwritten to whatever the gateway of the last subnet is. I\u0027m not sure how this logically makes sense if there can be multiple ipv4 subnets here, but one ipv4 subnet and one ipv6 subnet *should* work for L206-211. An ipv4 and ipv6 gateway will coexist together.\n\nShould we be differentiating between ipv4 and v6 gateways here? I.e. we can\u0027t really support multiple v4 or multiple v6 subnets, only one of each.","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"4cea891864294d9ac2e77d4efe6b469ca74ef102","unresolved":false,"context_lines":[{"line_number":186,"context_line":"    def _check_for_gateway_ip_change(self, new_agent_gateway_port):"},{"line_number":187,"context_line":"        new_gw_ip, old_gw_ip \u003d {4: \u0027\u0027, 6: \u0027\u0027}, {4: \u0027\u0027, 6: \u0027\u0027}"},{"line_number":188,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":189,"context_line":"            if new_subnet[\u0027gateway_ip\u0027]:"},{"line_number":190,"context_line":"                ip_version \u003d ip_lib.get_ip_version(new_subnet[\u0027gateway_ip\u0027])"},{"line_number":191,"context_line":"                new_gw_ip[ip_version] \u003d new_subnet[\u0027gateway_ip\u0027]"},{"line_number":192,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_0243bb6d","line":189,"updated":"2016-01-26 19:35:58.000000000","message":"In this case, again, what would happen, if first subnet[\u0027gateway_ip\u0027] in #L189 and if the first old_subnet[\u0027gateway_ip\u0027] in #L195 are different, and then the next two subnets have the same identical gateway ip.\n\nWill this logic still work? Will it not override?","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"952a74df94888becb226a54b2e2a87c99aea5ffa","unresolved":false,"context_lines":[{"line_number":186,"context_line":"    def _check_for_gateway_ip_change(self, new_agent_gateway_port):"},{"line_number":187,"context_line":"        new_gw_ip, old_gw_ip \u003d {4: \u0027\u0027, 6: \u0027\u0027}, {4: \u0027\u0027, 6: \u0027\u0027}"},{"line_number":188,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":189,"context_line":"            if new_subnet[\u0027gateway_ip\u0027]:"},{"line_number":190,"context_line":"                ip_version \u003d ip_lib.get_ip_version(new_subnet[\u0027gateway_ip\u0027])"},{"line_number":191,"context_line":"                new_gw_ip[ip_version] \u003d new_subnet[\u0027gateway_ip\u0027]"},{"line_number":192,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_a5f8b94a","line":189,"in_reply_to":"9a68dd71_0243bb6d","updated":"2016-01-26 20:02:29.000000000","message":"If there are going to be just one IPv4 and one IPv6 subnets, then this logic will work.\nMay be try to addin a \"NOTE\" in here and probably log a warning message if we have more.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"aedb76f8d42e326c318dce77b923bca0dcdaae72","unresolved":false,"context_lines":[{"line_number":186,"context_line":"    def _check_for_gateway_ip_change(self, new_agent_gateway_port):"},{"line_number":187,"context_line":"        new_gw_ip, old_gw_ip \u003d {4: \u0027\u0027, 6: \u0027\u0027}, {4: \u0027\u0027, 6: \u0027\u0027}"},{"line_number":188,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":189,"context_line":"            if new_subnet[\u0027gateway_ip\u0027]:"},{"line_number":190,"context_line":"                ip_version \u003d ip_lib.get_ip_version(new_subnet[\u0027gateway_ip\u0027])"},{"line_number":191,"context_line":"                new_gw_ip[ip_version] \u003d new_subnet[\u0027gateway_ip\u0027]"},{"line_number":192,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_be4c3f77","line":189,"in_reply_to":"9a68dd71_7b7b397c","updated":"2016-01-26 23:29:12.000000000","message":"ok, in that case we don\u0027t need a warning message here.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"a135beadfe3219fa949614a7751785a4a6f2cd8a","unresolved":false,"context_lines":[{"line_number":186,"context_line":"    def _check_for_gateway_ip_change(self, new_agent_gateway_port):"},{"line_number":187,"context_line":"        new_gw_ip, old_gw_ip \u003d {4: \u0027\u0027, 6: \u0027\u0027}, {4: \u0027\u0027, 6: \u0027\u0027}"},{"line_number":188,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":189,"context_line":"            if new_subnet[\u0027gateway_ip\u0027]:"},{"line_number":190,"context_line":"                ip_version \u003d ip_lib.get_ip_version(new_subnet[\u0027gateway_ip\u0027])"},{"line_number":191,"context_line":"                new_gw_ip[ip_version] \u003d new_subnet[\u0027gateway_ip\u0027]"},{"line_number":192,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_7b7b397c","line":189,"in_reply_to":"9a68dd71_a5f8b94a","updated":"2016-01-26 23:05:23.000000000","message":"Upon further investigation of this, it appears that there is a separate \u0027extra_subnets\u0027 key in a port dict under which new (extra) subnets will be added. In the snat namespace, link-local routes are added to the qg-* device for each \u0027extra_subnet\u0027. A subnet on a port will be added to the \u0027extra_subnets\u0027 list if the port doesn\u0027t have any \u0027fixed_ips\u0027 from that subnet.\n\nSo when you try to add more than 1 ipv4 subnet or more than 1 ipv6 subnet to this external network, the 1st subnet (for each ipv4 and ipv6) will end up in the \u0027subnets\u0027 list, while the subsequently added subnets will end up in the \u0027extra_subnets\u0027 list: https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L1395\n\nThe 1st subnet created for the external network will get the \u0027fixed_ip\u0027 which is used for the \u0027gateway_ip\u0027. Subsequent subnets don\u0027t create a \u0027fixed_ip\u0027 on the port, so they end up in \u0027extra_subnets\u0027.\n\nThat said, do we still need to issue a warning here? I don\u0027t think it will ever be issued.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"f87608f8ce42bf8fc623aefcc79eb74e91070c33","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if not self._check_for_gateway_ip_change(agent_gateway_port) or ("},{"line_number":204,"context_line":"                self.destroyed):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_3e928a58","line":205,"updated":"2016-01-27 02:31:20.000000000","message":"nit: since this assignment will be executed anyway. You can try to move it to line 203 and eliminate the duplicate at line 208","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"6b23b8b9e1c0ae3f877fddefc2012a20c9de37fa","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if not self._check_for_gateway_ip_change(agent_gateway_port) or ("},{"line_number":204,"context_line":"                self.destroyed):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_be08ba92","line":205,"in_reply_to":"9a68dd71_3e928a58","updated":"2016-01-27 02:37:20.000000000","message":"-1 for this.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"0f318b581b852bf970fc31da058dd398b2f793b8","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if not self._check_for_gateway_ip_change(agent_gateway_port) or ("},{"line_number":204,"context_line":"                self.destroyed):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"}],"source_content_type":"text/x-python","patch_set":7,"id":"7a5de9d1_11147df3","line":205,"in_reply_to":"9a68dd71_3e928a58","updated":"2016-01-27 17:08:23.000000000","message":"The reason L205 and 208 are repeated is because self._check_for_gateway_ip_change checks against the current self.agent_gateway_port. If I moved it to only L203, then _check_for_gateway_ip_change would never return True, because it would be checking against the same object every time.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"b072c7d149df93f23335c8b0f0c08652f508b2d1","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if not self._check_for_gateway_ip_change(agent_gateway_port) or ("},{"line_number":204,"context_line":"                self.destroyed):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_30096c2d","line":203,"range":{"start_line":203,"start_character":71,"end_line":203,"end_character":72},"updated":"2016-01-27 19:38:25.000000000","message":"can you check for \u0027self.destroyed\u0027 before you call _check_for_gateway_ip_change.\n\nBecause only if the namespace is not deleted, then self.agent_gateway_port will be true.","commit_id":"789c32ca7ed8bdaea4db120ef6cf1b076443b6bd"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"cab51d0fef7c9378b0c1b53af2703599017c7c00","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if not self._check_for_gateway_ip_change(agent_gateway_port) or ("},{"line_number":204,"context_line":"                self.destroyed):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_9e04f115","line":203,"range":{"start_line":203,"start_character":71,"end_line":203,"end_character":72},"in_reply_to":"7a5de9d1_30096c2d","updated":"2016-01-27 20:25:26.000000000","message":"Sure","commit_id":"789c32ca7ed8bdaea4db120ef6cf1b076443b6bd"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"60dbdf9b988ea406bf19021d5479296e2aae82f2","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if not self._check_for_gateway_ip_change(agent_gateway_port) or ("},{"line_number":204,"context_line":"                self.destroyed):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_adad058a","line":205,"range":{"start_line":205,"start_character":12,"end_line":205,"end_character":16},"updated":"2016-01-27 19:29:51.000000000","message":"Do we need this line #L205.","commit_id":"789c32ca7ed8bdaea4db120ef6cf1b076443b6bd"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"cab51d0fef7c9378b0c1b53af2703599017c7c00","unresolved":false,"context_lines":[{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if not self._check_for_gateway_ip_change(agent_gateway_port) or ("},{"line_number":204,"context_line":"                self.destroyed):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"}],"source_content_type":"text/x-python","patch_set":8,"id":"7a5de9d1_d32ca2ad","line":205,"range":{"start_line":205,"start_character":12,"end_line":205,"end_character":16},"in_reply_to":"7a5de9d1_adad058a","updated":"2016-01-27 20:25:26.000000000","message":"I figured we\u0027d need this so that self.agent_gateway_port is always up-to-date with the port that comes from the server. If we don\u0027t have L205, then we will have a stale copy of agent_gateway_port until the actual \u0027gateway_ip\u0027 has changed. There may be other fields being updated which we\u0027d want the latest copy of.","commit_id":"789c32ca7ed8bdaea4db120ef6cf1b076443b6bd"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"d08035cf9500dbdaa6b5607b0b3774f4f2192aa1","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.destroyed or ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_3eab7d8b","line":203,"range":{"start_line":203,"start_character":8,"end_line":203,"end_character":10},"updated":"2016-01-27 20:37:14.000000000","message":"I think you mis-understood my previous comment.\n\nif not self.destroyed:\n    self._check_for_gateway_ip_change(agent_gateway_port)","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"b147c564c03850fd33e6dac002f5c990a2586c1a","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.destroyed or ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_e45f920c","line":203,"range":{"start_line":203,"start_character":8,"end_line":203,"end_character":10},"in_reply_to":"7a5de9d1_3eab7d8b","updated":"2016-01-27 21:20:00.000000000","message":"I\u0027m still not sure what you mean. If the namespace is deleted,  the conditional short-circuits and self._check_for_gateway_ip_change isn\u0027t called.","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"8691db6d2b00f04070b6855fcac9b5870b77ef35","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.destroyed or ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_65cb7254","line":203,"range":{"start_line":203,"start_character":8,"end_line":203,"end_character":10},"in_reply_to":"7a5de9d1_5fb513cb","updated":"2016-01-28 16:33:58.000000000","message":"Indeed, in dvr_local_router.py L444, if fip_agent_port(the agent_gateway_port here) is None, this method update_gateway_port will be not called at all.\n\nAnd I think current code is good enough.","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"56d370519513a0a79ce2cad1ab4d32c61d694036","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.destroyed or ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_a61c0d14","line":203,"range":{"start_line":203,"start_character":8,"end_line":203,"end_character":10},"in_reply_to":"7a5de9d1_65cb7254","updated":"2016-01-28 17:45:30.000000000","message":"Hi ZongKai Li, I think you have misunderstood.\nI asked Rawlin Peters to check for \"self.agent_gateway_port before calling the _check_for_gateway_ip_change.","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"172b56fa2b055812f1d2d8780e978cc24dec1c82","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.destroyed or ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_5fb513cb","line":203,"range":{"start_line":203,"start_character":8,"end_line":203,"end_character":10},"in_reply_to":"7a5de9d1_9f52ab12","updated":"2016-01-27 22:04:24.000000000","message":"\u0027_check_for_gateway_ip_change\u0027 checks \u0027if self.agent_gateway_port\u0027 on L193. If self.agent_gateway_port doesn\u0027t exist yet (it\u0027s initialized to None on L50) _check_for_gateway_ip_change will return True (assuming the new port has at least one gateway_ip). So \u0027_check_for_gateway_ip_change\u0027 still needs to be run if self.agent_gateway_port is None.","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"93bf76b6b9d24c812feb0b2ad99b3499ee763774","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.destroyed or ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_794c7a42","line":203,"range":{"start_line":203,"start_character":8,"end_line":203,"end_character":10},"in_reply_to":"7a5de9d1_a61c0d14","updated":"2016-01-28 18:15:47.000000000","message":"Hi, Swami. I think your point is: Since L192 in previous version is removed, and update_gateway_port is added into _gateway_added, so when create_gateway_port is called, self.agent_gateway_port will None in this method. And by that, _check_for_gateway_ip_change is no need to call for previous agent_gateway_port is None.\n\nIf that\u0027s your point, I think it makes sense to check self.agent_gateway_port before _check_for_gateway_ip_change.","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ec9cbe424ee530da41514f24038531876356b5b7","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.destroyed or ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_9f52ab12","line":203,"range":{"start_line":203,"start_character":8,"end_line":203,"end_character":10},"in_reply_to":"7a5de9d1_e45f920c","updated":"2016-01-27 21:45:09.000000000","message":"That might be a redundant check here before calling _check_for_gateway_ip_change or else in that case you can just check \"if self.agent_gateway_port\" exists, then call the function \u0027_check_for_gateway_ip_change\u0027.","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":14591,"name":"Lubosz Kosnik (diltram)","email":"lubosz.kosnik@intel.com","username":"diltram"},"change_message_id":"4c95b331705a8e219f7c922183febe8161402fbf","unresolved":false,"context_lines":[{"line_number":184,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"    def _check_for_gateway_ip_change(self, new_agent_gateway_port):"},{"line_number":187,"context_line":"        new_gw_ip, old_gw_ip \u003d {4: \u0027\u0027, 6: \u0027\u0027}, {4: \u0027\u0027, 6: \u0027\u0027}"},{"line_number":188,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":189,"context_line":"            if new_subnet[\u0027gateway_ip\u0027]:"},{"line_number":190,"context_line":"                ip_version \u003d ip_lib.get_ip_version(new_subnet[\u0027gateway_ip\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"5a5ae5dd_c6d705be","line":187,"updated":"2016-02-09 11:03:42.000000000","message":"Constants","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"3dfcc6c376388c2ba3aa1375f8ca665d10a429cd","unresolved":false,"context_lines":[{"line_number":184,"context_line":"        self._gateway_added(agent_gateway_port, iface_name)"},{"line_number":185,"context_line":""},{"line_number":186,"context_line":"    def _check_for_gateway_ip_change(self, new_agent_gateway_port):"},{"line_number":187,"context_line":"        new_gw_ip, old_gw_ip \u003d {4: \u0027\u0027, 6: \u0027\u0027}, {4: \u0027\u0027, 6: \u0027\u0027}"},{"line_number":188,"context_line":"        for new_subnet in new_agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":189,"context_line":"            if new_subnet[\u0027gateway_ip\u0027]:"},{"line_number":190,"context_line":"                ip_version \u003d ip_lib.get_ip_version(new_subnet[\u0027gateway_ip\u0027])"}],"source_content_type":"text/x-python","patch_set":10,"id":"dae33548_5edb1f4f","line":187,"in_reply_to":"5a5ae5dd_c6d705be","updated":"2016-02-17 18:48:39.000000000","message":"+1.   Also, prefer None over \u0027\u0027 in this context.\n\nBut, having said that.  The way you\u0027re using these, these is really no reason to have default entries for IPv4 and IPv6.  Just initialize these to an empty dict (i.e. {})","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"3dfcc6c376388c2ba3aa1375f8ca665d10a429cd","unresolved":false,"context_lines":[{"line_number":191,"context_line":"                new_gw_ip[ip_version] \u003d new_subnet[\u0027gateway_ip\u0027]"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"        if self.agent_gateway_port:"},{"line_number":194,"context_line":"            for old_subnet in self.agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":195,"context_line":"                if old_subnet[\u0027gateway_ip\u0027]:"},{"line_number":196,"context_line":"                    ip_version \u003d ip_lib.get_ip_version("},{"line_number":197,"context_line":"                        old_subnet[\u0027gateway_ip\u0027])"},{"line_number":198,"context_line":"                    old_gw_ip[ip_version] \u003d old_subnet[\u0027gateway_ip\u0027]"},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"dae33548_5e803ff7","line":198,"range":{"start_line":194,"start_character":12,"end_line":198,"end_character":68},"updated":"2016-02-17 18:48:39.000000000","message":"This is essentially the same code as L188 - L191.  Here are some suggestions for how to write this method (I didn\u0027t actually test them out but it should all work):\n\n  def get_gateway_ips(gateway_port):\n      gw_ips \u003d {}\n      if gateway_port:\n          for subnet in gateway_port.get(\u0027subnets\u0027, []):\n              gateway_ip \u003d subnet.get(\u0027gateway_ip\u0027)\n              if gateway_ip:\n                  ip_version \u003d ip_lib.get_ip_version(gateway_ip)\n                  gw_ips[ip_version] \u003d gateway_ip\n      return gw_ips\n\n  new_gw_ips \u003d get_gateway_ips(new_agent_gateway_port)\n  old_gw_ips \u003d get_gateway_ips(self.agent_gateway_port)\n  return new_gw_ips !\u003d old_gw_ips\n\nSome number of lines but, IMO, a little bit cleaner code.  It also has a little more safety built in.","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"5ed7159f92e8064b7efbefc8056ee9d3670eb144","unresolved":false,"context_lines":[{"line_number":191,"context_line":"                new_gw_ip[ip_version] \u003d new_subnet[\u0027gateway_ip\u0027]"},{"line_number":192,"context_line":""},{"line_number":193,"context_line":"        if self.agent_gateway_port:"},{"line_number":194,"context_line":"            for old_subnet in self.agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":195,"context_line":"                if old_subnet[\u0027gateway_ip\u0027]:"},{"line_number":196,"context_line":"                    ip_version \u003d ip_lib.get_ip_version("},{"line_number":197,"context_line":"                        old_subnet[\u0027gateway_ip\u0027])"},{"line_number":198,"context_line":"                    old_gw_ip[ip_version] \u003d old_subnet[\u0027gateway_ip\u0027]"},{"line_number":199,"context_line":""},{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"bae84128_857eef16","line":198,"range":{"start_line":194,"start_character":12,"end_line":198,"end_character":68},"in_reply_to":"dae33548_5e803ff7","updated":"2016-02-23 20:11:44.000000000","message":"Done","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"3dfcc6c376388c2ba3aa1375f8ca665d10a429cd","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.agent_gateway_port and ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"dae33548_e1e53438","line":204,"range":{"start_line":203,"start_character":11,"end_line":204,"end_character":74},"updated":"2016-02-17 18:48:39.000000000","message":"nit:  Any time the boolean condition of an if statement wraps, I wonder if it should be separated out:\n\n  gateway_ip_not_changed \u003d self.agent_gateway_port and (\n                not self._check_for_gateway_ip_change(agent_gateway_port))\n  self.agent_gateway_port \u003d agent_gateway_port\n  if gateway_ip_not_changed:\n      return","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"5ed7159f92e8064b7efbefc8056ee9d3670eb144","unresolved":false,"context_lines":[{"line_number":200,"context_line":"        return new_gw_ip !\u003d old_gw_ip"},{"line_number":201,"context_line":""},{"line_number":202,"context_line":"    def update_gateway_port(self, agent_gateway_port):"},{"line_number":203,"context_line":"        if self.agent_gateway_port and ("},{"line_number":204,"context_line":"                not self._check_for_gateway_ip_change(agent_gateway_port)):"},{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"bae84128_c51e37ba","line":204,"range":{"start_line":203,"start_character":11,"end_line":204,"end_character":74},"in_reply_to":"dae33548_e1e53438","updated":"2016-02-23 20:11:44.000000000","message":"Done","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"3dfcc6c376388c2ba3aa1375f8ca665d10a429cd","unresolved":false,"context_lines":[{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":209,"context_line":"        ns_name \u003d self.get_name()"},{"line_number":210,"context_line":"        interface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":211,"context_line":"        for fixed_ip in agent_gateway_port[\u0027fixed_ips\u0027]:"}],"source_content_type":"text/x-python","patch_set":10,"id":"dae33548_2160bca4","line":208,"range":{"start_line":208,"start_character":8,"end_line":208,"end_character":52},"updated":"2016-02-17 18:48:39.000000000","message":"nit:  Not needed if you take my suggestion on L204","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"5ed7159f92e8064b7efbefc8056ee9d3670eb144","unresolved":false,"context_lines":[{"line_number":205,"context_line":"            self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":206,"context_line":"            return"},{"line_number":207,"context_line":""},{"line_number":208,"context_line":"        self.agent_gateway_port \u003d agent_gateway_port"},{"line_number":209,"context_line":"        ns_name \u003d self.get_name()"},{"line_number":210,"context_line":"        interface_name \u003d self.get_ext_device_name(agent_gateway_port[\u0027id\u0027])"},{"line_number":211,"context_line":"        for fixed_ip in agent_gateway_port[\u0027fixed_ips\u0027]:"}],"source_content_type":"text/x-python","patch_set":10,"id":"bae84128_a51b33c9","line":208,"range":{"start_line":208,"start_character":8,"end_line":208,"end_character":52},"in_reply_to":"dae33548_2160bca4","updated":"2016-02-23 20:11:44.000000000","message":"Done","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"3dfcc6c376388c2ba3aa1375f8ca665d10a429cd","unresolved":false,"context_lines":[{"line_number":217,"context_line":"        for subnet in agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":218,"context_line":"            gw_ip \u003d subnet.get(\u0027gateway_ip\u0027)"},{"line_number":219,"context_line":"            if gw_ip:"},{"line_number":220,"context_line":"                ipd \u003d ip_lib.IPDevice(interface_name,"},{"line_number":221,"context_line":"                                      namespace\u003dns_name)"},{"line_number":222,"context_line":"                ipd.route.add_gateway(gw_ip)"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"    def _internal_ns_interface_added(self, ip_cidr,"}],"source_content_type":"text/x-python","patch_set":10,"id":"dae33548_4112200a","line":221,"range":{"start_line":220,"start_character":16,"end_line":221,"end_character":56},"updated":"2016-02-17 18:48:39.000000000","message":"nit:  pull this out of the for loop.","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"5ed7159f92e8064b7efbefc8056ee9d3670eb144","unresolved":false,"context_lines":[{"line_number":217,"context_line":"        for subnet in agent_gateway_port[\u0027subnets\u0027]:"},{"line_number":218,"context_line":"            gw_ip \u003d subnet.get(\u0027gateway_ip\u0027)"},{"line_number":219,"context_line":"            if gw_ip:"},{"line_number":220,"context_line":"                ipd \u003d ip_lib.IPDevice(interface_name,"},{"line_number":221,"context_line":"                                      namespace\u003dns_name)"},{"line_number":222,"context_line":"                ipd.route.add_gateway(gw_ip)"},{"line_number":223,"context_line":""},{"line_number":224,"context_line":"    def _internal_ns_interface_added(self, ip_cidr,"}],"source_content_type":"text/x-python","patch_set":10,"id":"bae84128_a59a136c","line":221,"range":{"start_line":220,"start_character":16,"end_line":221,"end_character":56},"in_reply_to":"dae33548_4112200a","updated":"2016-02-23 20:11:44.000000000","message":"Done","commit_id":"f48d1022c88d4bd7f09e6c1f9eb71e57fbba78b1"}],"neutron/agent/l3/dvr_local_router.py":[{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"41a0e0a107890ec0c1f0bde43257f192d619441f","unresolved":false,"context_lines":[{"line_number":444,"context_line":"                    LOG.error(_LE(\"No FloatingIP agent gateway port \""},{"line_number":445,"context_line":"                                  \"returned from server for \u0027network-id\u0027: \""},{"line_number":446,"context_line":"                                  \"%s\"), ex_gw_port[\u0027network_id\u0027])"},{"line_number":447,"context_line":"            if fip_agent_port:"},{"line_number":448,"context_line":"                if \u0027subnets\u0027 not in fip_agent_port:"},{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa80f949_79d7bbed","line":447,"updated":"2015-11-04 17:42:53.000000000","message":"I am not comfortable just removing the is_first check in here.\n\u0027There should be some other way to handle the gateway ip change\" rather than from removing this check\".\n\nMay be when a gateway update happens we should probably clear the original subscribtion to the fip namespace binding to the router and then recreate one.","commit_id":"86df81bbe7096825f8c9ae014b6c47f59b6df7a8"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"acb99f8e2039b8f849b856203efaa9f498a3e4f9","unresolved":false,"context_lines":[{"line_number":444,"context_line":"                    LOG.error(_LE(\"No FloatingIP agent gateway port \""},{"line_number":445,"context_line":"                                  \"returned from server for \u0027network-id\u0027: \""},{"line_number":446,"context_line":"                                  \"%s\"), ex_gw_port[\u0027network_id\u0027])"},{"line_number":447,"context_line":"            if fip_agent_port:"},{"line_number":448,"context_line":"                if \u0027subnets\u0027 not in fip_agent_port:"},{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa80f949_b9220300","line":447,"in_reply_to":"fa80f949_79d7bbed","updated":"2015-11-04 17:45:31.000000000","message":"It would make sense to add the logic in \"external_gateway_updated\" so that it addresses any valid conditions that are specific to gateway change, either the subnet or the ip.\n\nBased on that it would take necessary action on the fip namespace.","commit_id":"86df81bbe7096825f8c9ae014b6c47f59b6df7a8"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"0edb2892a0ce6f1f33b72bfd219174f3ab616a37","unresolved":false,"context_lines":[{"line_number":444,"context_line":"                    LOG.error(_LE(\"No FloatingIP agent gateway port \""},{"line_number":445,"context_line":"                                  \"returned from server for \u0027network-id\u0027: \""},{"line_number":446,"context_line":"                                  \"%s\"), ex_gw_port[\u0027network_id\u0027])"},{"line_number":447,"context_line":"            if fip_agent_port:"},{"line_number":448,"context_line":"                if \u0027subnets\u0027 not in fip_agent_port:"},{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":1,"id":"fa80f949_b1cbf752","line":447,"in_reply_to":"fa80f949_b9220300","updated":"2015-11-04 19:01:09.000000000","message":"Thanks for the review! Testing this in a single-node devstack, the \"external_gateway_updated\" of DvrEdgeRouter gets used (instead of DvrLocalRouter), which causes it to update the default gateway for the snat namespace. The external snat gateway port gets passed there, so I\u0027m not sure that can be used to update the default gateway for the fip namespace very easily.\n\nWould it be better to just add this instead?\n \nelif fip_agent_port:\n    iface_name \u003d self.fip_ns.get_ext_device_name(fip_agent_port[\u0027id\u0027])\n    self.fip_ns._gateway_added(fip_agent_port, iface_name)\n\nI\u0027m not sure if we\u0027d want to call _gateway_added because it\u0027s private?\n\nOtherwise, I\u0027m not sure how to change things higher up the call stack to pass in the fip_agent_port to \"external_gateway_updated\" (I\u0027m new at this).","commit_id":"86df81bbe7096825f8c9ae014b6c47f59b6df7a8"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"d7cf5f3223203df21c3ea1e395bf8e72bc5f0f54","unresolved":false,"context_lines":[{"line_number":448,"context_line":"                if \u0027subnets\u0027 not in fip_agent_port:"},{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"},{"line_number":451,"context_line":"                    self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":452,"context_line":"            elif fip_agent_port and \u0027subnets\u0027 in fip_agent_port:"},{"line_number":453,"context_line":"                self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":454,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_97986c6c","line":451,"updated":"2015-11-06 22:07:45.000000000","message":"How does this check tell you if you need to update the gateway port or not. I still don\u0027t get it right.","commit_id":"a76b1c01e8c6c00fe363b6f53a41d8fa8d90be20"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"b6a768129a67c741df012fd5d4d27b2ca9afd8db","unresolved":false,"context_lines":[{"line_number":448,"context_line":"                if \u0027subnets\u0027 not in fip_agent_port:"},{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"},{"line_number":451,"context_line":"                    self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":452,"context_line":"            elif fip_agent_port and \u0027subnets\u0027 in fip_agent_port:"},{"line_number":453,"context_line":"                self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":454,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_f74e9895","line":451,"in_reply_to":"da85f559_97986c6c","updated":"2015-11-06 22:22:54.000000000","message":"When you do a \"neutron subnet-update --gateway ...\" with a new gateway, this \"create_dvr_fip_interfaces\" method is called. Currently, the gateway won\u0027t be updated unless the router is the first subscriber to the fip ns. is_first is False when the router is already subscribed to the fip ns. However, \"create_dvr_fip_interfaces\" wouldn\u0027t have been called in the first place if the gateway didn\u0027t need to be updated or created. The current behavior ignores the fact that it may need to be updated.","commit_id":"a76b1c01e8c6c00fe363b6f53a41d8fa8d90be20"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"42c6a3e47d128783d4736f19792ecbfd5adda3b3","unresolved":false,"context_lines":[{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"},{"line_number":451,"context_line":"                    self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":452,"context_line":"            elif fip_agent_port and \u0027subnets\u0027 in fip_agent_port:"},{"line_number":453,"context_line":"                self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":454,"context_line":""},{"line_number":455,"context_line":"            if (self.fip_ns.agent_gateway_port and"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa69d971_08c34358","line":452,"updated":"2016-01-06 06:06:34.000000000","message":"The change makes sense to me, but I have the same question as Swaminathan at my first sight of the code. How about this struct:\n\nif fip_agent_port:\n    if \u0027subnets\u0027 not in fip_agent_port:\n        LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))\n    else:\n        if is_first:\n            self.fip_ns.create_gateway_port(fip_agent_port)\n        else:\n            self.fip_ns.update_gateway_port(fip_agent_port)","commit_id":"a76b1c01e8c6c00fe363b6f53a41d8fa8d90be20"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"f78f1cdd2969f63127b999cb5ae7138eebefd450","unresolved":false,"context_lines":[{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"},{"line_number":451,"context_line":"                    self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":452,"context_line":"            elif fip_agent_port and \u0027subnets\u0027 in fip_agent_port:"},{"line_number":453,"context_line":"                self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":454,"context_line":""},{"line_number":455,"context_line":"            if (self.fip_ns.agent_gateway_port and"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba63e191_5cbe52d5","line":452,"in_reply_to":"fa69d971_056f85fc","updated":"2016-01-19 20:34:13.000000000","message":"Done","commit_id":"a76b1c01e8c6c00fe363b6f53a41d8fa8d90be20"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"a42acc65c41726fdbfa44d276319492034c9980c","unresolved":false,"context_lines":[{"line_number":449,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":450,"context_line":"                else:"},{"line_number":451,"context_line":"                    self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":452,"context_line":"            elif fip_agent_port and \u0027subnets\u0027 in fip_agent_port:"},{"line_number":453,"context_line":"                self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":454,"context_line":""},{"line_number":455,"context_line":"            if (self.fip_ns.agent_gateway_port and"}],"source_content_type":"text/x-python","patch_set":3,"id":"fa69d971_056f85fc","line":452,"in_reply_to":"fa69d971_08c34358","updated":"2016-01-06 22:08:53.000000000","message":"Yes Hong Hui Xiao suggestion above is more clean then the one that you have mentioned.","commit_id":"a76b1c01e8c6c00fe363b6f53a41d8fa8d90be20"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"04e131eb64288b19b34e6d0be22342bc790b6ef9","unresolved":false,"context_lines":[{"line_number":441,"context_line":"                    LOG.error(_LE(\"No FloatingIP agent gateway port \""},{"line_number":442,"context_line":"                                  \"returned from server for \u0027network-id\u0027: \""},{"line_number":443,"context_line":"                                  \"%s\"), ex_gw_port[\u0027network_id\u0027])"},{"line_number":444,"context_line":"            if fip_agent_port:"},{"line_number":445,"context_line":"                if \u0027subnets\u0027 not in fip_agent_port:"},{"line_number":446,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":447,"context_line":"                else:"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a68dd71_47914af0","line":444,"range":{"start_line":444,"start_character":29,"end_line":444,"end_character":30},"updated":"2016-01-23 00:08:29.000000000","message":"As mentioned to you, you can compare the subnet gateway ip in fip_agent_port and self.fip_ns.agent_gateway_port to make sure if there is a chage.\nThen you can call the update_gateway_port instead of calling it for every hit.","commit_id":"50004920b4d2e21b786b7588d80b5716220978cc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"9ea4b9f4a011c69b3316f8afa68f35bd2cf4d493","unresolved":false,"context_lines":[{"line_number":445,"context_line":"                if \u0027subnets\u0027 not in fip_agent_port:"},{"line_number":446,"context_line":"                    LOG.error(_LE(\u0027Missing subnet/agent_gateway_port\u0027))"},{"line_number":447,"context_line":"                else:"},{"line_number":448,"context_line":"                    if is_first:"},{"line_number":449,"context_line":"                        self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":450,"context_line":"                    else:"},{"line_number":451,"context_line":"                        self.fip_ns.update_gateway_port(fip_agent_port)"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a68dd71_1c308ae7","line":448,"range":{"start_line":448,"start_character":31,"end_line":448,"end_character":32},"updated":"2016-01-22 20:56:22.000000000","message":"Can you make this patch dependent on the given patch below [1].\nI am suggesting some changes to this logic, I don\u0027t want you to rebase again.\n[1]https://review.openstack.org/#/c/270532/","commit_id":"50004920b4d2e21b786b7588d80b5716220978cc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"90508caba0acdb549cb221d8ee99b05503385e11","unresolved":false,"context_lines":[{"line_number":447,"context_line":"                else:"},{"line_number":448,"context_line":"                    if is_first:"},{"line_number":449,"context_line":"                        self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":450,"context_line":"                    elif self.fip_ns.gateway_changed(fip_agent_port) and ("},{"line_number":451,"context_line":"                            not self.fip_ns.destroyed):"},{"line_number":452,"context_line":"                        self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":453,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_13b82b74","line":450,"range":{"start_line":450,"start_character":37,"end_line":450,"end_character":52},"updated":"2016-01-25 19:22:36.000000000","message":"See my comment in the other file for changing the name of this function.","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"fb6c8b16e563a6c69d9f79a6c61dc5e0ef98a74a","unresolved":false,"context_lines":[{"line_number":447,"context_line":"                else:"},{"line_number":448,"context_line":"                    if is_first:"},{"line_number":449,"context_line":"                        self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":450,"context_line":"                    elif self.fip_ns.gateway_changed(fip_agent_port) and ("},{"line_number":451,"context_line":"                            not self.fip_ns.destroyed):"},{"line_number":452,"context_line":"                        self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":453,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_bc9d670b","line":450,"range":{"start_line":450,"start_character":37,"end_line":450,"end_character":52},"in_reply_to":"9a68dd71_13b82b74","updated":"2016-01-25 22:42:06.000000000","message":"Would it be better to move the \"gateway_changed and not destroyed\" checks into the update_gateway_port method itself as a guard? This would then become:\n\nif is_first:\n    self.fip_ns.create_gateway_port(fip_agent_port)\nelse:\n    self.fip_ns.update_gateway_port(fip_agent_port)","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"205ca1db60474fd34eb05b49f850af857ba9b815","unresolved":false,"context_lines":[{"line_number":447,"context_line":"                else:"},{"line_number":448,"context_line":"                    if is_first:"},{"line_number":449,"context_line":"                        self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":450,"context_line":"                    elif self.fip_ns.gateway_changed(fip_agent_port) and ("},{"line_number":451,"context_line":"                            not self.fip_ns.destroyed):"},{"line_number":452,"context_line":"                        self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":453,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_d847d549","line":450,"range":{"start_line":450,"start_character":37,"end_line":450,"end_character":52},"in_reply_to":"9a68dd71_7dc6db17","updated":"2016-01-26 18:46:23.000000000","message":"To make the gateway_changed function private, I renamed it and moved the guard into the update_gateway_port method.","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"96c403bd7f778843ce859f7030f305a38ee8b0f2","unresolved":false,"context_lines":[{"line_number":447,"context_line":"                else:"},{"line_number":448,"context_line":"                    if is_first:"},{"line_number":449,"context_line":"                        self.fip_ns.create_gateway_port(fip_agent_port)"},{"line_number":450,"context_line":"                    elif self.fip_ns.gateway_changed(fip_agent_port) and ("},{"line_number":451,"context_line":"                            not self.fip_ns.destroyed):"},{"line_number":452,"context_line":"                        self.fip_ns.update_gateway_port(fip_agent_port)"},{"line_number":453,"context_line":""}],"source_content_type":"text/x-python","patch_set":6,"id":"9a68dd71_7dc6db17","line":450,"range":{"start_line":450,"start_character":37,"end_line":450,"end_character":52},"in_reply_to":"9a68dd71_bc9d670b","updated":"2016-01-26 18:01:24.000000000","message":"I think the current way you call gateway_changed is ok with me.  I don\u0027t see any advantage in moving the gateway_changed to the \"update_gateway_port\u0027.","commit_id":"f2f34008d1164bc682f28e5bc199a10381088da8"}],"neutron/tests/unit/agent/l3/test_dvr_fip_ns.py":[{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"3953d4a6206638132b88b4daba12b870d6844264","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        return agent_gw_port"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    @mock.patch.object(ip_lib, \u0027IPWrapper\u0027)"},{"line_number":93,"context_line":"    @mock.patch.object(ip_lib, \u0027IPDevice\u0027)"},{"line_number":94,"context_line":"    @mock.patch.object(ip_lib, \u0027device_exists\u0027)"},{"line_number":95,"context_line":"    def test_gateway_added(self, device_exists, IPDevice, IPWrapper):"},{"line_number":96,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_3e512a63","line":93,"updated":"2016-01-27 02:47:40.000000000","message":"no need mock for IPWrapper and IPDevice here.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"907f644dc00753f36c2a91c169154cea1ac68dea","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        return agent_gw_port"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    @mock.patch.object(ip_lib, \u0027IPWrapper\u0027)"},{"line_number":93,"context_line":"    @mock.patch.object(ip_lib, \u0027IPDevice\u0027)"},{"line_number":94,"context_line":"    @mock.patch.object(ip_lib, \u0027device_exists\u0027)"},{"line_number":95,"context_line":"    def test_gateway_added(self, device_exists, IPDevice, IPWrapper):"},{"line_number":96,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"}],"source_content_type":"text/x-python","patch_set":7,"id":"7a5de9d1_cd1ac16e","line":93,"in_reply_to":"7a5de9d1_91038d0f","updated":"2016-01-27 19:16:21.000000000","message":"Ok I just confirmed that IPDevice doesn\u0027t need to be mocked, but IPWrapper does. Without mocking IPWrapper, this error is logged: \"Exit code: 1; Stdin: ; Stdout: ; Stderr: Cannot open network namespace \"fip-ba8ff785-4aef-4a14-94d5-92e1260f295d\": No such file or directory\"","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"5b15a50f1b2db83805a269f77df76ef56a6c08fd","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        return agent_gw_port"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    @mock.patch.object(ip_lib, \u0027IPWrapper\u0027)"},{"line_number":93,"context_line":"    @mock.patch.object(ip_lib, \u0027IPDevice\u0027)"},{"line_number":94,"context_line":"    @mock.patch.object(ip_lib, \u0027device_exists\u0027)"},{"line_number":95,"context_line":"    def test_gateway_added(self, device_exists, IPDevice, IPWrapper):"},{"line_number":96,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"}],"source_content_type":"text/x-python","patch_set":7,"id":"7a5de9d1_506956bd","line":93,"in_reply_to":"7a5de9d1_cd1ac16e","updated":"2016-01-28 16:34:53.000000000","message":"Well, I think that\u0027s OK to me. I tested this test case without mack IPWrapper on my local env, and no error raised, not sure why.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"0f318b581b852bf970fc31da058dd398b2f793b8","unresolved":false,"context_lines":[{"line_number":90,"context_line":"        return agent_gw_port"},{"line_number":91,"context_line":""},{"line_number":92,"context_line":"    @mock.patch.object(ip_lib, \u0027IPWrapper\u0027)"},{"line_number":93,"context_line":"    @mock.patch.object(ip_lib, \u0027IPDevice\u0027)"},{"line_number":94,"context_line":"    @mock.patch.object(ip_lib, \u0027device_exists\u0027)"},{"line_number":95,"context_line":"    def test_gateway_added(self, device_exists, IPDevice, IPWrapper):"},{"line_number":96,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"}],"source_content_type":"text/x-python","patch_set":7,"id":"7a5de9d1_91038d0f","line":93,"in_reply_to":"9a68dd71_3e512a63","updated":"2016-01-27 17:08:23.000000000","message":"If I remove them, won\u0027t the ip_wrapper call in _gateway_added actually try to run a command on a nonexistent netns? Also, IPDevice will be called in the self.driver.init_l3 method. Am I mistaken that it will try to modify the underlying system?","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"3953d4a6206638132b88b4daba12b870d6844264","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"},{"line_number":130,"context_line":"        self.fip_ns.agent_gateway_port \u003d agent_gw_port"},{"line_number":131,"context_line":"        self.assertFalse(self.fip_ns._check_for_gateway_ip_change("},{"line_number":132,"context_line":"            agent_gw_port))"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    def test_check_gateway_ip_changed_v4(self):"},{"line_number":135,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a68dd71_7e71e2df","line":132,"updated":"2016-01-27 02:47:40.000000000","message":"nit: update this case to gateway_ip not changes, but some other attributes of agent_gateway_port change, may make this test more helpful.","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"0f318b581b852bf970fc31da058dd398b2f793b8","unresolved":false,"context_lines":[{"line_number":129,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"},{"line_number":130,"context_line":"        self.fip_ns.agent_gateway_port \u003d agent_gw_port"},{"line_number":131,"context_line":"        self.assertFalse(self.fip_ns._check_for_gateway_ip_change("},{"line_number":132,"context_line":"            agent_gw_port))"},{"line_number":133,"context_line":""},{"line_number":134,"context_line":"    def test_check_gateway_ip_changed_v4(self):"},{"line_number":135,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"}],"source_content_type":"text/x-python","patch_set":7,"id":"7a5de9d1_941a9b6d","line":132,"in_reply_to":"9a68dd71_7e71e2df","updated":"2016-01-27 17:08:23.000000000","message":"Ok, I like that idea","commit_id":"45400a973f947b896daa590a44a0aeb123a79bcf"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"2055cf632320abacfc1c43d110b4c77e9d578e69","unresolved":false,"context_lines":[{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"import mock"},{"line_number":16,"context_line":"import copy"},{"line_number":17,"context_line":"from oslo_utils import uuidutils"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"from neutron.agent.common import utils"}],"source_content_type":"text/x-python","patch_set":9,"id":"7a5de9d1_91f29f99","line":16,"range":{"start_line":16,"start_character":7,"end_line":16,"end_character":11},"updated":"2016-01-27 22:32:30.000000000","message":"Note to self: alphabetize imports for pep8.","commit_id":"ef45174927828af9ffcd734b6f8a513c840a303d"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"91da9ae32917d1cffb726679469f67f350f19efa","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        self.assertTrue(self.fip_ns._check_for_gateway_ip_change("},{"line_number":160,"context_line":"            agent_gw_port))"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def test_check_gateway_ip_changed_from_none(self):"},{"line_number":163,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"},{"line_number":164,"context_line":"        self.fip_ns.agent_gateway_port \u003d None"},{"line_number":165,"context_line":"        self.assertTrue(self.fip_ns._check_for_gateway_ip_change("},{"line_number":166,"context_line":"            agent_gw_port))"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"    @mock.patch.object(iptables_manager, \u0027IptablesManager\u0027)"},{"line_number":169,"context_line":"    @mock.patch.object(utils, \u0027execute\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bae84128_9e1bca80","line":166,"range":{"start_line":162,"start_character":4,"end_line":166,"end_character":27},"updated":"2016-02-24 02:32:26.000000000","message":"I think this is over tested. If fip_ns.agent_gateway_port is None, then in method update_gateway_port, it has no chance to call _check_for_gateway_ip_change, and beside that, I don\u0027t notice if there is any other places _check_for_gateway_ip_change will be called.","commit_id":"1366c8ab029861fee1c7c4a6e3bf388da516af43"},{"author":{"_account_id":16800,"name":"Rawlin Peters","email":"rawlin.peters@hpe.com","username":"rawlin"},"change_message_id":"22a56d61eebe14153e5caa904d3a02580e970ef6","unresolved":false,"context_lines":[{"line_number":159,"context_line":"        self.assertTrue(self.fip_ns._check_for_gateway_ip_change("},{"line_number":160,"context_line":"            agent_gw_port))"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":"    def test_check_gateway_ip_changed_from_none(self):"},{"line_number":163,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"},{"line_number":164,"context_line":"        self.fip_ns.agent_gateway_port \u003d None"},{"line_number":165,"context_line":"        self.assertTrue(self.fip_ns._check_for_gateway_ip_change("},{"line_number":166,"context_line":"            agent_gw_port))"},{"line_number":167,"context_line":""},{"line_number":168,"context_line":"    @mock.patch.object(iptables_manager, \u0027IptablesManager\u0027)"},{"line_number":169,"context_line":"    @mock.patch.object(utils, \u0027execute\u0027)"}],"source_content_type":"text/x-python","patch_set":11,"id":"bae84128_478dc7d1","line":166,"range":{"start_line":162,"start_character":4,"end_line":166,"end_character":27},"in_reply_to":"bae84128_9e1bca80","updated":"2016-02-24 17:17:39.000000000","message":"Done","commit_id":"1366c8ab029861fee1c7c4a6e3bf388da516af43"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"74d769626f2e5f49ee47e09886dab40649ccb21d","unresolved":false,"context_lines":[{"line_number":76,"context_line":"        agent_gw_port \u003d {\u0027fixed_ips\u0027: [{\u0027ip_address\u0027: \u002720.0.0.30\u0027,"},{"line_number":77,"context_line":"                                        \u0027prefixlen\u0027: 24,"},{"line_number":78,"context_line":"                                        \u0027subnet_id\u0027: v4_subnet_id},"},{"line_number":79,"context_line":"                                       {\u0027ip_address\u0027: \u0027cafe:dead:beef::3\u0027,"},{"line_number":80,"context_line":"                                        \u0027prefixlen\u0027: 64,"},{"line_number":81,"context_line":"                                        \u0027subnet_id\u0027: v6_subnet_id}],"},{"line_number":82,"context_line":"                         \u0027subnets\u0027: [{\u0027id\u0027: v4_subnet_id,"}],"source_content_type":"text/x-python","patch_set":12,"id":"bae84128_6cbfcbfc","line":79,"updated":"2016-02-25 16:33:11.000000000","message":"nit: 2001:db8::3 it\u0027s the IPv6 doc prefix","commit_id":"a0f7153f9512ce313f0c8762889fe3ef6b455a32"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"74d769626f2e5f49ee47e09886dab40649ccb21d","unresolved":false,"context_lines":[{"line_number":155,"context_line":"    def test_check_gateway_ip_changed_v6(self):"},{"line_number":156,"context_line":"        agent_gw_port \u003d self._get_agent_gw_port()"},{"line_number":157,"context_line":"        self.fip_ns.agent_gateway_port \u003d copy.deepcopy(agent_gw_port)"},{"line_number":158,"context_line":"        agent_gw_port[\u0027subnets\u0027][1][\u0027gateway_ip\u0027] \u003d \u0027cafe:dead:beef::2\u0027"},{"line_number":159,"context_line":"        self.assertTrue(self.fip_ns._check_for_gateway_ip_change("},{"line_number":160,"context_line":"            agent_gw_port))"},{"line_number":161,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"bae84128_6c46ab22","line":158,"updated":"2016-02-25 16:33:11.000000000","message":"ditto","commit_id":"a0f7153f9512ce313f0c8762889fe3ef6b455a32"}],"neutron/tests/unit/agent/l3/test_dvr_local_router.py":[{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"95dd724ba4fe8b3df5f661d5f6a4645ace282c16","unresolved":false,"context_lines":[{"line_number":162,"context_line":"    def test_create_dvr_fip_interfaces_update(self):"},{"line_number":163,"context_line":"        ri \u003d self._create_router()"},{"line_number":164,"context_line":"        fip_agent_port \u003d {\u0027subnets\u0027: []}"},{"line_number":165,"context_line":"        ri.get_floating_agent_gw_interface \u003d mock.Mock()"},{"line_number":166,"context_line":"        ri.get_floating_agent_gw_interface.return_value \u003d fip_agent_port"},{"line_number":167,"context_line":"        ri.get_floating_ips \u003d mock.Mock()"},{"line_number":168,"context_line":"        ri.get_floating_ips.return_value \u003d True"},{"line_number":169,"context_line":"        ri.fip_ns \u003d mock.Mock()"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba63e191_5802d00c","line":166,"range":{"start_line":165,"start_character":8,"end_line":166,"end_character":72},"updated":"2016-01-20 02:53:30.000000000","message":"nit: can be merged into one statement:\n  ri.get_floating_agent_gw_interface \u003d mock.Mock()\n      return_value\u003dfip_agent_port)","commit_id":"b83096177d72d1b691d0a177ca7dd28eb845fb9d"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"95dd724ba4fe8b3df5f661d5f6a4645ace282c16","unresolved":false,"context_lines":[{"line_number":165,"context_line":"        ri.get_floating_agent_gw_interface \u003d mock.Mock()"},{"line_number":166,"context_line":"        ri.get_floating_agent_gw_interface.return_value \u003d fip_agent_port"},{"line_number":167,"context_line":"        ri.get_floating_ips \u003d mock.Mock()"},{"line_number":168,"context_line":"        ri.get_floating_ips.return_value \u003d True"},{"line_number":169,"context_line":"        ri.fip_ns \u003d mock.Mock()"},{"line_number":170,"context_line":"        ri.fip_ns.subscribe.return_value \u003d False"},{"line_number":171,"context_line":"        ex_gw_port \u003d {\u0027network_id\u0027: \u0027fake_net_id\u0027}"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba63e191_1303d90e","line":168,"updated":"2016-01-20 02:53:30.000000000","message":"ditto","commit_id":"b83096177d72d1b691d0a177ca7dd28eb845fb9d"}]}
