)]}'
{"neutron/agent/l3/dvr_edge_router.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"d7fdb0e8752d60697be9132e0ad817b2fe639358","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            # newly created gateway"},{"line_number":60,"context_line":"            return self.external_gateway_added(ex_gw_port, interface_name)"},{"line_number":61,"context_line":"        else:"},{"line_number":62,"context_line":"            ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"},{"line_number":63,"context_line":"            rtr_snat_ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":64,"context_line":"            if ns_name \u003d\u003d rtr_snat_ns_name:"},{"line_number":65,"context_line":"                self._external_gateway_added(ex_gw_port,"},{"line_number":66,"context_line":"                                             interface_name,"},{"line_number":67,"context_line":"                                             ns_name,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a061dce_4b059cc0","line":64,"range":{"start_line":62,"start_character":12,"end_line":64,"end_character":43},"updated":"2016-04-04 21:53:27.000000000","message":"This code seems to be repeated more than just a couple times.","commit_id":"02288b76800c60812a2ff6224c360ca553efc7d1"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"bc02dd0464bea105c8f17668f6915f74711ec305","unresolved":false,"context_lines":[{"line_number":59,"context_line":"            # newly created gateway"},{"line_number":60,"context_line":"            return self.external_gateway_added(ex_gw_port, interface_name)"},{"line_number":61,"context_line":"        else:"},{"line_number":62,"context_line":"            ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"},{"line_number":63,"context_line":"            rtr_snat_ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":64,"context_line":"            if ns_name \u003d\u003d rtr_snat_ns_name:"},{"line_number":65,"context_line":"                self._external_gateway_added(ex_gw_port,"},{"line_number":66,"context_line":"                                             interface_name,"},{"line_number":67,"context_line":"                                             ns_name,"}],"source_content_type":"text/x-python","patch_set":4,"id":"9a061dce_c8bb6d71","line":64,"range":{"start_line":62,"start_character":12,"end_line":64,"end_character":43},"in_reply_to":"9a061dce_4b059cc0","updated":"2016-04-05 00:35:56.000000000","message":"Yes will probably add it to a function.","commit_id":"02288b76800c60812a2ff6224c360ca553efc7d1"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e1cba7a013dc46a57f9dd5f98c9b3791b00ba09b","unresolved":false,"context_lines":[{"line_number":71,"context_line":"            rtr_snat_ns_name \u003d self.snat_namespace.name"},{"line_number":72,"context_line":"        except AttributeError:"},{"line_number":73,"context_line":"            rtr_snat_ns_name \u003d None"},{"line_number":74,"context_line":"        return rtr_snat_ns_name"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def _get_valid_snat_namespace_name(self):"},{"line_number":77,"context_line":"        ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_4cbd4401","line":74,"updated":"2016-04-06 16:59:15.000000000","message":"This can be simplified to remove the local variable\n\ntry:\n    return self.snat_namespace.name\nexcept AttributeError:\n    pass","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"a7dc61a8916638cd0047329c3b4296596790287c","unresolved":false,"context_lines":[{"line_number":71,"context_line":"            rtr_snat_ns_name \u003d self.snat_namespace.name"},{"line_number":72,"context_line":"        except AttributeError:"},{"line_number":73,"context_line":"            rtr_snat_ns_name \u003d None"},{"line_number":74,"context_line":"        return rtr_snat_ns_name"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def _get_valid_snat_namespace_name(self):"},{"line_number":77,"context_line":"        ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_56f78158","line":74,"in_reply_to":"9a061dce_4cbd4401","updated":"2016-04-06 23:01:32.000000000","message":"will fix it.","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e1cba7a013dc46a57f9dd5f98c9b3791b00ba09b","unresolved":false,"context_lines":[{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def _get_valid_snat_namespace_name(self):"},{"line_number":77,"context_line":"        ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"},{"line_number":78,"context_line":"        rtr_snat_ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":79,"context_line":"        if ns_name \u003d\u003d rtr_snat_ns_name:"},{"line_number":80,"context_line":"            return rtr_snat_ns_name"},{"line_number":81,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_ac01806c","line":78,"updated":"2016-04-06 16:59:15.000000000","message":"If rtr_snat_ns_name is None, will ns_name ever not be None?  It seems to reduce the call to ip_lib something like this is better:\n\nrtr_snat_ns_name \u003d self._get_router_snat_namespace_name()\nif rtr_snat_ns_name:\n    \"check for namespace existence\"","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"a7dc61a8916638cd0047329c3b4296596790287c","unresolved":false,"context_lines":[{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def _get_valid_snat_namespace_name(self):"},{"line_number":77,"context_line":"        ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"},{"line_number":78,"context_line":"        rtr_snat_ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":79,"context_line":"        if ns_name \u003d\u003d rtr_snat_ns_name:"},{"line_number":80,"context_line":"            return rtr_snat_ns_name"},{"line_number":81,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_f6b33598","line":78,"in_reply_to":"9a061dce_ac01806c","updated":"2016-04-06 23:01:32.000000000","message":"ns_name retrieved from the line below\nns_name \u003d dvr_snat_ns.SnatNamespace.get_snat_ns_name(router_id)\nwill never be none, since it is name that we create for the snat_namespace.\n\nThere are chances that if the namespace does not exist in the system, we may return a none","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e1cba7a013dc46a57f9dd5f98c9b3791b00ba09b","unresolved":false,"context_lines":[{"line_number":88,"context_line":"            return"},{"line_number":89,"context_line":"        ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":90,"context_line":"        if ns_name is not None:"},{"line_number":91,"context_line":"            self.driver.unplug(interface_name,"},{"line_number":92,"context_line":"                               bridge\u003dself.agent_conf.external_network_bridge,"},{"line_number":93,"context_line":"                               namespace\u003dns_name,"},{"line_number":94,"context_line":"                               prefix\u003drouter.EXTERNAL_DEV_PREFIX)"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_ecda58e7","line":91,"updated":"2016-04-06 16:59:15.000000000","message":"Will unplug() ever throw an exception?  I thought it wrapped it\u0027s calls in a try/except","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"a7dc61a8916638cd0047329c3b4296596790287c","unresolved":false,"context_lines":[{"line_number":88,"context_line":"            return"},{"line_number":89,"context_line":"        ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":90,"context_line":"        if ns_name is not None:"},{"line_number":91,"context_line":"            self.driver.unplug(interface_name,"},{"line_number":92,"context_line":"                               bridge\u003dself.agent_conf.external_network_bridge,"},{"line_number":93,"context_line":"                               namespace\u003dns_name,"},{"line_number":94,"context_line":"                               prefix\u003drouter.EXTERNAL_DEV_PREFIX)"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_76a8c520","line":91,"in_reply_to":"9a061dce_ecda58e7","updated":"2016-04-06 23:01:32.000000000","message":"I don\u0027t think this throws exeception, if I remember correct.","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e1cba7a013dc46a57f9dd5f98c9b3791b00ba09b","unresolved":false,"context_lines":[{"line_number":93,"context_line":"                               namespace\u003dns_name,"},{"line_number":94,"context_line":"                               prefix\u003drouter.EXTERNAL_DEV_PREFIX)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def _check_and_get_valid_namespace(self, router_id):"},{"line_number":97,"context_line":"        ns_name \u003d dvr_snat_ns.SnatNamespace.get_snat_ns_name(router_id)"},{"line_number":98,"context_line":"        ip_wrapper \u003d ip_lib.IPWrapper(namespace\u003dns_name)"},{"line_number":99,"context_line":"        if ip_wrapper.netns.exists(ns_name):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_71a2a1fe","line":96,"updated":"2016-04-06 16:59:15.000000000","message":"nit: can you move this up to L75 or so to keep these helpers next to each other?  i.e. on one screen in an editor :)","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"a7dc61a8916638cd0047329c3b4296596790287c","unresolved":false,"context_lines":[{"line_number":93,"context_line":"                               namespace\u003dns_name,"},{"line_number":94,"context_line":"                               prefix\u003drouter.EXTERNAL_DEV_PREFIX)"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"    def _check_and_get_valid_namespace(self, router_id):"},{"line_number":97,"context_line":"        ns_name \u003d dvr_snat_ns.SnatNamespace.get_snat_ns_name(router_id)"},{"line_number":98,"context_line":"        ip_wrapper \u003d ip_lib.IPWrapper(namespace\u003dns_name)"},{"line_number":99,"context_line":"        if ip_wrapper.netns.exists(ns_name):"}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_f66a15ec","line":96,"in_reply_to":"9a061dce_71a2a1fe","updated":"2016-04-06 23:01:32.000000000","message":"will move it.","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e1cba7a013dc46a57f9dd5f98c9b3791b00ba09b","unresolved":false,"context_lines":[{"line_number":102,"context_line":"    def external_gateway_removed(self, ex_gw_port, interface_name):"},{"line_number":103,"context_line":"        self._external_gateway_removed(ex_gw_port, interface_name)"},{"line_number":104,"context_line":"        ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"},{"line_number":105,"context_line":"        if ns_name and self.snat_namespace:"},{"line_number":106,"context_line":"            self.snat_namespace.delete()"},{"line_number":107,"context_line":"            self.snat_namespace \u003d None"},{"line_number":108,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_0c286c99","line":105,"updated":"2016-04-06 16:59:15.000000000","message":"In this case, I think SnatNamespace.delete() should catch the exception if thrown, just as Namespace.delete() does if the namespace doesn\u0027t exist","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"a7dc61a8916638cd0047329c3b4296596790287c","unresolved":false,"context_lines":[{"line_number":102,"context_line":"    def external_gateway_removed(self, ex_gw_port, interface_name):"},{"line_number":103,"context_line":"        self._external_gateway_removed(ex_gw_port, interface_name)"},{"line_number":104,"context_line":"        ns_name \u003d self._check_and_get_valid_namespace(self.router[\u0027id\u0027])"},{"line_number":105,"context_line":"        if ns_name and self.snat_namespace:"},{"line_number":106,"context_line":"            self.snat_namespace.delete()"},{"line_number":107,"context_line":"            self.snat_namespace \u003d None"},{"line_number":108,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"9a061dce_b64b7d86","line":105,"in_reply_to":"9a061dce_0c286c99","updated":"2016-04-06 23:01:32.000000000","message":"But here the point is do you want to polute the logs with the exception message or is it ok if we check ahead and issue the delete command if necessary.","commit_id":"2562ecbcf7e44422fbdeae175ed8471d56aebcda"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"ba9845c529cbcdd5f607b8d74a1f8c3d0f00b688","unresolved":false,"context_lines":[{"line_number":60,"context_line":"            return self.external_gateway_added(ex_gw_port, interface_name)"},{"line_number":61,"context_line":"        else:"},{"line_number":62,"context_line":"            ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":63,"context_line":"            if ns_name is not None:"},{"line_number":64,"context_line":"                self._external_gateway_added(ex_gw_port,"},{"line_number":65,"context_line":"                                             interface_name,"},{"line_number":66,"context_line":"                                             ns_name,"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a061dce_b2f83fc6","line":63,"updated":"2016-04-08 14:04:28.000000000","message":"nit: can these all be \"if ns_name:\" or do you need to check against None?","commit_id":"665bb1bb3e7210bc4a9a596e233be04d520bcafc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"41794c74c370af5201695a5f4f584ee57f0a7d92","unresolved":false,"context_lines":[{"line_number":60,"context_line":"            return self.external_gateway_added(ex_gw_port, interface_name)"},{"line_number":61,"context_line":"        else:"},{"line_number":62,"context_line":"            ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":63,"context_line":"            if ns_name is not None:"},{"line_number":64,"context_line":"                self._external_gateway_added(ex_gw_port,"},{"line_number":65,"context_line":"                                             interface_name,"},{"line_number":66,"context_line":"                                             ns_name,"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a061dce_48864766","line":63,"in_reply_to":"9a061dce_b2f83fc6","updated":"2016-04-08 18:09:29.000000000","message":"It would be safe to check against none.","commit_id":"665bb1bb3e7210bc4a9a596e233be04d520bcafc"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"ba9845c529cbcdd5f607b8d74a1f8c3d0f00b688","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        self._external_gateway_removed(ex_gw_port, interface_name)"},{"line_number":124,"context_line":"        ns_name \u003d self._check_and_get_valid_system_namespace_name("},{"line_number":125,"context_line":"            self.router[\u0027id\u0027])"},{"line_number":126,"context_line":"        if ns_name and self.snat_namespace:"},{"line_number":127,"context_line":"            self.snat_namespace.delete()"},{"line_number":128,"context_line":"            self.snat_namespace \u003d None"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a061dce_f21f57b5","line":126,"updated":"2016-04-08 14:04:28.000000000","message":"This seems wrong.  We\u0027ve gone through the trouble of checking that the namespace exists, but then could bail-out if self.snat_namespace isn\u0027t set.  Seems the check (or try:) should be down in delete() instead of here.","commit_id":"665bb1bb3e7210bc4a9a596e233be04d520bcafc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"41794c74c370af5201695a5f4f584ee57f0a7d92","unresolved":false,"context_lines":[{"line_number":123,"context_line":"        self._external_gateway_removed(ex_gw_port, interface_name)"},{"line_number":124,"context_line":"        ns_name \u003d self._check_and_get_valid_system_namespace_name("},{"line_number":125,"context_line":"            self.router[\u0027id\u0027])"},{"line_number":126,"context_line":"        if ns_name and self.snat_namespace:"},{"line_number":127,"context_line":"            self.snat_namespace.delete()"},{"line_number":128,"context_line":"            self.snat_namespace \u003d None"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":7,"id":"9a061dce_68250bad","line":126,"in_reply_to":"9a061dce_f21f57b5","updated":"2016-04-08 18:09:29.000000000","message":"Ok, makes sense we can move it to delete in that case to reduce the logs.","commit_id":"665bb1bb3e7210bc4a9a596e233be04d520bcafc"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"ba9845c529cbcdd5f607b8d74a1f8c3d0f00b688","unresolved":false,"context_lines":[{"line_number":171,"context_line":"        if ns_name is not None:"},{"line_number":172,"context_line":"            if ip_lib.device_exists(snat_interface, namespace\u003dns_name):"},{"line_number":173,"context_line":"                self.driver.unplug(snat_interface, namespace\u003dns_name,"},{"line_number":174,"context_line":"                                   prefix\u003dprefix)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":177,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a061dce_be05ab15","line":174,"updated":"2016-04-08 14:04:28.000000000","message":"I think in this case we should modify device_exists() to catch the RuntimeError exception and return False in that case.  See the method right below it in ip_lib.py to see what I mean.","commit_id":"665bb1bb3e7210bc4a9a596e233be04d520bcafc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"41794c74c370af5201695a5f4f584ee57f0a7d92","unresolved":false,"context_lines":[{"line_number":171,"context_line":"        if ns_name is not None:"},{"line_number":172,"context_line":"            if ip_lib.device_exists(snat_interface, namespace\u003dns_name):"},{"line_number":173,"context_line":"                self.driver.unplug(snat_interface, namespace\u003dns_name,"},{"line_number":174,"context_line":"                                   prefix\u003dprefix)"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":177,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":7,"id":"9a061dce_2862f3d8","line":174,"in_reply_to":"9a061dce_be05ab15","updated":"2016-04-08 18:09:29.000000000","message":"So we should handle it in a different patch and remove the checks here, is that what you mean.","commit_id":"665bb1bb3e7210bc4a9a596e233be04d520bcafc"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"edb67440345d2ef3a49f764167a42b6bdb7d3a06","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        snat_interface \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":167,"context_line":"        prefix \u003d dvr_snat_ns.SNAT_INT_DEV_PREFIX"},{"line_number":168,"context_line":"        ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":169,"context_line":"        if ns_name is not None:"},{"line_number":170,"context_line":"            if ip_lib.device_exists(snat_interface, namespace\u003dns_name):"},{"line_number":171,"context_line":"                self.driver.unplug(snat_interface, namespace\u003dns_name,"},{"line_number":172,"context_line":"                                   prefix\u003dprefix)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a18252c_f0c72f43","line":169,"updated":"2016-04-12 20:26:54.000000000","message":"Looking at the ip_lib code, I think device_exists() will actually handle the case where the namespace doesn\u0027t exist.  I created https://review.openstack.org/304844 to verify that.","commit_id":"1e89238aa506c1059869fac6ff7ff5fad219b568"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ac769e9e44da335e0e4dbb8a644922d544556f16","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        snat_interface \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":167,"context_line":"        prefix \u003d dvr_snat_ns.SNAT_INT_DEV_PREFIX"},{"line_number":168,"context_line":"        ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":169,"context_line":"        if ns_name is not None:"},{"line_number":170,"context_line":"            if ip_lib.device_exists(snat_interface, namespace\u003dns_name):"},{"line_number":171,"context_line":"                self.driver.unplug(snat_interface, namespace\u003dns_name,"},{"line_number":172,"context_line":"                                   prefix\u003dprefix)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a18252c_78d586b7","line":169,"in_reply_to":"5a18252c_27a5c2a1","updated":"2016-04-13 20:39:42.000000000","message":"Will fix it.","commit_id":"1e89238aa506c1059869fac6ff7ff5fad219b568"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"8a5ca30ba74ec1ba37fd1e299bcdfdfd78843a09","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        snat_interface \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":167,"context_line":"        prefix \u003d dvr_snat_ns.SNAT_INT_DEV_PREFIX"},{"line_number":168,"context_line":"        ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":169,"context_line":"        if ns_name is not None:"},{"line_number":170,"context_line":"            if ip_lib.device_exists(snat_interface, namespace\u003dns_name):"},{"line_number":171,"context_line":"                self.driver.unplug(snat_interface, namespace\u003dns_name,"},{"line_number":172,"context_line":"                                   prefix\u003dprefix)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a18252c_ffe7f80f","line":169,"in_reply_to":"5a18252c_f0c72f43","updated":"2016-04-12 22:56:03.000000000","message":"Do you think then this check is redundant and we don\u0027t need this?","commit_id":"1e89238aa506c1059869fac6ff7ff5fad219b568"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"b5730d115d2487658e50b509f61b09fa482d6b02","unresolved":false,"context_lines":[{"line_number":166,"context_line":"        snat_interface \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":167,"context_line":"        prefix \u003d dvr_snat_ns.SNAT_INT_DEV_PREFIX"},{"line_number":168,"context_line":"        ns_name \u003d self._get_valid_snat_namespace_name()"},{"line_number":169,"context_line":"        if ns_name is not None:"},{"line_number":170,"context_line":"            if ip_lib.device_exists(snat_interface, namespace\u003dns_name):"},{"line_number":171,"context_line":"                self.driver.unplug(snat_interface, namespace\u003dns_name,"},{"line_number":172,"context_line":"                                   prefix\u003dprefix)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5a18252c_27a5c2a1","line":169,"in_reply_to":"5a18252c_ffe7f80f","updated":"2016-04-13 14:15:48.000000000","message":"Right, I don\u0027t think we don\u0027t need this.  If the namespace doesn\u0027t exist then device_exists() will return False, and we won\u0027t try and unplug the interface.\n\nThe only thing that could possibly be a problem is the \"ns_name \u003d self.snat_namespace.name\" on L124 in the original file?  So maybe just changing that to:\n\nns_name \u003d self._get_router_snat_namespace_name()\n\nbecause that would catch the exception if self.snat_namespace is None.\n\nIt just now seems like we\u0027re putting these checks everywhere.","commit_id":"1e89238aa506c1059869fac6ff7ff5fad219b568"},{"author":{"_account_id":12860,"name":"Dongcan Ye","email":"yedongcan@yeah.net","username":"yedongcan"},"change_message_id":"aaa7aa1f31f2675719bbcb36d9a6962a8798c43e","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        check the namespaces in the system to find out if there is"},{"line_number":86,"context_line":"        any stale namespaces. So the function checks both the"},{"line_number":87,"context_line":"        namespaces and returns the namespace name if it is valid,"},{"line_number":88,"context_line":"        else it returns None."},{"line_number":89,"context_line":"        \"\"\""},{"line_number":90,"context_line":"        rtr_snat_ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":91,"context_line":"        if rtr_snat_ns_name:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a122d0e_e90c0f44","line":88,"range":{"start_line":88,"start_character":8,"end_line":88,"end_character":29},"updated":"2016-05-05 08:03:59.000000000","message":"The return value None not seen in the code. We can returns it in _check_and_get_valid_system_namespace_name if system namespace had been deleted and if ns_name not equal to rtr_snat_ns_name.","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"7603a790dda6aea6a8406dbcbd4ee1c176c66658","unresolved":false,"context_lines":[{"line_number":85,"context_line":"        check the namespaces in the system to find out if there is"},{"line_number":86,"context_line":"        any stale namespaces. So the function checks both the"},{"line_number":87,"context_line":"        namespaces and returns the namespace name if it is valid,"},{"line_number":88,"context_line":"        else it returns None."},{"line_number":89,"context_line":"        \"\"\""},{"line_number":90,"context_line":"        rtr_snat_ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":91,"context_line":"        if rtr_snat_ns_name:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a122d0e_b517ef52","line":88,"range":{"start_line":88,"start_character":8,"end_line":88,"end_character":29},"in_reply_to":"1a122d0e_e90c0f44","updated":"2016-05-05 16:55:43.000000000","message":"removed the line that confuses you.","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":12860,"name":"Dongcan Ye","email":"yedongcan@yeah.net","username":"yedongcan"},"change_message_id":"aaa7aa1f31f2675719bbcb36d9a6962a8798c43e","unresolved":false,"context_lines":[{"line_number":108,"context_line":"            return ns_name"},{"line_number":109,"context_line":"        else:"},{"line_number":110,"context_line":"            LOG.debug(\"Namespace does not exist in the system, \""},{"line_number":111,"context_line":"                      \"it might have been deleted : %s\", ns_name)"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def _external_gateway_removed(self, ex_gw_port, interface_name):"},{"line_number":114,"context_line":"        super(DvrEdgeRouter, self).external_gateway_removed(ex_gw_port,"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a122d0e_a9cdf731","line":111,"updated":"2016-05-05 08:03:59.000000000","message":"nit: have -\u003e had","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"7603a790dda6aea6a8406dbcbd4ee1c176c66658","unresolved":false,"context_lines":[{"line_number":108,"context_line":"            return ns_name"},{"line_number":109,"context_line":"        else:"},{"line_number":110,"context_line":"            LOG.debug(\"Namespace does not exist in the system, \""},{"line_number":111,"context_line":"                      \"it might have been deleted : %s\", ns_name)"},{"line_number":112,"context_line":""},{"line_number":113,"context_line":"    def _external_gateway_removed(self, ex_gw_port, interface_name):"},{"line_number":114,"context_line":"        super(DvrEdgeRouter, self).external_gateway_removed(ex_gw_port,"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a122d0e_35259fc1","line":111,"in_reply_to":"1a122d0e_a9cdf731","updated":"2016-05-05 16:55:43.000000000","message":"I think have seems to be right.","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"2f35fc07345ec238899f9096d22cec5a48234f89","unresolved":false,"context_lines":[{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":178,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"},{"line_number":179,"context_line":"        ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":180,"context_line":"        self._internal_network_added("},{"line_number":181,"context_line":"            ns_name, port[\u0027network_id\u0027],"},{"line_number":182,"context_line":"            port[\u0027id\u0027], port[\u0027fixed_ips\u0027],"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a122d0e_d672957b","line":179,"updated":"2016-05-05 02:51:29.000000000","message":"why not use _get_valid_snat_namespace_name here and check if ns_name is not None? like you did in L67-68, L145-L146, and so on.","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"976308ec4b201202b6d73815c7005da3918c94cc","unresolved":false,"context_lines":[{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":178,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"},{"line_number":179,"context_line":"        ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":180,"context_line":"        self._internal_network_added("},{"line_number":181,"context_line":"            ns_name, port[\u0027network_id\u0027],"},{"line_number":182,"context_line":"            port[\u0027id\u0027], port[\u0027fixed_ips\u0027],"}],"source_content_type":"text/x-python","patch_set":14,"id":"dab17558_100c9d93","line":179,"in_reply_to":"1a122d0e_953593f8","updated":"2016-05-06 02:31:49.000000000","message":"Do you mean comments @ https://review.openstack.org/#/c/300358/8/neutron/agent/l3/dvr_edge_router.py ?\n\nFor unplug, it\u0027s easy to understand. But it\u0027s calling _internal_network_added here, which will plug device later. \n\nSince you used _get_valid_snat_namespace_name() with ns_name is not None checking in L145-146 for _internal_network_added in L147, so I\u0027m not sure why not doing the same way for _internal_network_added in L180.\n\nA possible explain is _plug_snat_port is called in L193, in _create_dvr_gateway, just behind _create_snat_namespace is called. Well, but what if snat namespace is deleted by accident after it just get created.","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"7603a790dda6aea6a8406dbcbd4ee1c176c66658","unresolved":false,"context_lines":[{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":178,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"},{"line_number":179,"context_line":"        ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":180,"context_line":"        self._internal_network_added("},{"line_number":181,"context_line":"            ns_name, port[\u0027network_id\u0027],"},{"line_number":182,"context_line":"            port[\u0027id\u0027], port[\u0027fixed_ips\u0027],"}],"source_content_type":"text/x-python","patch_set":14,"id":"1a122d0e_953593f8","line":179,"in_reply_to":"1a122d0e_d672957b","updated":"2016-05-05 16:55:43.000000000","message":"See the review comments in patchset 8. Based on the review comments I have changed it.","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"d049d361dd46323a556544fb66e9046a93d548ee","unresolved":false,"context_lines":[{"line_number":176,"context_line":""},{"line_number":177,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":178,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"},{"line_number":179,"context_line":"        ns_name \u003d self._get_router_snat_namespace_name()"},{"line_number":180,"context_line":"        self._internal_network_added("},{"line_number":181,"context_line":"            ns_name, port[\u0027network_id\u0027],"},{"line_number":182,"context_line":"            port[\u0027id\u0027], port[\u0027fixed_ips\u0027],"}],"source_content_type":"text/x-python","patch_set":14,"id":"dab17558_0e31beec","line":179,"in_reply_to":"dab17558_100c9d93","updated":"2016-05-09 16:03:58.000000000","message":"Yes addressed your review comments in patchset 16","commit_id":"828e0b318aa6e71ee3181ffaabcc39f8851d2c5e"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e805979a3ceed4afa6359d7d7dc405fdf207cf92","unresolved":false,"context_lines":[{"line_number":94,"context_line":"                return rtr_snat_ns_name"},{"line_number":95,"context_line":"            else:"},{"line_number":96,"context_line":"                LOG.debug(\"Agent snat namespace and the system \""},{"line_number":97,"context_line":"                          \"snat namespace does not match. No valid \""},{"line_number":98,"context_line":"                          \"namespace exists: %s\", rtr_snat_ns_name)"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def _check_if_system_namespace_exists(self, ns_name):"}],"source_content_type":"text/x-python","patch_set":18,"id":"dab17558_e3896c27","line":97,"updated":"2016-05-20 16:24:58.000000000","message":"nit: s/does/do","commit_id":"e0b298f41bb398643b733cb6c1a86a31594ff2bc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"112a57386514af0178da1acee5cb07e7aaceafee","unresolved":false,"context_lines":[{"line_number":94,"context_line":"                return rtr_snat_ns_name"},{"line_number":95,"context_line":"            else:"},{"line_number":96,"context_line":"                LOG.debug(\"Agent snat namespace and the system \""},{"line_number":97,"context_line":"                          \"snat namespace does not match. No valid \""},{"line_number":98,"context_line":"                          \"namespace exists: %s\", rtr_snat_ns_name)"},{"line_number":99,"context_line":""},{"line_number":100,"context_line":"    def _check_if_system_namespace_exists(self, ns_name):"}],"source_content_type":"text/x-python","patch_set":18,"id":"bab6814e_5c8e9ed0","line":97,"in_reply_to":"dab17558_e3896c27","updated":"2016-05-20 16:45:04.000000000","message":"will fix it.","commit_id":"e0b298f41bb398643b733cb6c1a86a31594ff2bc"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e805979a3ceed4afa6359d7d7dc405fdf207cf92","unresolved":false,"context_lines":[{"line_number":107,"context_line":"            return ns_name"},{"line_number":108,"context_line":"        else:"},{"line_number":109,"context_line":"            LOG.debug(\"Namespace does not exist in the system, \""},{"line_number":110,"context_line":"                      \"it might have been deleted : %s\", ns_name)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    def _external_gateway_removed(self, ex_gw_port, interface_name):"},{"line_number":113,"context_line":"        super(DvrEdgeRouter, self).external_gateway_removed(ex_gw_port,"}],"source_content_type":"text/x-python","patch_set":18,"id":"dab17558_63a57ca0","line":110,"updated":"2016-05-20 16:24:58.000000000","message":"nit: extra space before :","commit_id":"e0b298f41bb398643b733cb6c1a86a31594ff2bc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"112a57386514af0178da1acee5cb07e7aaceafee","unresolved":false,"context_lines":[{"line_number":107,"context_line":"            return ns_name"},{"line_number":108,"context_line":"        else:"},{"line_number":109,"context_line":"            LOG.debug(\"Namespace does not exist in the system, \""},{"line_number":110,"context_line":"                      \"it might have been deleted : %s\", ns_name)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    def _external_gateway_removed(self, ex_gw_port, interface_name):"},{"line_number":113,"context_line":"        super(DvrEdgeRouter, self).external_gateway_removed(ex_gw_port,"}],"source_content_type":"text/x-python","patch_set":18,"id":"bab6814e_7c91e2f0","line":110,"in_reply_to":"dab17558_63a57ca0","updated":"2016-05-20 16:45:04.000000000","message":"will fix it.","commit_id":"e0b298f41bb398643b733cb6c1a86a31594ff2bc"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"e805979a3ceed4afa6359d7d7dc405fdf207cf92","unresolved":false,"context_lines":[{"line_number":142,"context_line":""},{"line_number":143,"context_line":"        interface_name \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":144,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":145,"context_line":"        if ns_name is not None:"},{"line_number":146,"context_line":"            self._internal_network_added("},{"line_number":147,"context_line":"                ns_name,"},{"line_number":148,"context_line":"                sn_port[\u0027network_id\u0027],"}],"source_content_type":"text/x-python","patch_set":18,"id":"bab6814e_668e73d1","line":145,"updated":"2016-05-20 16:24:58.000000000","message":"The problem here is that the namespace could have existed when we checked, but it got removed right afterwards.  So the call below could still fail, right?\n\nThe other problem is that if the namespace didn\u0027t exist should we be creating it?  We\u0027re just ignoring that case and not calling into code that could thrown an exception.","commit_id":"e0b298f41bb398643b733cb6c1a86a31594ff2bc"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"112a57386514af0178da1acee5cb07e7aaceafee","unresolved":false,"context_lines":[{"line_number":142,"context_line":""},{"line_number":143,"context_line":"        interface_name \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":144,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":145,"context_line":"        if ns_name is not None:"},{"line_number":146,"context_line":"            self._internal_network_added("},{"line_number":147,"context_line":"                ns_name,"},{"line_number":148,"context_line":"                sn_port[\u0027network_id\u0027],"}],"source_content_type":"text/x-python","patch_set":18,"id":"bab6814e_9c9be617","line":145,"in_reply_to":"bab6814e_668e73d1","updated":"2016-05-20 16:45:04.000000000","message":"Yes I agree there might be a slight race condition in here, when you check and when you proceed to do operation on the namespace.\nBut I thought that is what will be captured by the ip_lib device_exists, before it tries to add any info into the namespace.\n\nNamespace recreation is another added security that we can take, in the initloop.\n\nAgain namespace recreation is a global change that should affect all the namespaces, including the router, fipnamespace and snat_namespace. So do we need to make those changes as part of this patch or keep it separate, if required.","commit_id":"e0b298f41bb398643b733cb6c1a86a31594ff2bc"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":64,"context_line":"            # newly created gateway"},{"line_number":65,"context_line":"            return self.external_gateway_added(ex_gw_port, interface_name)"},{"line_number":66,"context_line":"        else:"},{"line_number":67,"context_line":"            ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":68,"context_line":"            if ns_name is not None:"},{"line_number":69,"context_line":"                self._external_gateway_added(ex_gw_port,"},{"line_number":70,"context_line":"                                             interface_name,"},{"line_number":71,"context_line":"                                             ns_name,"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_2f32a5a7","line":68,"range":{"start_line":67,"start_character":12,"end_line":68,"end_character":34},"updated":"2016-05-25 21:53:47.000000000","message":"I\u0027m a strong believer in the \"try / except\" method of handling these cases over the \"check / try\" approach.  It isn\u0027t just more pythonic, it is more robust in any language.  It closes the window where a race condition could happen.  I\u0027m nearly always on the try / except side.","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        try:"},{"line_number":76,"context_line":"            return self.snat_namespace.name"},{"line_number":77,"context_line":"        except AttributeError:"},{"line_number":78,"context_line":"            pass"},{"line_number":79,"context_line":""},{"line_number":80,"context_line":"    def get_valid_snat_namespace_name(self):"},{"line_number":81,"context_line":"        \"\"\"Checks for the valid namespace name and returns the name."}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_0f01a1af","line":78,"range":{"start_line":78,"start_character":12,"end_line":78,"end_character":16},"updated":"2016-05-25 21:53:47.000000000","message":"I tend to think that this should be converted to an exception.  It seems like an exceptional condition to ask for the snat namespace and have it not be available.  Another option to consider might be to create it here.","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":93,"context_line":"            if ns_name \u003d\u003d rtr_snat_ns_name:"},{"line_number":94,"context_line":"                return rtr_snat_ns_name"},{"line_number":95,"context_line":"            else:"},{"line_number":96,"context_line":"                LOG.debug(\"Agent snat namespace and the system \""},{"line_number":97,"context_line":"                          \"snat namespace do not match. No valid \""},{"line_number":98,"context_line":"                          \"namespace exists: %s\", rtr_snat_ns_name)"},{"line_number":99,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_af7a1522","line":96,"range":{"start_line":96,"start_character":16,"end_line":96,"end_character":62},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L110)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":103,"context_line":""},{"line_number":104,"context_line":"    def _check_and_get_valid_system_namespace_name(self, router_id):"},{"line_number":105,"context_line":"        ns_name \u003d dvr_snat_ns.SnatNamespace.get_snat_ns_name(router_id)"},{"line_number":106,"context_line":"        if self._check_if_system_namespace_exists(ns_name):"},{"line_number":107,"context_line":"            return ns_name"},{"line_number":108,"context_line":"        else:"},{"line_number":109,"context_line":"            LOG.debug(\"Namespace does not exist in the system, \""},{"line_number":110,"context_line":"                      \"it might have been deleted: %s\", ns_name)"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_4f38c9a0","line":107,"range":{"start_line":106,"start_character":8,"end_line":107,"end_character":26},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L68)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":106,"context_line":"        if self._check_if_system_namespace_exists(ns_name):"},{"line_number":107,"context_line":"            return ns_name"},{"line_number":108,"context_line":"        else:"},{"line_number":109,"context_line":"            LOG.debug(\"Namespace does not exist in the system, \""},{"line_number":110,"context_line":"                      \"it might have been deleted: %s\", ns_name)"},{"line_number":111,"context_line":""},{"line_number":112,"context_line":"    def _external_gateway_removed(self, ex_gw_port, interface_name):"},{"line_number":113,"context_line":"        super(DvrEdgeRouter, self).external_gateway_removed(ex_gw_port,"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_0f8ec178","line":110,"range":{"start_line":109,"start_character":12,"end_line":110,"end_character":64},"updated":"2016-05-25 21:53:47.000000000","message":"This seems like more of an exceptional condition rather than just a debug message worthy event.","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":141,"context_line":"            return"},{"line_number":142,"context_line":""},{"line_number":143,"context_line":"        interface_name \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":144,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":145,"context_line":"        if ns_name is not None:"},{"line_number":146,"context_line":"            self._internal_network_added("},{"line_number":147,"context_line":"                ns_name,"},{"line_number":148,"context_line":"                sn_port[\u0027network_id\u0027],"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_cf4cb944","line":145,"range":{"start_line":144,"start_character":8,"end_line":145,"end_character":31},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L68)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":157,"context_line":"            # to re-create the missing namespace in case of accidental"},{"line_number":158,"context_line":"            # cleanup of the namespaces in the system that mismatch with"},{"line_number":159,"context_line":"            # the namespace objects."},{"line_number":160,"context_line":"            LOG.warning(_LW(\"Router SNAT Namespace does not exist, it might \""},{"line_number":161,"context_line":"                            \"have been deleted or cleaned up. The router %s \""},{"line_number":162,"context_line":"                            \"internal_network_added failed\"),"},{"line_number":163,"context_line":"                        self.router[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_ef8a5d63","line":160,"range":{"start_line":160,"start_character":12,"end_line":160,"end_character":23},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L110)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":184,"context_line":""},{"line_number":185,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":186,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"},{"line_number":187,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":188,"context_line":"        if ns_name is not None:"},{"line_number":189,"context_line":"            self._internal_network_added("},{"line_number":190,"context_line":"                ns_name, port[\u0027network_id\u0027],"},{"line_number":191,"context_line":"                port[\u0027id\u0027], port[\u0027fixed_ips\u0027],"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_ef4ffd31","line":188,"range":{"start_line":187,"start_character":8,"end_line":188,"end_character":31},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L68)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":197,"context_line":"            # re-create the missing namespace in case of accidental cleanup of"},{"line_number":198,"context_line":"            # the namespaces in the system that mismatch with the namespace"},{"line_number":199,"context_line":"            # objects."},{"line_number":200,"context_line":"            LOG.warning(_LW(\"Router SNAT Namespace does not exist, it might \""},{"line_number":201,"context_line":"                            \"have been deleted or cleaned up. The router %s \""},{"line_number":202,"context_line":"                            \"external_gateway_added failed\"),"},{"line_number":203,"context_line":"                        self.router[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_2fef451f","line":200,"range":{"start_line":200,"start_character":12,"end_line":200,"end_character":23},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L68)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":253,"context_line":"            LOG.debug(\"DVR router: no snat rules to be handled\")"},{"line_number":254,"context_line":"            return"},{"line_number":255,"context_line":""},{"line_number":256,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":257,"context_line":"        if ns_name is not None:"},{"line_number":258,"context_line":"            with self.snat_iptables_manager.defer_apply():"},{"line_number":259,"context_line":"                self._empty_snat_chains(self.snat_iptables_manager)"},{"line_number":260,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_2f6465b7","line":257,"range":{"start_line":256,"start_character":8,"end_line":257,"end_character":31},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L68)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":307,"context_line":"                ports_scopemark[ip_version].update("},{"line_number":308,"context_line":"                    external_port_scopemark[ip_version])"},{"line_number":309,"context_line":""},{"line_number":310,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":311,"context_line":"        if ns_name is not None:"},{"line_number":312,"context_line":"            with self.snat_iptables_manager.defer_apply():"},{"line_number":313,"context_line":"                self._add_address_scope_mark("},{"line_number":314,"context_line":"                    self.snat_iptables_manager, ports_scopemark)"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_8f5591c3","line":311,"range":{"start_line":310,"start_character":8,"end_line":311,"end_character":31},"updated":"2016-05-25 21:53:47.000000000","message":"ditto (L68)","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"4a3eccb2b0a8a5380e5c3a67ade090788ac4da73","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            return self.external_gateway_added(ex_gw_port, interface_name)"},{"line_number":67,"context_line":"        else:"},{"line_number":68,"context_line":"            ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":69,"context_line":"            if ns_name is not None:"},{"line_number":70,"context_line":"                self._external_gateway_added(ex_gw_port,"},{"line_number":71,"context_line":"                                             interface_name,"},{"line_number":72,"context_line":"                                             ns_name,"}],"source_content_type":"text/x-python","patch_set":20,"id":"9abb7d3a_18045bbe","line":69,"updated":"2016-06-03 19:45:41.000000000","message":"I don\u0027t think you need these two lines as self.snat_namespace has been checked on L63, so .name should be something.\n\nAlso, I think what Carl was alluding to was having a try/except around this call to self._external_gateway_added(), such that the error gets caught here.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ba197e4aca78db847e103416f4be68221d338d9d","unresolved":false,"context_lines":[{"line_number":66,"context_line":"            return self.external_gateway_added(ex_gw_port, interface_name)"},{"line_number":67,"context_line":"        else:"},{"line_number":68,"context_line":"            ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":69,"context_line":"            if ns_name is not None:"},{"line_number":70,"context_line":"                self._external_gateway_added(ex_gw_port,"},{"line_number":71,"context_line":"                                             interface_name,"},{"line_number":72,"context_line":"                                             ns_name,"}],"source_content_type":"text/x-python","patch_set":20,"id":"7aa08908_ac5a6281","line":69,"in_reply_to":"9abb7d3a_18045bbe","updated":"2016-06-06 16:09:24.000000000","message":"will fix this.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"4a3eccb2b0a8a5380e5c3a67ade090788ac4da73","unresolved":false,"context_lines":[{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    def _get_router_snat_namespace_name(self):"},{"line_number":76,"context_line":"        try:"},{"line_number":77,"context_line":"            return self.snat_namespace.name"},{"line_number":78,"context_line":"        except AttributeError:"},{"line_number":79,"context_line":"            msg \u003d _LE(\u0027Failed to retreive the SNAT Namespace name: %s \u0027"},{"line_number":80,"context_line":"                      \u0027SNAT object might have been deleted or moved to a \u0027"}],"source_content_type":"text/x-python","patch_set":20,"id":"9abb7d3a_d83ad3cc","line":77,"updated":"2016-06-03 19:45:41.000000000","message":"So this is one of the exceptions, self.snat_namespace \u003d None, so self.snat_namespace.name throws an exception.  The other is the namespace doesn\u0027t exist.\n\nI guess I\u0027m fine having this to catch the AttributeError.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ba197e4aca78db847e103416f4be68221d338d9d","unresolved":false,"context_lines":[{"line_number":74,"context_line":""},{"line_number":75,"context_line":"    def _get_router_snat_namespace_name(self):"},{"line_number":76,"context_line":"        try:"},{"line_number":77,"context_line":"            return self.snat_namespace.name"},{"line_number":78,"context_line":"        except AttributeError:"},{"line_number":79,"context_line":"            msg \u003d _LE(\u0027Failed to retreive the SNAT Namespace name: %s \u0027"},{"line_number":80,"context_line":"                      \u0027SNAT object might have been deleted or moved to a \u0027"}],"source_content_type":"text/x-python","patch_set":20,"id":"7aa08908_8cd686c3","line":77,"in_reply_to":"9abb7d3a_d83ad3cc","updated":"2016-06-06 16:09:24.000000000","message":"So I don\u0027t think any change is required here.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"4a3eccb2b0a8a5380e5c3a67ade090788ac4da73","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        if rtr_snat_ns_name:"},{"line_number":99,"context_line":"            try:"},{"line_number":100,"context_line":"                self._validate_system_namespace_name("},{"line_number":101,"context_line":"                    self.router[\u0027id\u0027], rtr_snat_ns_name)"},{"line_number":102,"context_line":"                return rtr_snat_ns_name"},{"line_number":103,"context_line":"            except exceptions.NamespaceNotFound as e:"},{"line_number":104,"context_line":"                LOG.exception(e.msg)"}],"source_content_type":"text/x-python","patch_set":20,"id":"9abb7d3a_f8bfd7a7","line":101,"updated":"2016-06-03 19:45:41.000000000","message":"self.router_id","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ba197e4aca78db847e103416f4be68221d338d9d","unresolved":false,"context_lines":[{"line_number":98,"context_line":"        if rtr_snat_ns_name:"},{"line_number":99,"context_line":"            try:"},{"line_number":100,"context_line":"                self._validate_system_namespace_name("},{"line_number":101,"context_line":"                    self.router[\u0027id\u0027], rtr_snat_ns_name)"},{"line_number":102,"context_line":"                return rtr_snat_ns_name"},{"line_number":103,"context_line":"            except exceptions.NamespaceNotFound as e:"},{"line_number":104,"context_line":"                LOG.exception(e.msg)"}],"source_content_type":"text/x-python","patch_set":20,"id":"7aa08908_2ce672b4","line":101,"in_reply_to":"9abb7d3a_f8bfd7a7","updated":"2016-06-06 16:09:24.000000000","message":"will fix it.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"4a3eccb2b0a8a5380e5c3a67ade090788ac4da73","unresolved":false,"context_lines":[{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def _check_if_system_namespace_exists(self, ns_name):"},{"line_number":107,"context_line":"        ip_wrapper \u003d ip_lib.IPWrapper(namespace\u003dns_name)"},{"line_number":108,"context_line":"        return ip_wrapper.netns.exists(ns_name)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def _validate_system_namespace_name(self, router_id, ns_name):"},{"line_number":111,"context_line":"        valid_namespace \u003d self._check_if_system_namespace_exists(ns_name)"}],"source_content_type":"text/x-python","patch_set":20,"id":"9abb7d3a_d80c9344","line":108,"updated":"2016-06-03 19:45:41.000000000","message":"I don\u0027t think we should be checking if it exists, just catch the error in the calls that might use it.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ba197e4aca78db847e103416f4be68221d338d9d","unresolved":false,"context_lines":[{"line_number":105,"context_line":""},{"line_number":106,"context_line":"    def _check_if_system_namespace_exists(self, ns_name):"},{"line_number":107,"context_line":"        ip_wrapper \u003d ip_lib.IPWrapper(namespace\u003dns_name)"},{"line_number":108,"context_line":"        return ip_wrapper.netns.exists(ns_name)"},{"line_number":109,"context_line":""},{"line_number":110,"context_line":"    def _validate_system_namespace_name(self, router_id, ns_name):"},{"line_number":111,"context_line":"        valid_namespace \u003d self._check_if_system_namespace_exists(ns_name)"}],"source_content_type":"text/x-python","patch_set":20,"id":"7aa08908_8cede68d","line":108,"in_reply_to":"9abb7d3a_d80c9344","updated":"2016-06-06 16:09:24.000000000","message":"Ok, will fix it.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"4a3eccb2b0a8a5380e5c3a67ade090788ac4da73","unresolved":false,"context_lines":[{"line_number":144,"context_line":"            return"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        interface_name \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":147,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":148,"context_line":"        self._internal_network_added("},{"line_number":149,"context_line":"            ns_name,"},{"line_number":150,"context_line":"            sn_port[\u0027network_id\u0027],"}],"source_content_type":"text/x-python","patch_set":20,"id":"9abb7d3a_9b09652f","line":147,"updated":"2016-06-03 19:45:41.000000000","message":"Same comment as above.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ba197e4aca78db847e103416f4be68221d338d9d","unresolved":false,"context_lines":[{"line_number":144,"context_line":"            return"},{"line_number":145,"context_line":""},{"line_number":146,"context_line":"        interface_name \u003d self._get_snat_int_device_name(sn_port[\u0027id\u0027])"},{"line_number":147,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":148,"context_line":"        self._internal_network_added("},{"line_number":149,"context_line":"            ns_name,"},{"line_number":150,"context_line":"            sn_port[\u0027network_id\u0027],"}],"source_content_type":"text/x-python","patch_set":20,"id":"7aa08908_cc86ceb8","line":147,"in_reply_to":"9abb7d3a_9b09652f","updated":"2016-06-06 16:09:24.000000000","message":"Ok, will add try/catch block to _internal_network_added.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"4a3eccb2b0a8a5380e5c3a67ade090788ac4da73","unresolved":false,"context_lines":[{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":179,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"},{"line_number":180,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":181,"context_line":"        self._internal_network_added("},{"line_number":182,"context_line":"            ns_name, port[\u0027network_id\u0027],"},{"line_number":183,"context_line":"            port[\u0027id\u0027], port[\u0027fixed_ips\u0027],"}],"source_content_type":"text/x-python","patch_set":20,"id":"9abb7d3a_381b1f82","line":180,"updated":"2016-06-03 19:45:41.000000000","message":"Same comment as above.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"ba197e4aca78db847e103416f4be68221d338d9d","unresolved":false,"context_lines":[{"line_number":177,"context_line":""},{"line_number":178,"context_line":"    def _plug_snat_port(self, port):"},{"line_number":179,"context_line":"        interface_name \u003d self._get_snat_int_device_name(port[\u0027id\u0027])"},{"line_number":180,"context_line":"        ns_name \u003d self.get_valid_snat_namespace_name()"},{"line_number":181,"context_line":"        self._internal_network_added("},{"line_number":182,"context_line":"            ns_name, port[\u0027network_id\u0027],"},{"line_number":183,"context_line":"            port[\u0027id\u0027], port[\u0027fixed_ips\u0027],"}],"source_content_type":"text/x-python","patch_set":20,"id":"7aa08908_0ca8d61e","line":180,"in_reply_to":"9abb7d3a_381b1f82","updated":"2016-06-06 16:09:24.000000000","message":"will fix it.","commit_id":"7af147d8eb5e2b384538a390611253cfa7641bf7"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"954bc7fc6fc6bed9d472a76682a13a3e0b336220","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        if not self.snat_iptables_manager:"},{"line_number":230,"context_line":"            LOG.debug(\"DVR router: no snat rules to be handled\")"},{"line_number":231,"context_line":"            return"},{"line_number":232,"context_line":"        if self.get_snat_namespace():"},{"line_number":233,"context_line":"            with self.snat_iptables_manager.defer_apply():"},{"line_number":234,"context_line":"                self._empty_snat_chains(self.snat_iptables_manager)"},{"line_number":235,"context_line":""}],"source_content_type":"text/x-python","patch_set":21,"id":"7aa08908_e14f45bb","line":232,"updated":"2016-06-06 20:24:36.000000000","message":"Brian, do you think we should also remove this check in here.","commit_id":"70525a7645e802090a2b1da2025405ddd6ffb03d"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"954bc7fc6fc6bed9d472a76682a13a3e0b336220","unresolved":false,"context_lines":[{"line_number":282,"context_line":"                               l3_constants.IP_VERSION_6):"},{"line_number":283,"context_line":"                ports_scopemark[ip_version].update("},{"line_number":284,"context_line":"                    external_port_scopemark[ip_version])"},{"line_number":285,"context_line":"        if self.get_snat_namespace():"},{"line_number":286,"context_line":"            with self.snat_iptables_manager.defer_apply():"},{"line_number":287,"context_line":"                self._add_address_scope_mark("},{"line_number":288,"context_line":"                    self.snat_iptables_manager, ports_scopemark)"}],"source_content_type":"text/x-python","patch_set":21,"id":"7aa08908_01cb711f","line":285,"updated":"2016-06-06 20:24:36.000000000","message":"Brian, same question here.","commit_id":"70525a7645e802090a2b1da2025405ddd6ffb03d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"5ce5b11d2c2c78c47eaf33110ff54c59a32301d8","unresolved":false,"context_lines":[{"line_number":229,"context_line":"        if not self.snat_iptables_manager:"},{"line_number":230,"context_line":"            LOG.debug(\"DVR router: no snat rules to be handled\")"},{"line_number":231,"context_line":"            return"},{"line_number":232,"context_line":"        if self.get_snat_namespace():"},{"line_number":233,"context_line":"            with self.snat_iptables_manager.defer_apply():"},{"line_number":234,"context_line":"                self._empty_snat_chains(self.snat_iptables_manager)"},{"line_number":235,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"7aa08908_dda829de","line":232,"updated":"2016-06-06 22:46:54.000000000","message":"Yes, I think you should remove these too, because with it we won\u0027t call _empty_snat_chains() or _add_snat_rules(), which will at least make sure the correct rules are in the iptables manager.  It\u0027s the apply() that throws the exception.","commit_id":"23fafd31991dfdb679616f288a9fc58bb1b4b947"}],"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":"1a0e7bddd5433e59e684a86943e217b40abbce5a","unresolved":false,"context_lines":[{"line_number":244,"context_line":"            snat_idx \u003d net.value"},{"line_number":245,"context_line":"        return snat_idx"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def _add_gateway_if_device_exists(self, ns_ip_device, gw_ip_addr,"},{"line_number":248,"context_line":"                                      snat_idx):"},{"line_number":249,"context_line":"        try:"},{"line_number":250,"context_line":"            ns_ip_device.route.add_gateway(gw_ip_addr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_c3fdc6b2","line":247,"updated":"2016-04-25 22:18:04.000000000","message":"You should make this name match L255, even though both seem wrong, maybe should be _add_gateway_route_if_device_exists()","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"9ef6986df088232c74a029093ba25ff7215fb255","unresolved":false,"context_lines":[{"line_number":244,"context_line":"            snat_idx \u003d net.value"},{"line_number":245,"context_line":"        return snat_idx"},{"line_number":246,"context_line":""},{"line_number":247,"context_line":"    def _add_gateway_if_device_exists(self, ns_ip_device, gw_ip_addr,"},{"line_number":248,"context_line":"                                      snat_idx):"},{"line_number":249,"context_line":"        try:"},{"line_number":250,"context_line":"            ns_ip_device.route.add_gateway(gw_ip_addr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_8a22a9a1","line":247,"in_reply_to":"1a122d0e_c3fdc6b2","updated":"2016-04-26 17:31:07.000000000","message":"Having had the feedback on this function to either hide or not to hide the RuntimeError, I would like to take this away from this patch and probably address it as a separate patch, in order for this patch to go in.","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"1a0e7bddd5433e59e684a86943e217b40abbce5a","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        try:"},{"line_number":250,"context_line":"            ns_ip_device.route.add_gateway(gw_ip_addr,"},{"line_number":251,"context_line":"                                           table\u003dsnat_idx)"},{"line_number":252,"context_line":"        except exceptions.DeviceNotFoundError:"},{"line_number":253,"context_line":"            pass"},{"line_number":254,"context_line":""},{"line_number":255,"context_line":"    def _delete_gateway_device_if_exists(self, ns_ip_device, gw_ip_addr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_030b3ed7","line":252,"updated":"2016-04-25 22:18:04.000000000","message":"This doesn\u0027t look right, this exception takes an interface name as an argument, for example (ns_ip_device.name)","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"e45b0e402eab17ee07707a67e3a71971a35acfb5","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        try:"},{"line_number":250,"context_line":"            ns_ip_device.route.add_gateway(gw_ip_addr,"},{"line_number":251,"context_line":"                                           table\u003dsnat_idx)"},{"line_number":252,"context_line":"        except exceptions.DeviceNotFoundError:"},{"line_number":253,"context_line":"            pass"},{"line_number":254,"context_line":""},{"line_number":255,"context_line":"    def _delete_gateway_device_if_exists(self, ns_ip_device, gw_ip_addr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_4c7e036b","line":252,"in_reply_to":"1a122d0e_030b3ed7","updated":"2016-04-26 03:41:22.000000000","message":"I think this except block is directly referred from L260-L261.\nIf we want do some changing here, I prefer another patch.","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"9ef6986df088232c74a029093ba25ff7215fb255","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        try:"},{"line_number":250,"context_line":"            ns_ip_device.route.add_gateway(gw_ip_addr,"},{"line_number":251,"context_line":"                                           table\u003dsnat_idx)"},{"line_number":252,"context_line":"        except exceptions.DeviceNotFoundError:"},{"line_number":253,"context_line":"            pass"},{"line_number":254,"context_line":""},{"line_number":255,"context_line":"    def _delete_gateway_device_if_exists(self, ns_ip_device, gw_ip_addr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_ca3821d6","line":252,"in_reply_to":"1a122d0e_4c7e036b","updated":"2016-04-26 17:31:07.000000000","message":"I will try to get this one as a separate patch.","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"57d0cd8173978a6c4cb17cf0d9ef53f32c4a9766","unresolved":false,"context_lines":[{"line_number":249,"context_line":"        try:"},{"line_number":250,"context_line":"            ns_ip_device.route.add_gateway(gw_ip_addr,"},{"line_number":251,"context_line":"                                           table\u003dsnat_idx)"},{"line_number":252,"context_line":"        except exceptions.DeviceNotFoundError:"},{"line_number":253,"context_line":"            pass"},{"line_number":254,"context_line":""},{"line_number":255,"context_line":"    def _delete_gateway_device_if_exists(self, ns_ip_device, gw_ip_addr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_f7006136","line":252,"in_reply_to":"1a122d0e_ca3821d6","updated":"2016-04-26 20:46:43.000000000","message":"Yeah, this is probably fine seeing below, I think I meant to delete this comment before replying.","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"1a0e7bddd5433e59e684a86943e217b40abbce5a","unresolved":false,"context_lines":[{"line_number":281,"context_line":"                        if is_add:"},{"line_number":282,"context_line":"                            # Makesure we check if the device exists,"},{"line_number":283,"context_line":"                            # before setting the gateway. This will"},{"line_number":284,"context_line":"                            # reduce logging runtime errors."},{"line_number":285,"context_line":"                            self._add_gateway_if_device_exists("},{"line_number":286,"context_line":"                                ns_ipd, gw_ip_addr, snat_idx)"},{"line_number":287,"context_line":"                            ns_ipr.rule.add(ip\u003dsn_port_cidr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_03321ea7","line":284,"updated":"2016-04-25 22:18:04.000000000","message":"You don\u0027t need this comment here, plus it\u0027s wrong since you actually never check it exists, just catch the exception.","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"e45b0e402eab17ee07707a67e3a71971a35acfb5","unresolved":false,"context_lines":[{"line_number":281,"context_line":"                        if is_add:"},{"line_number":282,"context_line":"                            # Makesure we check if the device exists,"},{"line_number":283,"context_line":"                            # before setting the gateway. This will"},{"line_number":284,"context_line":"                            # reduce logging runtime errors."},{"line_number":285,"context_line":"                            self._add_gateway_if_device_exists("},{"line_number":286,"context_line":"                                ns_ipd, gw_ip_addr, snat_idx)"},{"line_number":287,"context_line":"                            ns_ipr.rule.add(ip\u003dsn_port_cidr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_8cc2db83","line":284,"in_reply_to":"1a122d0e_03321ea7","updated":"2016-04-26 03:41:22.000000000","message":"+1 for puzzling comments.","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"3610389f709f6134b8bab4cde240c347f2508f38","unresolved":false,"context_lines":[{"line_number":281,"context_line":"                        if is_add:"},{"line_number":282,"context_line":"                            # Makesure we check if the device exists,"},{"line_number":283,"context_line":"                            # before setting the gateway. This will"},{"line_number":284,"context_line":"                            # reduce logging runtime errors."},{"line_number":285,"context_line":"                            self._add_gateway_if_device_exists("},{"line_number":286,"context_line":"                                ns_ipd, gw_ip_addr, snat_idx)"},{"line_number":287,"context_line":"                            ns_ipr.rule.add(ip\u003dsn_port_cidr,"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a122d0e_ec9c2f6c","line":284,"in_reply_to":"1a122d0e_8cc2db83","updated":"2016-04-26 03:59:56.000000000","message":"After looking closer, I\u0027m getting confused on _add_gateway_if_device_exists, as \"This will reduce logging runtime errors\" says, that may be the only improvement it has.\n\nPreviously, if the device doesn\u0027t exist, exception raises and no following processings in this method will go on.\nBut now, since you ignore DeviceNotFoundError, nothing will be stopped when device doesn\u0027t exist, is this the right way?\n\nAnd it\u0027s OK for deleting gateway from device when device doesn\u0027t exist, for missing device case can be considered as gateway deleted. But it\u0027s not the same to adding gateway to device. For that, I prefer you reconsider introducing method _add_gateway_if_device_exists.","commit_id":"2c600be11bd22ae758c49902ceaf95de1fb3082c"}],"neutron/tests/functional/agent/l3/test_dvr_router.py":[{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"7a0022cf9698228994465b921a8cc73e1097aca6","unresolved":false,"context_lines":[{"line_number":646,"context_line":"        # Now let us try to remove the gateway and snat interfaces"},{"line_number":647,"context_line":"        # from the router"},{"line_number":648,"context_line":"        router1.router[\u0027gw_port\u0027] \u003d None"},{"line_number":649,"context_line":"        router1.router[l3_constants.SNAT_ROUTER_INTF_KEY] \u003d []"},{"line_number":650,"context_line":"        router1._external_gateway_removed \u003d mock.Mock()"},{"line_number":651,"context_line":"        self.agent._process_updated_router(router1.router)"},{"line_number":652,"context_line":"        router_updated \u003d self.agent.router_info[router_info[\u0027id\u0027]]"}],"source_content_type":"text/x-python","patch_set":12,"id":"1a122d0e_e7b70e83","line":649,"range":{"start_line":649,"start_character":23,"end_line":649,"end_character":56},"updated":"2016-04-27 03:21:56.000000000","message":"\u003d\u003e n_const.SNAT_ROUTER_INTF_KEY\n\nneutron_lib.constants doesn\u0027t contain SNAT_ROUTER_INTF_KEY yet.","commit_id":"0c50783c46b42c22e693a37f38c626e4f7450e5b"},{"author":{"_account_id":7016,"name":"Swaminathan Vasudevan","email":"swvasude@cisco.com","username":"souminathan"},"change_message_id":"b461cc4e7bfdadf7cc1e7a83e6577a28b458d770","unresolved":false,"context_lines":[{"line_number":646,"context_line":"        # Now let us try to remove the gateway and snat interfaces"},{"line_number":647,"context_line":"        # from the router"},{"line_number":648,"context_line":"        router1.router[\u0027gw_port\u0027] \u003d None"},{"line_number":649,"context_line":"        router1.router[l3_constants.SNAT_ROUTER_INTF_KEY] \u003d []"},{"line_number":650,"context_line":"        router1._external_gateway_removed \u003d mock.Mock()"},{"line_number":651,"context_line":"        self.agent._process_updated_router(router1.router)"},{"line_number":652,"context_line":"        router_updated \u003d self.agent.router_info[router_info[\u0027id\u0027]]"}],"source_content_type":"text/x-python","patch_set":12,"id":"1a122d0e_faa56147","line":649,"range":{"start_line":649,"start_character":23,"end_line":649,"end_character":56},"in_reply_to":"1a122d0e_e7b70e83","updated":"2016-05-02 17:05:03.000000000","message":"Yes, you are right. Good catch.","commit_id":"0c50783c46b42c22e693a37f38c626e4f7450e5b"}],"neutron/tests/unit/agent/l3/test_agent.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":699,"context_line":"            ri.snat_namespace.delete()"},{"line_number":700,"context_line":"            self.assertFalse(mock_ns_del.called)"},{"line_number":701,"context_line":""},{"line_number":702,"context_line":"    def test_dvr_edge_router_namespace_validation_external_gw_updated(self):"},{"line_number":703,"context_line":"        router \u003d l3_test_common.prepare_router_data(num_internal_ports\u003d2)"},{"line_number":704,"context_line":"        ri \u003d dvr_router.DvrEdgeRouter(mock.Mock(),"},{"line_number":705,"context_line":"                                      HOSTNAME,"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_6f0e6d8d","line":702,"range":{"start_line":702,"start_character":8,"end_line":702,"end_character":69},"updated":"2016-05-25 21:53:47.000000000","message":"If you convert to exception handling style, these unit tests should help you find where it is appropriate to try / except and handle the exceptional conditions.","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"278b6a5b6906ff055a2d36240a32761e1e2bf063","unresolved":false,"context_lines":[{"line_number":718,"context_line":"        ri._external_gateway_added \u003d mock.Mock()"},{"line_number":719,"context_line":"        ri.external_gateway_updated(ex_gw_port, interface_name)"},{"line_number":720,"context_line":"        if ri._is_this_snat_host and ri.snat_namespace:"},{"line_number":721,"context_line":"            self.assertTrue(ri._get_router_snat_namespace_name.called)"},{"line_number":722,"context_line":"            self.assertTrue("},{"line_number":723,"context_line":"                ri._check_and_get_valid_system_namespace_name.called)"},{"line_number":724,"context_line":"            self.assertTrue(ri._external_gateway_added.called)"}],"source_content_type":"text/x-python","patch_set":19,"id":"bab6814e_afc85556","line":721,"range":{"start_line":721,"start_character":28,"end_line":721,"end_character":69},"updated":"2016-05-25 21:53:47.000000000","message":"I\u0027m not a fan of asserting internals like this.  This is an implementation detail.","commit_id":"fbb23d0f863a8f975f732917f10181029a7b46a0"}]}
