)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a76cca1c75a23b6d9d10cf0c7e6a98180d7d6e5a","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     shihanzhang \u003cshihanzhang@huawei.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-05-08 14:10:19 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add conntrack-tool to manage security group"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"this patch introduce conntrack-tool to manage security"},{"line_number":10,"context_line":"group. when a security group rule is deleted, it should"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":14,"id":"1aca2d91_9dd1305a","line":7,"updated":"2015-05-08 15:19:25.000000000","message":"nit: s/group/groups","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"70fd51d42f68f827af81bbfcfcaeaaa1f5a4a703","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     shihanzhang \u003cshihanzhang@huawei.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-05-08 14:10:19 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add conntrack-tool to manage security group"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"this patch introduce conntrack-tool to manage security"},{"line_number":10,"context_line":"group. when a security group rule is deleted, it should"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":14,"id":"9af37de9_b15b532e","line":7,"in_reply_to":"1aca2d91_9dd1305a","updated":"2015-05-11 02:03:07.000000000","message":"Done","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a76cca1c75a23b6d9d10cf0c7e6a98180d7d6e5a","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"this patch introduce conntrack-tool to manage security"},{"line_number":10,"context_line":"group. when a security group rule is deleted, it should"},{"line_number":11,"context_line":"use conntrack-tool to delete the invalid ip connectivity."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-Bug: #1335375"},{"line_number":14,"context_line":"Partially-Implements: bp conntrack-in-security-group"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":14,"id":"1aca2d91_7dbe54d5","line":11,"updated":"2015-05-08 15:19:25.000000000","message":"Just a little clean-up:\n\nThis patch introduces conntrack-tool to manage security\ngroups. When a security group rule is deleted, the corresponding\ntracked connection entries will also be removed from the kernel\nfor the address.","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"70fd51d42f68f827af81bbfcfcaeaaa1f5a4a703","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"this patch introduce conntrack-tool to manage security"},{"line_number":10,"context_line":"group. when a security group rule is deleted, it should"},{"line_number":11,"context_line":"use conntrack-tool to delete the invalid ip connectivity."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Closes-Bug: #1335375"},{"line_number":14,"context_line":"Partially-Implements: bp conntrack-in-security-group"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":14,"id":"9af37de9_3148835b","line":11,"in_reply_to":"1aca2d91_7dbe54d5","updated":"2015-05-11 02:03:07.000000000","message":"thanks very much for your help","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"}],"neutron/agent/firewall.py":[{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"824d0ea660a923d38085bf53e03ee69c96954ea6","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        raise NotImplementedError()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def security_group_updated(self, action_type, sec_group_ids,"},{"line_number":117,"context_line":"                               device_id\u003dNone):"},{"line_number":118,"context_line":"        raise NotImplementedError()"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_a280def8","line":117,"updated":"2015-06-19 07:58:48.000000000","message":"please add a basic docstring here.\n\"\"\"Called when a security group is updated.\"\"\"","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        raise NotImplementedError()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def security_group_updated(self, action_type, sec_group_ids,"},{"line_number":117,"context_line":"                               device_id\u003dNone):"},{"line_number":118,"context_line":"        raise NotImplementedError()"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_ab5679cc","line":117,"in_reply_to":"fa32b979_22484ecc","updated":"2015-06-19 09:50:53.000000000","message":"+1","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9b099c33bc31b4daee57636cdca4aa4a3694c010","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        raise NotImplementedError()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def security_group_updated(self, action_type, sec_group_ids,"},{"line_number":117,"context_line":"                               device_id\u003dNone):"},{"line_number":118,"context_line":"        raise NotImplementedError()"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_22484ecc","line":117,"in_reply_to":"fa32b979_a280def8","updated":"2015-06-19 08:20:07.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":114,"context_line":"        raise NotImplementedError()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def security_group_updated(self, action_type, sec_group_ids,"},{"line_number":117,"context_line":"                               device_id\u003dNone):"},{"line_number":118,"context_line":"        raise NotImplementedError()"},{"line_number":119,"context_line":""},{"line_number":120,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_586c4108","line":117,"in_reply_to":"fa32b979_ab5679cc","updated":"2015-06-20 01:11:33.000000000","message":"I got it","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":105,"name":"Kyle Mestery","email":"mestery@mestery.com","username":"mestery"},"change_message_id":"7a13130d3f95a02b4d3b0998e68cacfa02130828","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        \"\"\"Update rules in a security group.\"\"\""},{"line_number":114,"context_line":"        raise NotImplementedError()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def security_group_updated(self, action_type, sec_group_ids,"},{"line_number":117,"context_line":"                               device_id\u003dNone):"},{"line_number":118,"context_line":"        \"\"\"Called when a security group is updated.\"\"\""},{"line_number":119,"context_line":"        raise NotImplementedError()"}],"source_content_type":"text/x-python","patch_set":23,"id":"9a41bdd9_8bcdb088","line":116,"updated":"2015-07-16 16:25:06.000000000","message":"The additional of this security_group_updated() call seems orthogonal to the implementation of the connection tracking BP. I\u0027m wondering if it makes sense to split this out, which appears to fix the bug, and then add the connection tracking code as a dependent patch.","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"d32268dda5b0d8511d724228ace2a0d59b27847f","unresolved":false,"context_lines":[{"line_number":113,"context_line":"        \"\"\"Update rules in a security group.\"\"\""},{"line_number":114,"context_line":"        raise NotImplementedError()"},{"line_number":115,"context_line":""},{"line_number":116,"context_line":"    def security_group_updated(self, action_type, sec_group_ids,"},{"line_number":117,"context_line":"                               device_id\u003dNone):"},{"line_number":118,"context_line":"        \"\"\"Called when a security group is updated.\"\"\""},{"line_number":119,"context_line":"        raise NotImplementedError()"}],"source_content_type":"text/x-python","patch_set":23,"id":"9a41bdd9_6e0948dd","line":116,"in_reply_to":"9a41bdd9_8bcdb088","updated":"2015-07-17 00:37:39.000000000","message":"hi kyle, thx for your suggestion. the whole patch are solve the bug using ip_conntrack, so I think they can\u0027t divide to two patch sets, can you give me some suggestion","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"}],"neutron/agent/linux/ip_conntrack.py":[{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"3fb4c0a1a13b2a298668949768b66856501f5236","unresolved":false,"context_lines":[{"line_number":23,"context_line":"class IpConntrackManager(object):"},{"line_number":24,"context_line":"    \"\"\"Smart wrapper for ip conntrack.\"\"\""},{"line_number":25,"context_line":""},{"line_number":26,"context_line":"    def __init__(self, execute\u003dNone, namespace\u003dNone):"},{"line_number":27,"context_line":"        self.execute \u003d execute or linux_utils.execute"},{"line_number":28,"context_line":"        self.namespace \u003d namespace"},{"line_number":29,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"9af37de9_e47116e2","line":26,"updated":"2015-05-11 09:14:02.000000000","message":"YAGNI, execute argument seems never used","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a76cca1c75a23b6d9d10cf0c7e6a98180d7d6e5a","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.append(\u0027-p\u0027)"},{"line_number":37,"context_line":"            cmd.append(str(protocol))"},{"line_number":38,"context_line":"        if ethertype \u003d\u003d \u0027IPv6\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-f\u0027)"},{"line_number":40,"context_line":"            cmd.append(\u0027ipv6\u0027)"}],"source_content_type":"text/x-python","patch_set":14,"id":"1aca2d91_9a61363c","line":37,"updated":"2015-05-08 15:19:25.000000000","message":"Can be shortened to:\n\ncmd.extend([\u0027-p\u0027, str(protocol)])","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"70fd51d42f68f827af81bbfcfcaeaaa1f5a4a703","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.append(\u0027-p\u0027)"},{"line_number":37,"context_line":"            cmd.append(str(protocol))"},{"line_number":38,"context_line":"        if ethertype \u003d\u003d \u0027IPv6\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-f\u0027)"},{"line_number":40,"context_line":"            cmd.append(\u0027ipv6\u0027)"}],"source_content_type":"text/x-python","patch_set":14,"id":"9af37de9_8e770ed4","line":37,"in_reply_to":"1aca2d91_9a61363c","updated":"2015-05-11 02:03:07.000000000","message":"agree, thx for your suggestion","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a76cca1c75a23b6d9d10cf0c7e6a98180d7d6e5a","unresolved":false,"context_lines":[{"line_number":37,"context_line":"            cmd.append(str(protocol))"},{"line_number":38,"context_line":"        if ethertype \u003d\u003d \u0027IPv6\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-f\u0027)"},{"line_number":40,"context_line":"            cmd.append(\u0027ipv6\u0027)"},{"line_number":41,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":42,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":43,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"1aca2d91_ba4ab2aa","line":40,"updated":"2015-05-08 15:19:25.000000000","message":"Since ethertype is always either IPv4 or IPv6, you can just always pass it, something like:\n\ncmd.extend([\u0027-f\u0027, ethertype.lower()])\n\nAlthough that might have to be str(ethertype).lower()","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"70fd51d42f68f827af81bbfcfcaeaaa1f5a4a703","unresolved":false,"context_lines":[{"line_number":37,"context_line":"            cmd.append(str(protocol))"},{"line_number":38,"context_line":"        if ethertype \u003d\u003d \u0027IPv6\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-f\u0027)"},{"line_number":40,"context_line":"            cmd.append(\u0027ipv6\u0027)"},{"line_number":41,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":42,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":43,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":14,"id":"9af37de9_b10d9339","line":40,"in_reply_to":"1aca2d91_ba4ab2aa","updated":"2015-05-11 02:03:07.000000000","message":"agree","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"3fb4c0a1a13b2a298668949768b66856501f5236","unresolved":false,"context_lines":[{"line_number":44,"context_line":"            cmd.append(\u0027-s\u0027)"},{"line_number":45,"context_line":"        cmd_ns \u003d []"},{"line_number":46,"context_line":"        if self.namespace:"},{"line_number":47,"context_line":"            cmd_ns.extend([\u0027ip\u0027, \u0027netns\u0027, \u0027exec\u0027, self.namespace])"},{"line_number":48,"context_line":"        cmd_ns.extend(cmd)"},{"line_number":49,"context_line":"        return cmd_ns"},{"line_number":50,"context_line":""}],"source_content_type":"text/x-python","patch_set":14,"id":"9af37de9_4418e284","line":47,"updated":"2015-05-11 09:14:02.000000000","message":"according to first comment, you should use:\n\n ip_lib.IPWrapper(namespace);netns.execute","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a76cca1c75a23b6d9d10cf0c7e6a98180d7d6e5a","unresolved":false,"context_lines":[{"line_number":66,"context_line":"                                 check_exit_code\u003dTrue,"},{"line_number":67,"context_line":"                                 extra_ok_codes\u003d[1])"},{"line_number":68,"context_line":"                except RuntimeError:"},{"line_number":69,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":70,"context_line":"                                  str(net.ip))"}],"source_content_type":"text/x-python","patch_set":14,"id":"1aca2d91_9a19368b","line":69,"updated":"2015-05-08 15:19:25.000000000","message":"nit: can be ipv6 here, so maybe be generic - \"Failed deleting conntrack for address %s\"","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"70fd51d42f68f827af81bbfcfcaeaaa1f5a4a703","unresolved":false,"context_lines":[{"line_number":66,"context_line":"                                 check_exit_code\u003dTrue,"},{"line_number":67,"context_line":"                                 extra_ok_codes\u003d[1])"},{"line_number":68,"context_line":"                except RuntimeError:"},{"line_number":69,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":70,"context_line":"                                  str(net.ip))"}],"source_content_type":"text/x-python","patch_set":14,"id":"9af37de9_511d4765","line":69,"in_reply_to":"1aca2d91_9a19368b","updated":"2015-05-11 02:03:07.000000000","message":"agree","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":45,"context_line":"        cmd_ns.extend(cmd)"},{"line_number":46,"context_line":"        return cmd_ns"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":"    def delete_conntrack_state_by_rule(self, device_info_list, rule):"},{"line_number":49,"context_line":"        cmd \u003d self._delete_conntrack_cmd_for_rule(rule)"},{"line_number":50,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":51,"context_line":"        for device_info in device_info_list:"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_5baed4e6","line":48,"updated":"2015-06-18 10:18:15.000000000","message":"a more self explaining function name would be\n\ndelete_conntrack_state_for_devices_by_rule, but that\u0027s absurdly long.\n\nCould we add some docstring with the meaning of the parameters?\n\n   \"\"\"Delete connection tracking state for device list by rule.\n   \n   This method will go over all the devices on the list and \n   remove any connection tracking information related to the rule.\n   \"\"\"\n\ncould be an example :)","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":64,"context_line":"                                 extra_ok_codes\u003d[1])"},{"line_number":65,"context_line":"                except RuntimeError:"},{"line_number":66,"context_line":"                    LOG.exception("},{"line_number":67,"context_line":"                        _LE(\"Failed deleting conntrack for address %s\"),"},{"line_number":68,"context_line":"                        str(net.ip))"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_fb6b2883","line":67,"updated":"2015-06-18 10:18:15.000000000","message":"nit:\nI\u0027d also include the rule dictionary on the failure, to see what rule failed to delete exactly.","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"824d0ea660a923d38085bf53e03ee69c96954ea6","unresolved":false,"context_lines":[{"line_number":26,"context_line":"    def __init__(self, execute\u003dNone, namespace\u003dNone):"},{"line_number":27,"context_line":"        self.execute \u003d execute or linux_utils.execute"},{"line_number":28,"context_line":"        self.namespace \u003d namespace"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_229e0e64","line":29,"updated":"2015-06-19 07:58:48.000000000","message":"@staticmethod since we don\u0027t reference self","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9b099c33bc31b4daee57636cdca4aa4a3694c010","unresolved":false,"context_lines":[{"line_number":26,"context_line":"    def __init__(self, execute\u003dNone, namespace\u003dNone):"},{"line_number":27,"context_line":"        self.execute \u003d execute or linux_utils.execute"},{"line_number":28,"context_line":"        self.namespace \u003d namespace"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_85ab64d6","line":29,"in_reply_to":"fa32b979_229e0e64","updated":"2015-06-19 08:20:07.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":26,"context_line":"    def __init__(self, execute\u003dNone, namespace\u003dNone):"},{"line_number":27,"context_line":"        self.execute \u003d execute or linux_utils.execute"},{"line_number":28,"context_line":"        self.namespace \u003d namespace"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_a880bff8","line":29,"in_reply_to":"fa32b979_85ab64d6","updated":"2015-06-19 09:50:53.000000000","message":"That\u0027s a bit of a nit, we all don\u0027t agree on this. :-)\n\nMy opinion is: we should not use @staticmethod if the method is not going to be static, otherwise we add noise to the reader for very little gain if any. :)\n\nBut, via IRC, kevinbenton made a good point, makes unit testing easier, you can just IpConntrackManager._delete_conntrack_cmd_for_rule without instantiating the class...","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":26,"context_line":"    def __init__(self, execute\u003dNone, namespace\u003dNone):"},{"line_number":27,"context_line":"        self.execute \u003d execute or linux_utils.execute"},{"line_number":28,"context_line":"        self.namespace \u003d namespace"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_b84ead94","line":29,"in_reply_to":"fa32b979_a880bff8","updated":"2015-06-20 01:11:33.000000000","message":"if we use @staticmethod on this method, we should pass self.namespace as parameter","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"9b084b33c45cda50d1e7642c22dbee38b407e95e","unresolved":false,"context_lines":[{"line_number":26,"context_line":"    def __init__(self, execute\u003dNone, namespace\u003dNone):"},{"line_number":27,"context_line":"        self.execute \u003d execute or linux_utils.execute"},{"line_number":28,"context_line":"        self.namespace \u003d namespace"},{"line_number":29,"context_line":""},{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_80b9d217","line":29,"in_reply_to":"fa32b979_b84ead94","updated":"2015-06-22 10:42:21.000000000","message":"We do reference self... :) (self.namespaces), I\u0027d stay with no static..., otherwise pass namespace.","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"824d0ea660a923d38085bf53e03ee69c96954ea6","unresolved":false,"context_lines":[{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":33,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_429b1273","line":33,"updated":"2015-06-19 07:58:48.000000000","message":"make these three part of the signature rather than unpacking during the function to keep it short\n\ndef _delete_conntrack_cmd(self, ethertype\u003dNone, protocol\u003dNone, direction\u003dNone):\n\nthen L49 becomes self._delete_conntrack_cmd(**rule)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9b099c33bc31b4daee57636cdca4aa4a3694c010","unresolved":false,"context_lines":[{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":33,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_8592849e","line":33,"in_reply_to":"fa32b979_429b1273","updated":"2015-06-19 08:20:07.000000000","message":"make sence","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":33,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_5843e16c","line":33,"in_reply_to":"fa32b979_6b1f110a","updated":"2015-06-20 01:11:33.000000000","message":"got it","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":30,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":31,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":32,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":33,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_6b1f110a","line":33,"in_reply_to":"fa32b979_8592849e","updated":"2015-06-19 09:50:53.000000000","message":"+1","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"824d0ea660a923d38085bf53e03ee69c96954ea6","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"},{"line_number":37,"context_line":"        cmd.extend([\u0027-f\u0027, str(ethertype).lower()])"},{"line_number":38,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":40,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_e286e615","line":37,"updated":"2015-06-19 07:58:48.000000000","message":"cmd.append(\u0027-d\u0027 if direction \u003d\u003d \u0027ingress\u0027 else \u0027-s\u0027)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"},{"line_number":37,"context_line":"        cmd.extend([\u0027-f\u0027, str(ethertype).lower()])"},{"line_number":38,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":40,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_78482588","line":37,"in_reply_to":"fa32b979_2b190923","updated":"2015-06-20 01:11:33.000000000","message":"got it","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"},{"line_number":37,"context_line":"        cmd.extend([\u0027-f\u0027, str(ethertype).lower()])"},{"line_number":38,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":40,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_2b190923","line":37,"in_reply_to":"fa32b979_82227a00","updated":"2015-06-19 09:50:53.000000000","message":"+1","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9b099c33bc31b4daee57636cdca4aa4a3694c010","unresolved":false,"context_lines":[{"line_number":34,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":35,"context_line":"        if protocol:"},{"line_number":36,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"},{"line_number":37,"context_line":"        cmd.extend([\u0027-f\u0027, str(ethertype).lower()])"},{"line_number":38,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":39,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":40,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_82227a00","line":37,"in_reply_to":"fa32b979_e286e615","updated":"2015-06-19 08:20:07.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"824d0ea660a923d38085bf53e03ee69c96954ea6","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    def _delete_conntrack_state(self, device_info_list, rule, remote_ip\u003dNone):"},{"line_number":49,"context_line":"        cmd \u003d self._delete_conntrack_cmd_for_rule(rule)"},{"line_number":50,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":51,"context_line":"        for device_info in device_info_list:"},{"line_number":52,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027)"},{"line_number":53,"context_line":"            if not zone_id:"},{"line_number":54,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_028c2a34","line":51,"updated":"2015-06-19 07:58:48.000000000","message":"can you split the generation of the final command and the part that executes it into two functions? that way we can easily unit test the one that generates the command without mocking execute.","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9b099c33bc31b4daee57636cdca4aa4a3694c010","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    def _delete_conntrack_state(self, device_info_list, rule, remote_ip\u003dNone):"},{"line_number":49,"context_line":"        cmd \u003d self._delete_conntrack_cmd_for_rule(rule)"},{"line_number":50,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":51,"context_line":"        for device_info in device_info_list:"},{"line_number":52,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027)"},{"line_number":53,"context_line":"            if not zone_id:"},{"line_number":54,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_e5e7d044","line":51,"in_reply_to":"fa32b979_028c2a34","updated":"2015-06-19 08:20:07.000000000","message":"good suggestion","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    def _delete_conntrack_state(self, device_info_list, rule, remote_ip\u003dNone):"},{"line_number":49,"context_line":"        cmd \u003d self._delete_conntrack_cmd_for_rule(rule)"},{"line_number":50,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":51,"context_line":"        for device_info in device_info_list:"},{"line_number":52,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027)"},{"line_number":53,"context_line":"            if not zone_id:"},{"line_number":54,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_f8543522","line":51,"in_reply_to":"fa32b979_6be63118","updated":"2015-06-20 01:11:33.000000000","message":"Done","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":48,"context_line":"    def _delete_conntrack_state(self, device_info_list, rule, remote_ip\u003dNone):"},{"line_number":49,"context_line":"        cmd \u003d self._delete_conntrack_cmd_for_rule(rule)"},{"line_number":50,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":51,"context_line":"        for device_info in device_info_list:"},{"line_number":52,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027)"},{"line_number":53,"context_line":"            if not zone_id:"},{"line_number":54,"context_line":"                continue"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_6be63118","line":51,"in_reply_to":"fa32b979_e5e7d044","updated":"2015-06-19 09:50:53.000000000","message":"yes, I think I made a similar comment in PS16 :)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":71,"context_line":"                        str(net.ip))"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def delete_conntrack_state_by_rule(self, device_info_list, rule):"},{"line_number":74,"context_line":"        self._delete_conntrack_state(device_info_list, rule)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def delete_conntrack_state_by_remote_ips(self, device_info_list,"},{"line_number":77,"context_line":"                                             ethertype, remote_ips):"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_88cdbb5f","line":74,"updated":"2015-06-19 09:50:53.000000000","message":"Why not just having 1 function delete_conntrack_state_by_rule ?  :)\n\nSee my comments on PS16 about docstrings and naming :)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":71,"context_line":"                        str(net.ip))"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":"    def delete_conntrack_state_by_rule(self, device_info_list, rule):"},{"line_number":74,"context_line":"        self._delete_conntrack_state(device_info_list, rule)"},{"line_number":75,"context_line":""},{"line_number":76,"context_line":"    def delete_conntrack_state_by_remote_ips(self, device_info_list,"},{"line_number":77,"context_line":"                                             ethertype, remote_ips):"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_7816e556","line":74,"in_reply_to":"fa32b979_88cdbb5f","updated":"2015-06-20 01:11:33.000000000","message":"\u0027delete_conntrack_state_by_remote_ips\u0027 is used for bellow use case:\n1. sg A can access sg B\n2. port A in sg A\n3. port change from sg A to sg C\n4. then the ports in sg B should clean their ip_conntrack.\nnow I clean all ingress ip_conntrack for ports in sg B, but it is better to clean the ip_conntrack about the rule that sg A can access sg B","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f748b34dcd19fd9313492b83b4bc932b01e11524","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    def _generate_conntrack_cmd_by_rule(rule, namespace):"},{"line_number":32,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":33,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":34,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":35,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":36,"context_line":"        if protocol:"},{"line_number":37,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"}],"source_content_type":"text/x-python","patch_set":19,"id":"fa32b979_acc70811","line":34,"updated":"2015-06-23 05:39:47.000000000","message":"you forgot Kevin\u0027s comment in PS18:\n\nmake them part of the signature, means use them as parameters:\n\n_generate_conntrack_cmd(ethertype, protocol, direction, namespace)\n\n\ninstead of the dict. (if I got it right).","commit_id":"138d910e4e3821c3ef32023619140f7521c7e406"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"a532133d85d2b6f5356c766ec26b19977ef56ca9","unresolved":false,"context_lines":[{"line_number":31,"context_line":"    def _generate_conntrack_cmd_by_rule(rule, namespace):"},{"line_number":32,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":33,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":34,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":35,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":36,"context_line":"        if protocol:"},{"line_number":37,"context_line":"            cmd.extend([\u0027-p\u0027, str(protocol)])"}],"source_content_type":"text/x-python","patch_set":19,"id":"fa32b979_22de9f6d","line":34,"in_reply_to":"fa32b979_acc70811","updated":"2015-06-23 06:28:06.000000000","message":"hi ajo, thx for your reminding!\nbut security group rule has many attribute, but there just use three \u0027ethertype\u0027 ,‘protocol’,\u0027direction\u0027, so if do it as Kevin suggestion, we must pass rule attribute as parameter, for example, if a rule with \u0027remote-group-id\u0027, we must make it :\n_generate_conntrack_cmd(ethertype, protocol, direction, remote-group-id, namespace)","commit_id":"138d910e4e3821c3ef32023619140f7521c7e406"}],"neutron/agent/linux/iptables_firewall.py":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"65de760d0cf1a2e32850577beb19f11d54faf07c","unresolved":false,"context_lines":[{"line_number":548,"context_line":"            if remove_group_id in self.sg_rules:"},{"line_number":549,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":550,"context_line":""},{"line_number":551,"context_line":"    def _genarte_ips_by_cidr(self, subnet_cidr):"},{"line_number":552,"context_line":"        subnet \u003d netaddr.IPNetwork(subnet_cidr)"},{"line_number":553,"context_line":"        ip_start \u003d netaddr.IPAddress(subnet.first + 1)"},{"line_number":554,"context_line":"        ip_end \u003d netaddr.IPAddress(subnet.last - 1)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_1b1664a7","line":551,"updated":"2015-01-16 03:09:42.000000000","message":"s/_genarte/_generate","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"709cb213948bbf2c03967ec3975848a098afab3a","unresolved":false,"context_lines":[{"line_number":548,"context_line":"            if remove_group_id in self.sg_rules:"},{"line_number":549,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":550,"context_line":""},{"line_number":551,"context_line":"    def _genarte_ips_by_cidr(self, subnet_cidr):"},{"line_number":552,"context_line":"        subnet \u003d netaddr.IPNetwork(subnet_cidr)"},{"line_number":553,"context_line":"        ip_start \u003d netaddr.IPAddress(subnet.first + 1)"},{"line_number":554,"context_line":"        ip_end \u003d netaddr.IPAddress(subnet.last - 1)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_fe8fc620","line":551,"in_reply_to":"3a961159_1b1664a7","updated":"2015-01-16 03:33:18.000000000","message":"Done","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"65de760d0cf1a2e32850577beb19f11d54faf07c","unresolved":false,"context_lines":[{"line_number":594,"context_line":"                ip_info.add(zone_id)"},{"line_number":595,"context_line":"                if remote_group_id:"},{"line_number":596,"context_line":"                    ips \u003d self._get_cur_sg_member_ips("},{"line_number":597,"context_line":"                        remote_group_id, ethertype)"},{"line_number":598,"context_line":"                else:"},{"line_number":599,"context_line":"                    remote_ip_prefix \u003d rule.get(\u0027remote_ip_prefix\u0027)"},{"line_number":600,"context_line":"                    if remote_ip_prefix \u003d\u003d \u00270.0.0.0/0\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_3be5e0a3","line":597,"updated":"2015-01-16 03:09:42.000000000","message":"If remote_group_id is set you\u0027re going to make this call possibly many times with the same values (remote_group_id and ethertype) which are set outside of the loop.  You should move it outside the loop and assign it to some other variable that you can use instead in this location.","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"709cb213948bbf2c03967ec3975848a098afab3a","unresolved":false,"context_lines":[{"line_number":594,"context_line":"                ip_info.add(zone_id)"},{"line_number":595,"context_line":"                if remote_group_id:"},{"line_number":596,"context_line":"                    ips \u003d self._get_cur_sg_member_ips("},{"line_number":597,"context_line":"                        remote_group_id, ethertype)"},{"line_number":598,"context_line":"                else:"},{"line_number":599,"context_line":"                    remote_ip_prefix \u003d rule.get(\u0027remote_ip_prefix\u0027)"},{"line_number":600,"context_line":"                    if remote_ip_prefix \u003d\u003d \u00270.0.0.0/0\u0027:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_7ed116fa","line":597,"in_reply_to":"3a961159_3be5e0a3","updated":"2015-01-16 03:33:18.000000000","message":"agree, thanks for your review and suggestion","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"65de760d0cf1a2e32850577beb19f11d54faf07c","unresolved":false,"context_lines":[{"line_number":601,"context_line":"                        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":602,"context_line":"                            con_direction \u003d \u0027-d\u0027"},{"line_number":603,"context_line":"                        else:"},{"line_number":604,"context_line":"                            con_direction \u003d \u0027-s\u0027"},{"line_number":605,"context_line":"                        ips \u003d self._get_ips_by_device_ids(device_ids, zone_id)"},{"line_number":606,"context_line":"                    else:"},{"line_number":607,"context_line":"                        ips \u003d self._genarte_ips_by_cidr(remote_ip_prefix)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_5b0c6c93","line":604,"updated":"2015-01-16 03:09:42.000000000","message":"This was already done up at L584","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"709cb213948bbf2c03967ec3975848a098afab3a","unresolved":false,"context_lines":[{"line_number":601,"context_line":"                        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":602,"context_line":"                            con_direction \u003d \u0027-d\u0027"},{"line_number":603,"context_line":"                        else:"},{"line_number":604,"context_line":"                            con_direction \u003d \u0027-s\u0027"},{"line_number":605,"context_line":"                        ips \u003d self._get_ips_by_device_ids(device_ids, zone_id)"},{"line_number":606,"context_line":"                    else:"},{"line_number":607,"context_line":"                        ips \u003d self._genarte_ips_by_cidr(remote_ip_prefix)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_dee92aac","line":604,"in_reply_to":"3a961159_5b0c6c93","updated":"2015-01-16 03:33:18.000000000","message":"this is diffrent with L584, if remote_ip_prefix is \u00270.0.0.0/0\u0027, I will reset the \u0027con_direction\u0027","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"65de760d0cf1a2e32850577beb19f11d54faf07c","unresolved":false,"context_lines":[{"line_number":604,"context_line":"                            con_direction \u003d \u0027-s\u0027"},{"line_number":605,"context_line":"                        ips \u003d self._get_ips_by_device_ids(device_ids, zone_id)"},{"line_number":606,"context_line":"                    else:"},{"line_number":607,"context_line":"                        ips \u003d self._genarte_ips_by_cidr(remote_ip_prefix)"},{"line_number":608,"context_line":"                cmd.append(con_direction)"},{"line_number":609,"context_line":"                for ip in ips:"},{"line_number":610,"context_line":"                    ip_str \u003d str(netaddr.IPNetwork(ip).ip)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_7b02083f","line":607,"updated":"2015-01-16 03:09:42.000000000","message":"s/_genarte/generate","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"709cb213948bbf2c03967ec3975848a098afab3a","unresolved":false,"context_lines":[{"line_number":604,"context_line":"                            con_direction \u003d \u0027-s\u0027"},{"line_number":605,"context_line":"                        ips \u003d self._get_ips_by_device_ids(device_ids, zone_id)"},{"line_number":606,"context_line":"                    else:"},{"line_number":607,"context_line":"                        ips \u003d self._genarte_ips_by_cidr(remote_ip_prefix)"},{"line_number":608,"context_line":"                cmd.append(con_direction)"},{"line_number":609,"context_line":"                for ip in ips:"},{"line_number":610,"context_line":"                    ip_str \u003d str(netaddr.IPNetwork(ip).ip)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_3e96ae3e","line":607,"in_reply_to":"3a961159_7b02083f","updated":"2015-01-16 03:33:18.000000000","message":"Done","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"65de760d0cf1a2e32850577beb19f11d54faf07c","unresolved":false,"context_lines":[{"line_number":613,"context_line":"                        if con_direction \u003d\u003d \u0027-s\u0027:"},{"line_number":614,"context_line":"                            con_port \u003d \u0027--sport\u0027"},{"line_number":615,"context_line":"                        else:"},{"line_number":616,"context_line":"                            con_port \u003d \u0027--dport\u0027"},{"line_number":617,"context_line":"                        cmd.append(con_port)"},{"line_number":618,"context_line":"                        for port in range(start_port, last_port + 1):"},{"line_number":619,"context_line":"                            cmd.append(port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_3b8080be","line":616,"updated":"2015-01-16 03:09:42.000000000","message":"You should set con_port when you set con_direction above.","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"709cb213948bbf2c03967ec3975848a098afab3a","unresolved":false,"context_lines":[{"line_number":613,"context_line":"                        if con_direction \u003d\u003d \u0027-s\u0027:"},{"line_number":614,"context_line":"                            con_port \u003d \u0027--sport\u0027"},{"line_number":615,"context_line":"                        else:"},{"line_number":616,"context_line":"                            con_port \u003d \u0027--dport\u0027"},{"line_number":617,"context_line":"                        cmd.append(con_port)"},{"line_number":618,"context_line":"                        for port in range(start_port, last_port + 1):"},{"line_number":619,"context_line":"                            cmd.append(port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_fe1266b2","line":616,"in_reply_to":"3a961159_3b8080be","updated":"2015-01-16 03:33:18.000000000","message":"when a security group rule does not include port, I will not set con_port!","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"65de760d0cf1a2e32850577beb19f11d54faf07c","unresolved":false,"context_lines":[{"line_number":627,"context_line":"                            cmd.remove(port)"},{"line_number":628,"context_line":"                        cmd.remove(con_port)"},{"line_number":629,"context_line":"                        cmd.remove(ip_str)"},{"line_number":630,"context_line":"                        continue"},{"line_number":631,"context_line":"                    try:"},{"line_number":632,"context_line":"                        ip_wrapper.netns.execute("},{"line_number":633,"context_line":"                            cmd, check_exit_code\u003dTrue, extra_ok_codes\u003d[1])"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_fb635817","line":630,"updated":"2015-01-16 03:09:42.000000000","message":"This looks strange, can you just put the try: below under an else: and remove the continue?  Then you should be able to put a single cmd.remove(ip_str) below instead of having two.","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"709cb213948bbf2c03967ec3975848a098afab3a","unresolved":false,"context_lines":[{"line_number":627,"context_line":"                            cmd.remove(port)"},{"line_number":628,"context_line":"                        cmd.remove(con_port)"},{"line_number":629,"context_line":"                        cmd.remove(ip_str)"},{"line_number":630,"context_line":"                        continue"},{"line_number":631,"context_line":"                    try:"},{"line_number":632,"context_line":"                        ip_wrapper.netns.execute("},{"line_number":633,"context_line":"                            cmd, check_exit_code\u003dTrue, extra_ok_codes\u003d[1])"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_7e267617","line":630,"in_reply_to":"3a961159_fb635817","updated":"2015-01-16 03:33:18.000000000","message":"agree","commit_id":"793e05d761ed15046a57aeb3968f3c0b19000ce3"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":560,"context_line":"            device_info \u003d self.filtered_ports.get(id)"},{"line_number":561,"context_line":"            fixed_ips \u003d device_info.get(\u0027fixed_ips\u0027)"},{"line_number":562,"context_line":"            for ip in fixed_ips:"},{"line_number":563,"context_line":"                ips.add(ip)"},{"line_number":564,"context_line":"        return ips"},{"line_number":565,"context_line":""},{"line_number":566,"context_line":"    def _get_conntrack_ports(self, start_port, end_port):"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_21b654fd","line":563,"updated":"2015-01-19 13:37:12.000000000","message":"consider:\n\nips.update([ip for ip in device_info.get(\u0027fixed_ips\u0027)])","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":560,"context_line":"            device_info \u003d self.filtered_ports.get(id)"},{"line_number":561,"context_line":"            fixed_ips \u003d device_info.get(\u0027fixed_ips\u0027)"},{"line_number":562,"context_line":"            for ip in fixed_ips:"},{"line_number":563,"context_line":"                ips.add(ip)"},{"line_number":564,"context_line":"        return ips"},{"line_number":565,"context_line":""},{"line_number":566,"context_line":"    def _get_conntrack_ports(self, start_port, end_port):"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_beefac1c","line":563,"in_reply_to":"3a961159_21b654fd","updated":"2015-01-20 04:05:40.000000000","message":"agree, thanks for your review and suggestion!","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":601,"context_line":"                    con_direction \u003d \u0027-s\u0027"},{"line_number":602,"context_line":"                ips \u003d self._get_ips_by_device_ids(device_ids)"},{"line_number":603,"context_line":"            else:"},{"line_number":604,"context_line":"                ips \u003d self._generate_ips_by_cidr(remote_ip_prefix)"},{"line_number":605,"context_line":"        if start_port:"},{"line_number":606,"context_line":"            if con_direction \u003d\u003d \u0027-s\u0027:"},{"line_number":607,"context_line":"                con_port \u003d \u0027--sport\u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_2101f4b5","line":604,"updated":"2015-01-19 13:37:12.000000000","message":"I think we can do better in finding the appropriate tradeoff here.\nIndeed even /8 remote prefixes will lead to super expensive operations. One way or another you can end up in a bad situation here, but it should be possible to always find the shorter between the number of ip for device_ids and the size of the remote_prefix.","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":601,"context_line":"                    con_direction \u003d \u0027-s\u0027"},{"line_number":602,"context_line":"                ips \u003d self._get_ips_by_device_ids(device_ids)"},{"line_number":603,"context_line":"            else:"},{"line_number":604,"context_line":"                ips \u003d self._generate_ips_by_cidr(remote_ip_prefix)"},{"line_number":605,"context_line":"        if start_port:"},{"line_number":606,"context_line":"            if con_direction \u003d\u003d \u0027-s\u0027:"},{"line_number":607,"context_line":"                con_port \u003d \u0027--sport\u0027"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_af3db890","line":604,"in_reply_to":"3a961159_2101f4b5","updated":"2015-01-20 04:05:40.000000000","message":"for a ip_conntrack, it nedd a 5 tuple(sr_ip,sr_port,dst_ip,dst_port,protocol), so if a security group rule include \u0027remote_ip_prefix\u0027, I don\u0027t have better method to do it, who can give me a advice, thanks very much!","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":606,"context_line":"            if con_direction \u003d\u003d \u0027-s\u0027:"},{"line_number":607,"context_line":"                con_port \u003d \u0027--sport\u0027"},{"line_number":608,"context_line":"            else:"},{"line_number":609,"context_line":"                con_port \u003d \u0027--dport\u0027"},{"line_number":610,"context_line":""},{"line_number":611,"context_line":"        for device_id in device_ids:"},{"line_number":612,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_c143d00f","line":609,"updated":"2015-01-19 13:37:12.000000000","message":"this might sound pointless trickery, but consider it anyway:\n\ncon_port \u003d \u0027-%sport\u0027 % con_direction","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":606,"context_line":"            if con_direction \u003d\u003d \u0027-s\u0027:"},{"line_number":607,"context_line":"                con_port \u003d \u0027--sport\u0027"},{"line_number":608,"context_line":"            else:"},{"line_number":609,"context_line":"                con_port \u003d \u0027--dport\u0027"},{"line_number":610,"context_line":""},{"line_number":611,"context_line":"        for device_id in device_ids:"},{"line_number":612,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_7ecf048c","line":609,"in_reply_to":"3a961159_c143d00f","updated":"2015-01-20 04:05:40.000000000","message":"agree","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":609,"context_line":"                con_port \u003d \u0027--dport\u0027"},{"line_number":610,"context_line":""},{"line_number":611,"context_line":"        for device_id in device_ids:"},{"line_number":612,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"},{"line_number":613,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":614,"context_line":"            if zone_id not in ip_info:"},{"line_number":615,"context_line":"                cmd.append(\u0027-w\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_613dbc8e","line":612,"updated":"2015-01-19 13:37:12.000000000","message":"the lines in this block look like a good candidate for a helper method - to enhance readability","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":609,"context_line":"                con_port \u003d \u0027--dport\u0027"},{"line_number":610,"context_line":""},{"line_number":611,"context_line":"        for device_id in device_ids:"},{"line_number":612,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"},{"line_number":613,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":614,"context_line":"            if zone_id not in ip_info:"},{"line_number":615,"context_line":"                cmd.append(\u0027-w\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_2f51c8d9","line":612,"in_reply_to":"3a961159_613dbc8e","updated":"2015-01-20 04:05:40.000000000","message":"Done","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":627,"context_line":"                            try:"},{"line_number":628,"context_line":"                                ip_wrapper.netns.execute(cmd,"},{"line_number":629,"context_line":"                                                         check_exit_code\u003dTrue,"},{"line_number":630,"context_line":"                                                         extra_ok_codes\u003d[1])"},{"line_number":631,"context_line":"                            except RuntimeError:"},{"line_number":632,"context_line":"                                LOG.debug("},{"line_number":633,"context_line":"                                    \"Failed deleting conntrack ip %s\", ip_str)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_21281436","line":630,"updated":"2015-01-19 13:37:12.000000000","message":"does conntrack -D return 1 only when the rule is not found?","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":627,"context_line":"                            try:"},{"line_number":628,"context_line":"                                ip_wrapper.netns.execute(cmd,"},{"line_number":629,"context_line":"                                                         check_exit_code\u003dTrue,"},{"line_number":630,"context_line":"                                                         extra_ok_codes\u003d[1])"},{"line_number":631,"context_line":"                            except RuntimeError:"},{"line_number":632,"context_line":"                                LOG.debug("},{"line_number":633,"context_line":"                                    \"Failed deleting conntrack ip %s\", ip_str)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_d45b7784","line":630,"in_reply_to":"3a961159_21281436","updated":"2015-01-20 04:05:40.000000000","message":"yes","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":640,"context_line":"                        except RuntimeError:"},{"line_number":641,"context_line":"                            LOG.debug("},{"line_number":642,"context_line":"                                \"Failed deleting conntrack ip %s\", ip_str)"},{"line_number":643,"context_line":"                    cmd.remove(ip_str)"},{"line_number":644,"context_line":""},{"line_number":645,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":646,"context_line":"        need_delete_rule_ids \u003d set()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_61ef7c1e","line":643,"updated":"2015-01-19 13:37:12.000000000","message":"This method is rather long (over 70 lines). You should consider splitting in more shorter methods","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":640,"context_line":"                        except RuntimeError:"},{"line_number":641,"context_line":"                            LOG.debug("},{"line_number":642,"context_line":"                                \"Failed deleting conntrack ip %s\", ip_str)"},{"line_number":643,"context_line":"                    cmd.remove(ip_str)"},{"line_number":644,"context_line":""},{"line_number":645,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":646,"context_line":"        need_delete_rule_ids \u003d set()"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_dede383e","line":643,"in_reply_to":"3a961159_61ef7c1e","updated":"2015-01-20 04:05:40.000000000","message":"ok","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":643,"context_line":"                    cmd.remove(ip_str)"},{"line_number":644,"context_line":""},{"line_number":645,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":646,"context_line":"        need_delete_rule_ids \u003d set()"},{"line_number":647,"context_line":"        pool \u003d eventlet.GreenPool(size\u003d8)"},{"line_number":648,"context_line":"        for rule_id, rule_info in self.defer_sg_rules.items():"},{"line_number":649,"context_line":"            device_ids \u003d rule_info.get(\u0027devices\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_61c69c9e","line":646,"updated":"2015-01-19 13:37:12.000000000","message":"consider renaming to rule_ids_to_delete","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":643,"context_line":"                    cmd.remove(ip_str)"},{"line_number":644,"context_line":""},{"line_number":645,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":646,"context_line":"        need_delete_rule_ids \u003d set()"},{"line_number":647,"context_line":"        pool \u003d eventlet.GreenPool(size\u003d8)"},{"line_number":648,"context_line":"        for rule_id, rule_info in self.defer_sg_rules.items():"},{"line_number":649,"context_line":"            device_ids \u003d rule_info.get(\u0027devices\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_1ee0c0f7","line":646,"in_reply_to":"3a961159_61c69c9e","updated":"2015-01-20 04:05:40.000000000","message":"agree","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cce336826d93c201899ce0ab120aa0fbfd1ff707","unresolved":false,"context_lines":[{"line_number":546,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":547,"context_line":""},{"line_number":548,"context_line":"    def _ip_wrapper_execute(self, cmd, ip_str):"},{"line_number":549,"context_line":"        ip_wrapper \u003d ip_lib.IPWrapper(self.root_helper)"},{"line_number":550,"context_line":"        try:"},{"line_number":551,"context_line":"            ip_wrapper.netns.execute(cmd,"},{"line_number":552,"context_line":"                                     check_exit_code\u003dTrue, extra_ok_codes\u003d[1])"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_950aae1f","line":549,"updated":"2015-01-28 22:27:14.000000000","message":"You\u0027re not passing \u0027namespace\u003d\u0027 here, so the overhead of going through the ip_lib code doesn\u0027t seem necessary.  I think this can just be utils.execute(..) so you don\u0027t really need this function at all.","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"ae84f63beab2c9c84e279d378d376fbb997921ac","unresolved":false,"context_lines":[{"line_number":546,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":547,"context_line":""},{"line_number":548,"context_line":"    def _ip_wrapper_execute(self, cmd, ip_str):"},{"line_number":549,"context_line":"        ip_wrapper \u003d ip_lib.IPWrapper(self.root_helper)"},{"line_number":550,"context_line":"        try:"},{"line_number":551,"context_line":"            ip_wrapper.netns.execute(cmd,"},{"line_number":552,"context_line":"                                     check_exit_code\u003dTrue, extra_ok_codes\u003d[1])"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_6949a15f","line":549,"in_reply_to":"fa81d914_950aae1f","updated":"2015-01-30 07:43:09.000000000","message":"agree","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cce336826d93c201899ce0ab120aa0fbfd1ff707","unresolved":false,"context_lines":[{"line_number":551,"context_line":"            ip_wrapper.netns.execute(cmd,"},{"line_number":552,"context_line":"                                     check_exit_code\u003dTrue, extra_ok_codes\u003d[1])"},{"line_number":553,"context_line":"        except RuntimeError:"},{"line_number":554,"context_line":"            LOG.debug(\"Failed deleting conntrack ip %s\", ip_str)"},{"line_number":555,"context_line":""},{"line_number":556,"context_line":"    def _delete_conntrack(self, device_ids, rule):"},{"line_number":557,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_956f0ec5","line":554,"updated":"2015-01-28 22:27:14.000000000","message":"The code in interface.py:delete_conntrack_state() uses LOG.exception in this case, think you should do the same here.","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"ae84f63beab2c9c84e279d378d376fbb997921ac","unresolved":false,"context_lines":[{"line_number":551,"context_line":"            ip_wrapper.netns.execute(cmd,"},{"line_number":552,"context_line":"                                     check_exit_code\u003dTrue, extra_ok_codes\u003d[1])"},{"line_number":553,"context_line":"        except RuntimeError:"},{"line_number":554,"context_line":"            LOG.debug(\"Failed deleting conntrack ip %s\", ip_str)"},{"line_number":555,"context_line":""},{"line_number":556,"context_line":"    def _delete_conntrack(self, device_ids, rule):"},{"line_number":557,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_8915f5e6","line":554,"in_reply_to":"fa81d914_956f0ec5","updated":"2015-01-30 07:43:09.000000000","message":"agree","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cce336826d93c201899ce0ab120aa0fbfd1ff707","unresolved":false,"context_lines":[{"line_number":568,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":569,"context_line":"            con_direction \u003d \u0027-d\u0027"},{"line_number":570,"context_line":"        else:"},{"line_number":571,"context_line":"            con_direction \u003d \u0027-s\u0027"},{"line_number":572,"context_line":""},{"line_number":573,"context_line":"        for device_id in device_ids:"},{"line_number":574,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_46d7aaed","line":571,"updated":"2015-01-28 22:27:14.000000000","message":"I know I have comments below, but I thought of another way to do this.  Don\u0027t know if it\u0027s better (as in faster), but it might make it more obvious what\u0027s happening.\n\nIf you build-up cmd[] above to be, for example:\n\n    [\u0027conntrack\u0027, \u0027-D\u0027, \u0027-p\u0027, \u0027TCP\u0027, \u0027-f\u0027, \u0027ipv6\u0027, \u0027-d\u0027]\n\nThen each time through the loop (inside \u0027for ip in ips:\u0027) can be:\n\n    ip_cmd \u003d [ip_str, \u0027-w\u0027, zone_id]\n    utils.execute(cmd + ip_cmd, ...)\n\nIt will remove a lot of code with all the cmd.append/remove calls going away.","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"ae84f63beab2c9c84e279d378d376fbb997921ac","unresolved":false,"context_lines":[{"line_number":568,"context_line":"        if direction \u003d\u003d \u0027ingress\u0027:"},{"line_number":569,"context_line":"            con_direction \u003d \u0027-d\u0027"},{"line_number":570,"context_line":"        else:"},{"line_number":571,"context_line":"            con_direction \u003d \u0027-s\u0027"},{"line_number":572,"context_line":""},{"line_number":573,"context_line":"        for device_id in device_ids:"},{"line_number":574,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_29d0891e","line":571,"in_reply_to":"fa81d914_46d7aaed","updated":"2015-01-30 07:43:09.000000000","message":"it is a good suggestion, thanks very much!","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cce336826d93c201899ce0ab120aa0fbfd1ff707","unresolved":false,"context_lines":[{"line_number":571,"context_line":"            con_direction \u003d \u0027-s\u0027"},{"line_number":572,"context_line":""},{"line_number":573,"context_line":"        for device_id in device_ids:"},{"line_number":574,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"},{"line_number":575,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":576,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":577,"context_line":"            if zone_id not in ip_info:"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_fb1bdb19","line":574,"updated":"2015-01-28 22:27:14.000000000","message":"if not device_info:\n    continue\n\nNot sure if that will happen, but remove_port_filter() has a similar check.","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"ae84f63beab2c9c84e279d378d376fbb997921ac","unresolved":false,"context_lines":[{"line_number":571,"context_line":"            con_direction \u003d \u0027-s\u0027"},{"line_number":572,"context_line":""},{"line_number":573,"context_line":"        for device_id in device_ids:"},{"line_number":574,"context_line":"            device_info \u003d self.filtered_ports.get(device_id)"},{"line_number":575,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":576,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":577,"context_line":"            if zone_id not in ip_info:"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_69c6016a","line":574,"in_reply_to":"fa81d914_fb1bdb19","updated":"2015-01-30 07:43:09.000000000","message":"agree","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cce336826d93c201899ce0ab120aa0fbfd1ff707","unresolved":false,"context_lines":[{"line_number":575,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":576,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":577,"context_line":"            if zone_id not in ip_info:"},{"line_number":578,"context_line":"                cmd.append(\u0027-w\u0027)"},{"line_number":579,"context_line":"                cmd.append(zone_id)"},{"line_number":580,"context_line":"                ip_info.add(zone_id)"},{"line_number":581,"context_line":"                cmd.append(con_direction)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_184fd5be","line":578,"updated":"2015-01-28 22:27:14.000000000","message":"Every loop is appending and removing this \u0027-w\u0027, so it can move outside \u0027for device_id...\u0027","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"ae84f63beab2c9c84e279d378d376fbb997921ac","unresolved":false,"context_lines":[{"line_number":575,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":576,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":577,"context_line":"            if zone_id not in ip_info:"},{"line_number":578,"context_line":"                cmd.append(\u0027-w\u0027)"},{"line_number":579,"context_line":"                cmd.append(zone_id)"},{"line_number":580,"context_line":"                ip_info.add(zone_id)"},{"line_number":581,"context_line":"                cmd.append(con_direction)"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_89c33556","line":578,"in_reply_to":"fa81d914_184fd5be","updated":"2015-01-30 07:43:09.000000000","message":"Done","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"cce336826d93c201899ce0ab120aa0fbfd1ff707","unresolved":false,"context_lines":[{"line_number":586,"context_line":"                    cmd.remove(ip_str)"},{"line_number":587,"context_line":"                cmd.remove(zone_id)"},{"line_number":588,"context_line":"                cmd.remove(\u0027-w\u0027)"},{"line_number":589,"context_line":"                cmd.remove(con_direction)"},{"line_number":590,"context_line":""},{"line_number":591,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":592,"context_line":"        rule_ids_to_delete \u003d set()"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_1b350fda","line":589,"updated":"2015-01-28 22:27:14.000000000","message":"nit: move this above zone_id so it looks like you\u0027re pushing/popping arguments","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"ae84f63beab2c9c84e279d378d376fbb997921ac","unresolved":false,"context_lines":[{"line_number":586,"context_line":"                    cmd.remove(ip_str)"},{"line_number":587,"context_line":"                cmd.remove(zone_id)"},{"line_number":588,"context_line":"                cmd.remove(\u0027-w\u0027)"},{"line_number":589,"context_line":"                cmd.remove(con_direction)"},{"line_number":590,"context_line":""},{"line_number":591,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":592,"context_line":"        rule_ids_to_delete \u003d set()"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_a9a399b0","line":589,"in_reply_to":"fa81d914_1b350fda","updated":"2015-01-30 07:43:09.000000000","message":"Done","commit_id":"3120a09391f0c87a6b740a74f81708f63d763e3c"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"ea1304325691e5fa1204977bed06dce1fe8ae06b","unresolved":false,"context_lines":[{"line_number":554,"context_line":"            if remove_group_id in self.sg_rules:"},{"line_number":555,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":556,"context_line":""},{"line_number":557,"context_line":"    def _execute(self, cmd, ip_str):"},{"line_number":558,"context_line":"        try:"},{"line_number":559,"context_line":"            utils.execute(cmd, self.root_helper,"},{"line_number":560,"context_line":"                          check_exit_code\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":8,"id":"da86d52c_125e12ea","line":557,"updated":"2015-01-30 21:14:40.000000000","message":"I think this code should just be put into the caller - it\u0027s really not doing any extra work than calling utils.execute()","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9a7016c700732ad3f81f74abb68cc6650514a25f","unresolved":false,"context_lines":[{"line_number":554,"context_line":"            if remove_group_id in self.sg_rules:"},{"line_number":555,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":556,"context_line":""},{"line_number":557,"context_line":"    def _execute(self, cmd, ip_str):"},{"line_number":558,"context_line":"        try:"},{"line_number":559,"context_line":"            utils.execute(cmd, self.root_helper,"},{"line_number":560,"context_line":"                          check_exit_code\u003dTrue,"}],"source_content_type":"text/x-python","patch_set":8,"id":"da86d52c_55878f61","line":557,"in_reply_to":"da86d52c_125e12ea","updated":"2015-01-31 01:24:46.000000000","message":"thanks for your review, I agree!","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"594ff3655eee81072dbe3e24fba0adbf19c5d6c2","unresolved":false,"context_lines":[{"line_number":563,"context_line":"            LOG.exception(_LE(\"Failed deleting conntrack ip %s\"), ip_str)"},{"line_number":564,"context_line":""},{"line_number":565,"context_line":"    def _delete_conntrack(self, device_ids, rule):"},{"line_number":566,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":567,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":568,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":569,"context_line":"        ip_info \u003d set()"}],"source_content_type":"text/x-python","patch_set":8,"id":"da86d52c_98c9415d","line":566,"updated":"2015-01-30 22:32:54.000000000","message":"I would refactor this block (566-581) out to a function\n_delete_conntrack_cmd_for_rule or something like that\n\nso you just do cmd \u003d self._delete_conntrack_cmd_for_rule(rule)","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"594ff3655eee81072dbe3e24fba0adbf19c5d6c2","unresolved":false,"context_lines":[{"line_number":566,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":567,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":568,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":569,"context_line":"        ip_info \u003d set()"},{"line_number":570,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":571,"context_line":"        if protocol:"},{"line_number":572,"context_line":"            cmd.append(\u0027-p\u0027)"}],"source_content_type":"text/x-python","patch_set":8,"id":"da86d52c_f8d79deb","line":569,"updated":"2015-01-30 22:32:54.000000000","message":"please, move this down near to the block where it\u0027s used \n(just before the for)","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9a7016c700732ad3f81f74abb68cc6650514a25f","unresolved":false,"context_lines":[{"line_number":566,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":567,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":568,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":569,"context_line":"        ip_info \u003d set()"},{"line_number":570,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":571,"context_line":"        if protocol:"},{"line_number":572,"context_line":"            cmd.append(\u0027-p\u0027)"}],"source_content_type":"text/x-python","patch_set":8,"id":"da86d52c_d5929f9e","line":569,"in_reply_to":"da86d52c_f8d79deb","updated":"2015-01-31 01:24:46.000000000","message":"agree","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"594ff3655eee81072dbe3e24fba0adbf19c5d6c2","unresolved":false,"context_lines":[{"line_number":585,"context_line":"                continue"},{"line_number":586,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":587,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":588,"context_line":"            if zone_id not in ip_info:"},{"line_number":589,"context_line":"                ip_info.add(zone_id)"},{"line_number":590,"context_line":"                for ip in ips:"},{"line_number":591,"context_line":"                    ip_str \u003d str(netaddr.IPNetwork(ip).ip)"}],"source_content_type":"text/x-python","patch_set":8,"id":"da86d52c_b82285ff","line":588,"updated":"2015-01-30 22:32:54.000000000","message":"what about renaming ip_info into.. cleared_zones ? \n\nip_info sounds confusing :D","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9a7016c700732ad3f81f74abb68cc6650514a25f","unresolved":false,"context_lines":[{"line_number":585,"context_line":"                continue"},{"line_number":586,"context_line":"            zone_id \u003d device_info.get(\u0027zone_id\u0027, 0)"},{"line_number":587,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":588,"context_line":"            if zone_id not in ip_info:"},{"line_number":589,"context_line":"                ip_info.add(zone_id)"},{"line_number":590,"context_line":"                for ip in ips:"},{"line_number":591,"context_line":"                    ip_str \u003d str(netaddr.IPNetwork(ip).ip)"}],"source_content_type":"text/x-python","patch_set":8,"id":"da86d52c_d5d9bf84","line":588,"in_reply_to":"da86d52c_b82285ff","updated":"2015-01-31 01:24:46.000000000","message":"ok","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"b912011182dfb8e5ffb2e7fa2e35931b342947bb","unresolved":false,"context_lines":[{"line_number":576,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":577,"context_line":"        else:"},{"line_number":578,"context_line":"            cmd.append(\u0027-s\u0027)"},{"line_number":579,"context_line":"        return cmd"},{"line_number":580,"context_line":""},{"line_number":581,"context_line":"    def _delete_conntrack_state_by_rule(self, device_ids, rule):"},{"line_number":582,"context_line":"        cmd \u003d self._delete_conntrack_cmd_for_rule(rule)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_7803840f","line":579,"updated":"2015-02-02 13:19:28.000000000","message":"Thank you for addressing my comments. !! :)","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"a771d3e3949f21a2eebf47d01864f6037fe2f2fd","unresolved":false,"context_lines":[{"line_number":576,"context_line":"            cmd.append(\u0027-d\u0027)"},{"line_number":577,"context_line":"        else:"},{"line_number":578,"context_line":"            cmd.append(\u0027-s\u0027)"},{"line_number":579,"context_line":"        return cmd"},{"line_number":580,"context_line":""},{"line_number":581,"context_line":"    def _delete_conntrack_state_by_rule(self, device_ids, rule):"},{"line_number":582,"context_line":"        cmd \u003d self._delete_conntrack_cmd_for_rule(rule)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_9f3f1d25","line":579,"in_reply_to":"da86d52c_7803840f","updated":"2015-02-03 03:33:20.000000000","message":"Done","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"b912011182dfb8e5ffb2e7fa2e35931b342947bb","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_13dd0b71","line":595,"updated":"2015-02-02 13:19:28.000000000","message":"Oppps, big question, may be I lost something from my memory:\n\nIf we delete the conntrack rules for a whole zone_id because of an specific rule.... won\u0027t that break other ESTABLISHED/RELATED connections to the same port/net(connected to the vlan id on the current implementation?)\n\nSorry, I\u0027m missing something in the picture now, but it\u0027s probably just me.\n\nCan you explain how the whole mechamism works?","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"52e33a9aa05d15e172547eafc103013f9523d068","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_987c5cb7","line":595,"in_reply_to":"da86d52c_136878f4","updated":"2015-02-04 04:07:43.000000000","message":"I agree with you that \u0027a non tracked connection packet travels back to / from the floating IP, and the conntrack entry is recreated\u0027, and it need a bit time. I also want to see your test result. Miguel, thanks very much!","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"a771d3e3949f21a2eebf47d01864f6037fe2f2fd","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_f32a128f","line":595,"in_reply_to":"da86d52c_13dd0b71","updated":"2015-02-03 03:33:20.000000000","message":"hi ajo, thanks for your review! it is a good question you have asked. For a ip connection, it need a 5 tuple(sr_ip,sr_port,des_ip,det_port,protocol), but now the conntrack-tools does not support port, so when a sg rule is deleted, it could\u0027t find a exact ip_conntrack_connect, so there is a tradeoff, when a sg rule is deleted, I will find the ports which is belong to this sg, then delete the ip_conntrack_connect which destination ip is these port fiexd ips, I don\u0027t know if it is ok or there is better method? we can communicate on IRC.","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"3e1a78cd3078f93b028c38ef8106af1c7dd553f0","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_6c5d2647","line":595,"in_reply_to":"da86d52c_31a9cbdf","updated":"2015-02-04 07:43:46.000000000","message":"hi Miguel, your analysis is very wonderful, I agree with your opinion very much, I do a little added that we just need consider the Connection-oriented TCP protocol, for the stateless protocol udp, icmp, we don\u0027t need do anything. \nMiguel, @Salvatore, do we need make it to optionnal?  User \ncan close this if the don\u0027t accept it!","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"83f8ffe36be9b05ddb07aada28d5103d6462da0a","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_9d3341aa","line":595,"in_reply_to":"da86d52c_3bd521b9","updated":"2015-02-05 01:14:15.000000000","message":"agree, the unit tests for this change will be finished!","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"6d81433b3f4fb6cb08d4e01ec4370148b5ead149","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_136878f4","line":595,"in_reply_to":"da86d52c_4d724de6","updated":"2015-02-03 11:44:31.000000000","message":"I\u0027m not 100% sure of what I said, I need to check, \n\nThe other possible behavior (better for us), is that a non tracked connection packet travels back to / from the floating IP, and the conntrack entry is recreated.\n\nIn this case we\u0027re only adding a bit more delay for connections only until the conntrack entry is recreated.\n\nI can recall a behavior like that, so I\u0027m going to put both patches together (zone marking and zone conntrack killing) and test the real behavior.","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"76a98928da607cc7b88a74b2631832302f3f0c99","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_3bd521b9","line":595,"in_reply_to":"da86d52c_6c5d2647","updated":"2015-02-04 11:00:57.000000000","message":"My opinion(after analysis) is that we don\u0027t need to make it optional, as it won\u0027t be breaking anybodys connection.","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"15e4e0c1bae893f552c1154dc2284998c26f9862","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_4d724de6","line":595,"in_reply_to":"da86d52c_92862712","updated":"2015-02-03 10:55:53.000000000","message":"I think this is important. We\u0027re basically fixing the issue by introducing another one (and then there were people asking me why we would need a blueprint for this!).\n\nWe cannot go around the limitation in conntrack tool, and that\u0027s ok.\nHowever, I wonder how hard it would be to identify connections to kill by source ip address. This will still unfortunately kill all connections from a given IP address, but it would surely be less disruptive than killing all connections to a given address.\n\nI suspect that my request will be pretty much tantamount to re-architect the whole patch and also the dependent one, but I\u0027m still hopeful!\n\nThis limitation in conntrack tool might turn out to be a show stopper.","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"5af8f468fc18edcd96fa0633e702663304601d35","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_31a9cbdf","line":595,"in_reply_to":"da86d52c_987c5cb7","updated":"2015-02-04 06:25:28.000000000","message":"Ok, reporting my tests here, good news, and not so good news, but\n neither the end of the world ;) (TL;please R warning)\n\n1) With our current rules, this doesn\u0027t break existing connections, just\nfully reevaluates them as they pass by the filters. (it seems a packet\nfor an unknown connection is not considered \"INVALID\" thus not\ndropped) -which is *GOOD*-\n\n2) This patch, per-se doesn\u0027t totally kill an undesired existing\nconnection, with the current default security group rules, let me\nexplain why:\n\n\nLet\u0027s think of this scenario:\n\n- we have the default rules + ingress port 22\n- The instance IP is IPi, the remote IP is IPr, we\u0027re exposed via a\nfloating IPf\n\n\nEvents\n\na) IPr connects to IPf(IPi) on port 22\nb) connection is accepted via the typical 3-way handshake -\u003eSYN,\n\u003c-SYN/ACK -\u003e ACK\n\nany of the ACKs makes the connection ESTABLISHED on the\nconntrack (partly guessing here by observation)\n\nc) they keep sending messages as the connection on port 22 is\nactive.\n\n\nd) the admin removes the rule for port 22, that cleans up the\nconntrack table for IPi in the conntrack table for the specific zone,\nas expected.\n\ne) IPr sends traffic to IPf, it\u0027s ignored, as we don\u0027t have any rule no\nfor that. (yippieee!)\n\nf) IPi(IPf) sends a bit of traffic to IPr, as the connection it\u0027s still\nconsidered open for both ends, and IPi needs to send something...\n\nSo... we have by default egress all...\u003e the conntrack connection is\nreopened with src\u003dIPi, dst\u003dIPr, src_port\u003d22, dst_port\u003dP\n\nthey can keep talking... as if nothing happened....\n\n\nThe only way to alleviate this, is to remove the default egress all\nrule, and only open specific ports as needed (80, 22, 443...)\n\n\nThen, if we used such schema, if IPr were able to select any of those\negress open ports (P in (80, 22, 443)) his connection could not be\nalways killed.\n\n\nThe only way to prevent this, would be to DROP any TCP\nconnection that doesn\u0027t follow the standard open / data / close flow,\nbut that would also require a conntrack with full tuple selection at\ndelete time (otherwise the other running connections would be also\ndead with the current implementation). We couldn\u0027t do anything extra\nfor UDP btw.\n\nAnother interesting thing to consider would be to REJECT unwanted\npackets instead of DROPping, (that would send an ICMP back at point e, dropping the connection on the remote side).\n\n\nFor me, this patch seems like a good step into the good direction, we\nwon\u0027t have a super-perfect solution, but it\u0027s absolutely much better \nthan not being able to drop connections.\n\nI only believe this needs documentation. DocImpact?\n\n@Salvatore, @shihanzhang, what do you think?","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e60ad182f2a412460d10fe5d6fcd9f56737e2fd6","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_ca9d845b","line":595,"in_reply_to":"da86d52c_9d3341aa","updated":"2015-02-08 19:25:18.000000000","message":"Miguel, I think your analysis is pretty much correct, even if I would have expected IPi to reeopen a connection with IPf rather than IPr.\nIt\u0027s consistent also with the \"good\" part of your analysis... the connection gets re-evaluated, the conntrack rule added back, and then it\u0027s live again.\n\nThis means that we\u0027re not fixing the problem in 100% but as it\u0027s likely to be we will be fixing a good deal of those issues. Changing the default egress behaviour if out of the question for now IMHO. I agree that the best thing we can do at the moment is to go ahead with this plan, and then release note the limitations that come with this approach.\n\nCan you elaborate a bit more on your idea of applying a REJECT to unwanted packets? I was thinking of using conntrack to retrieve the connections we were going to delete, and before doing that adding blackhole ad-hoc iptables rules for them, but this would have the drawback of being error-prone and leaving us with the problem of garbage collecting iptables rules.","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"e628ebb8986e798531d72f989c8f1a24a023107a","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_f824d4b0","line":595,"in_reply_to":"da86d52c_ca9d845b","updated":"2015-02-09 11:01:11.000000000","message":"Yeah, correct, it\u0027s IPi punching back the hole by being re-evaluated and re-adding the conntrack rule. The \"(IPf)\" part was simple to make it easier that it was associated to IPi.\n\n\nThis is more of a documentation issue, and we would be on a better place than we are now IMHO too\n\nAbout applying REJECT, it wasn\u0027t my suggestion, but probably could make sense (in a second iteration for \"L_____\" ?).\n\nWe would need to mark rules with a timestamp to make sure we expire them on later iptable accesses, and also, clear them if the ports are opened again by security rules, If I\u0027m not missing any corner case.","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"b8a2a3ae98e953b6020f2d665789f1d8182c8fbd","unresolved":false,"context_lines":[{"line_number":592,"context_line":"                try:"},{"line_number":593,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"},{"line_number":594,"context_line":"                                  check_exit_code\u003dTrue,"},{"line_number":595,"context_line":"                                  extra_ok_codes\u003d[1])"},{"line_number":596,"context_line":"                except RuntimeError:"},{"line_number":597,"context_line":"                    LOG.exception(_LE(\"Failed deleting conntrack ip %s\"),"},{"line_number":598,"context_line":"                                  ip_str)"}],"source_content_type":"text/x-python","patch_set":10,"id":"da86d52c_92862712","line":595,"in_reply_to":"da86d52c_f32a128f","updated":"2015-02-03 09:57:44.000000000","message":"Ok, so we kill over the IP + zone_id pair.\n\nLet\u0027s imagine this, we start with, the next security rules:\n\n1) ingress tcp port 80\n2) ingress tcp port 22\n\nThen connections happen to our IP1 (Zone A)\n\nc1:   from IPa, to IP1, port 80\nc2:   from IPb, to IP1, port 22\nc3:   from IPc, to IP1, port 22\n\nThey are all on the same zone, as they are over the same tenant network, and that\u0027s the convention we selected for zones.\n\n\nThen, if we remove rule 1, we kill the IP1/zone A, that means,\nconnections c2, and c3, will also be cleared from the connection tracker, thus will stop working right away. (their ESTABLISHED or RELATED status will be gone), and next packet that tries to traverse won\u0027t be a connection trying to open, thus as not tracked (please feel free to correct me here if I\u0027m wrong, because I could be, I\u0027m not 100% sure about this) it won\u0027t pass?\n\nI believe that (if it\u0027s right) wouldn\u0027t be acceptable, and we need conntrack-tool support to specify details with more granularity.\n\nPlease let me know whether my understanding is right or I\u0027m totally wrong.\n\nThanks a lot,\nMiguel","commit_id":"1cd55fb009e5c33315f896683d6206041e021007"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"f05772a82a58ff128ca166379b6c6b1d246d1a57","unresolved":false,"context_lines":[{"line_number":561,"context_line":"            if remove_group_id in self.sg_rules:"},{"line_number":562,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":563,"context_line":""},{"line_number":564,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":565,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":566,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":567,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_126dfb04","line":564,"updated":"2015-02-09 15:47:40.000000000","message":"Probably too much nitpicking by me...\n\n\"\"\"Command, not including IP address, to delete a conntrack table rule\"\"\"","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"17fb9c9bd356e200680d6f4c9ac27858ec265acc","unresolved":false,"context_lines":[{"line_number":561,"context_line":"            if remove_group_id in self.sg_rules:"},{"line_number":562,"context_line":"                self.sg_rules.pop(remove_group_id, None)"},{"line_number":563,"context_line":""},{"line_number":564,"context_line":"    def _delete_conntrack_cmd_for_rule(self, rule):"},{"line_number":565,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":566,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":567,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_936716ea","line":564,"in_reply_to":"da86d52c_126dfb04","updated":"2015-02-10 01:19:30.000000000","message":"hi Brian Haley, thanks for your review, feel free to pick nit!","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":14249,"name":"Lionel Zerbib","email":"ariel.zerbib@gmail.com","username":"lionelz"},"change_message_id":"b195fc7763a65a05fe86953c2c76244a8f1e079f","unresolved":false,"context_lines":[{"line_number":565,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":566,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":567,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":568,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":569,"context_line":"        if protocol:"},{"line_number":570,"context_line":"            cmd.append(\u0027-p\u0027)"},{"line_number":571,"context_line":"            cmd.append(str(protocol))"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a80dd14_46939aa2","line":568,"updated":"2015-03-15 09:59:39.000000000","message":"It would be maybe better to create a manager for conntrack command like ipset and iptables.","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"43dcef3d421fa3577a309b54e767130e159afd11","unresolved":false,"context_lines":[{"line_number":565,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":566,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":567,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":568,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":569,"context_line":"        if protocol:"},{"line_number":570,"context_line":"            cmd.append(\u0027-p\u0027)"},{"line_number":571,"context_line":"            cmd.append(str(protocol))"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a80dd14_e4147745","line":568,"in_reply_to":"9a80dd14_46939aa2","updated":"2015-03-16 09:14:33.000000000","message":"That\u0027s actually a very good idea IMO.","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"320cf5379b07b020bf6cacbb3ecb025f714ec679","unresolved":false,"context_lines":[{"line_number":565,"context_line":"        ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":566,"context_line":"        protocol \u003d rule.get(\u0027protocol\u0027)"},{"line_number":567,"context_line":"        direction \u003d rule.get(\u0027direction\u0027)"},{"line_number":568,"context_line":"        cmd \u003d [\u0027conntrack\u0027, \u0027-D\u0027]"},{"line_number":569,"context_line":"        if protocol:"},{"line_number":570,"context_line":"            cmd.append(\u0027-p\u0027)"},{"line_number":571,"context_line":"            cmd.append(str(protocol))"}],"source_content_type":"text/x-python","patch_set":12,"id":"9a80dd14_65e20131","line":568,"in_reply_to":"9a80dd14_e4147745","updated":"2015-03-17 12:45:25.000000000","message":"good suggestion, I will address it in next patch!","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"f05772a82a58ff128ca166379b6c6b1d246d1a57","unresolved":false,"context_lines":[{"line_number":588,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":589,"context_line":"            for ip in ips:"},{"line_number":590,"context_line":"                ip_str \u003d str(netaddr.IPNetwork(ip).ip)"},{"line_number":591,"context_line":"                ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":592,"context_line":"                if str(netaddr.IPNetwork(ip).version) not in ethertype:"},{"line_number":593,"context_line":"                    continue"},{"line_number":594,"context_line":"                ip_cmd \u003d [ip_str, \u0027-w\u0027, zone_id]"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_12fedb6b","line":591,"updated":"2015-02-09 15:47:40.000000000","message":"I\u0027m not sure rule.get() has much overhead, but this can be moved outside both loops since it won\u0027t change, say after cmd initialization at L582","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"17fb9c9bd356e200680d6f4c9ac27858ec265acc","unresolved":false,"context_lines":[{"line_number":588,"context_line":"            ips \u003d device_info.get(\u0027fixed_ips\u0027, [])"},{"line_number":589,"context_line":"            for ip in ips:"},{"line_number":590,"context_line":"                ip_str \u003d str(netaddr.IPNetwork(ip).ip)"},{"line_number":591,"context_line":"                ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":592,"context_line":"                if str(netaddr.IPNetwork(ip).version) not in ethertype:"},{"line_number":593,"context_line":"                    continue"},{"line_number":594,"context_line":"                ip_cmd \u003d [ip_str, \u0027-w\u0027, zone_id]"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_6812ad63","line":591,"in_reply_to":"da86d52c_12fedb6b","updated":"2015-02-10 01:19:30.000000000","message":"agree with your suggestion!","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"f05772a82a58ff128ca166379b6c6b1d246d1a57","unresolved":false,"context_lines":[{"line_number":590,"context_line":"                ip_str \u003d str(netaddr.IPNetwork(ip).ip)"},{"line_number":591,"context_line":"                ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":592,"context_line":"                if str(netaddr.IPNetwork(ip).version) not in ethertype:"},{"line_number":593,"context_line":"                    continue"},{"line_number":594,"context_line":"                ip_cmd \u003d [ip_str, \u0027-w\u0027, zone_id]"},{"line_number":595,"context_line":"                try:"},{"line_number":596,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_92c72b64","line":593,"updated":"2015-02-09 15:47:40.000000000","message":"Nit: you\u0027re calling netaddr twice in succession here, this can be:\n\nnet \u003d netaddr.IPNetwork(ip)\nif str(net.version) not in ethertype:\n    continue\nip_cmd \u003d [str(net.ip), \u0027-w\u0027, zone_id]","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"17fb9c9bd356e200680d6f4c9ac27858ec265acc","unresolved":false,"context_lines":[{"line_number":590,"context_line":"                ip_str \u003d str(netaddr.IPNetwork(ip).ip)"},{"line_number":591,"context_line":"                ethertype \u003d rule.get(\u0027ethertype\u0027)"},{"line_number":592,"context_line":"                if str(netaddr.IPNetwork(ip).version) not in ethertype:"},{"line_number":593,"context_line":"                    continue"},{"line_number":594,"context_line":"                ip_cmd \u003d [ip_str, \u0027-w\u0027, zone_id]"},{"line_number":595,"context_line":"                try:"},{"line_number":596,"context_line":"                    utils.execute(cmd + ip_cmd, self.root_helper,"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_08013106","line":593,"in_reply_to":"da86d52c_92c72b64","updated":"2015-02-10 01:19:30.000000000","message":"good suggestion!","commit_id":"8869586a6ffc8585fd49121c29c39d9c0b8d9cff"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"a76cca1c75a23b6d9d10cf0c7e6a98180d7d6e5a","unresolved":false,"context_lines":[{"line_number":669,"context_line":"            if not sg_has_members:"},{"line_number":670,"context_line":"                del self.sg_members[sg_id]"},{"line_number":671,"context_line":""},{"line_number":672,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":673,"context_line":"        rule_ids_to_delete \u003d set()"},{"line_number":674,"context_line":"        for rule_id, rule_info in self.defer_sg_rules.items():"},{"line_number":675,"context_line":"            device_info_list \u003d []"}],"source_content_type":"text/x-python","patch_set":14,"id":"1aca2d91_9d893029","line":672,"updated":"2015-05-08 15:19:25.000000000","message":"nit: invalid is maybe not the term I\u0027d use, we\u0027re really just removing entries from the cache.","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"70fd51d42f68f827af81bbfcfcaeaaa1f5a4a703","unresolved":false,"context_lines":[{"line_number":669,"context_line":"            if not sg_has_members:"},{"line_number":670,"context_line":"                del self.sg_members[sg_id]"},{"line_number":671,"context_line":""},{"line_number":672,"context_line":"    def _remove_invalid_conntrack(self):"},{"line_number":673,"context_line":"        rule_ids_to_delete \u003d set()"},{"line_number":674,"context_line":"        for rule_id, rule_info in self.defer_sg_rules.items():"},{"line_number":675,"context_line":"            device_info_list \u003d []"}],"source_content_type":"text/x-python","patch_set":14,"id":"9af37de9_31b6433e","line":672,"in_reply_to":"1aca2d91_9d893029","updated":"2015-05-11 02:03:07.000000000","message":"agree","commit_id":"88b2c6499c04ac407a8c096d1345a9eb3bc1e397"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":73,"context_line":"            lambda: collections.defaultdict(list))"},{"line_number":74,"context_line":"        self.pre_sg_members \u003d None"},{"line_number":75,"context_line":"        self.enable_ipset \u003d cfg.CONF.SECURITYGROUP.enable_ipset"},{"line_number":76,"context_line":"        self.defer_sg_rules \u003d {}"},{"line_number":77,"context_line":"        self.defer_sgs \u003d set()"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    @property"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_96599137","line":76,"updated":"2015-06-18 10:18:15.000000000","message":"unconntrack_deferred_sg_rules ?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        self.pre_sg_members \u003d None"},{"line_number":75,"context_line":"        self.enable_ipset \u003d cfg.CONF.SECURITYGROUP.enable_ipset"},{"line_number":76,"context_line":"        self.defer_sg_rules \u003d {}"},{"line_number":77,"context_line":"        self.defer_sgs \u003d set()"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    @property"},{"line_number":80,"context_line":"    def ports(self):"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_766dedca","line":77,"updated":"2015-06-18 10:18:15.000000000","message":"unconntrack_deferred_sgs?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":80,"context_line":"    def ports(self):"},{"line_number":81,"context_line":"        return dict(self.filtered_ports, **self.unfiltered_ports)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def update_defer_sg_rule(self, device_ids, sg_rule):"},{"line_number":84,"context_line":"        self.defer_sg_rules[sg_rule[\u0027id\u0027]] \u003d {\u0027rule\u0027: sg_rule,"},{"line_number":85,"context_line":"                                              \u0027devices\u0027: device_ids}"},{"line_number":86,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_1646e14e","line":83,"updated":"2015-06-18 10:18:15.000000000","message":"unconntrack_defer_sg_rule ?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":673,"context_line":"            if not sg_has_members:"},{"line_number":674,"context_line":"                del self.sg_members[sg_id]"},{"line_number":675,"context_line":""},{"line_number":676,"context_line":"    def _remove_conntrack_entries_from_cache(self):"},{"line_number":677,"context_line":"        rule_ids_to_delete \u003d set()"},{"line_number":678,"context_line":"        sg_ids_to_delete \u003d set()"},{"line_number":679,"context_line":"        for rule_id, rule_info in self.defer_sg_rules.items():"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_967e7168","line":676,"updated":"2015-06-18 10:18:15.000000000","message":"_unconntrack_from_removed_rules ?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":689,"context_line":"            rule_ids_to_delete.add(rule_id)"},{"line_number":690,"context_line":"        for id in rule_ids_to_delete:"},{"line_number":691,"context_line":"            self.defer_sg_rules.pop(id, None)"},{"line_number":692,"context_line":""},{"line_number":693,"context_line":"        for sg_id in self.defer_sgs:"},{"line_number":694,"context_line":"            deleted_members \u003d self._get_deleted_members(sg_id)"},{"line_number":695,"context_line":"            if deleted_members:"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_d6d6394e","line":692,"updated":"2015-06-18 10:18:15.000000000","message":"from here I\u0027d separate into a second function:\n\n_unconntrack_deleted_members_from_sgs \nand call it from L733 (after the call you already have)","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        self._enabled_netfilter_for_bridges \u003d False"},{"line_number":79,"context_line":"        self.updated_rule_sg_ids \u003d set()"},{"line_number":80,"context_line":"        self.updated_sg_members \u003d set()"},{"line_number":81,"context_line":"        self.updated_remote_sg_members \u003d collections.defaultdict(list)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def _enable_netfilter_for_bridges(self):"},{"line_number":84,"context_line":"        # we only need to set these values once, but it has to be when"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_6825d708","line":81,"updated":"2015-06-19 09:50:53.000000000","message":"Ok, the new names look better. :)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        self._enabled_netfilter_for_bridges \u003d False"},{"line_number":79,"context_line":"        self.updated_rule_sg_ids \u003d set()"},{"line_number":80,"context_line":"        self.updated_sg_members \u003d set()"},{"line_number":81,"context_line":"        self.updated_remote_sg_members \u003d collections.defaultdict(list)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def _enable_netfilter_for_bridges(self):"},{"line_number":84,"context_line":"        # we only need to set these values once, but it has to be when"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_f319b67a","line":81,"in_reply_to":"fa32b979_6825d708","updated":"2015-06-20 01:11:33.000000000","message":"thx for your affirmative ：）","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":117,"context_line":"            if device_ids:"},{"line_number":118,"context_line":"                self.updated_sg_members.update(device_ids)"},{"line_number":119,"context_line":"            else:"},{"line_number":120,"context_line":"                for sg_id in sec_group_ids:"},{"line_number":121,"context_line":"                    for device in self.filtered_ports.values():"},{"line_number":122,"context_line":"                        if sg_id in set("},{"line_number":123,"context_line":"                                device.get(\u0027security_group_source_groups\u0027,"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_961cfc14","line":120,"updated":"2015-06-19 09:50:53.000000000","message":"could we split this block to a separate function? :)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":117,"context_line":"            if device_ids:"},{"line_number":118,"context_line":"                self.updated_sg_members.update(device_ids)"},{"line_number":119,"context_line":"            else:"},{"line_number":120,"context_line":"                for sg_id in sec_group_ids:"},{"line_number":121,"context_line":"                    for device in self.filtered_ports.values():"},{"line_number":122,"context_line":"                        if sg_id in set("},{"line_number":123,"context_line":"                                device.get(\u0027security_group_source_groups\u0027,"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_9325caaf","line":120,"in_reply_to":"fa32b979_961cfc14","updated":"2015-06-20 01:11:33.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                    for device in self.filtered_ports.values():"},{"line_number":122,"context_line":"                        if sg_id in set("},{"line_number":123,"context_line":"                                device.get(\u0027security_group_source_groups\u0027,"},{"line_number":124,"context_line":"                                        [])):"},{"line_number":125,"context_line":"                            self.updated_remote_sg_members[sg_id].append("},{"line_number":126,"context_line":"                                device)"},{"line_number":127,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_96e39c05","line":124,"updated":"2015-06-19 09:50:53.000000000","message":"do you need to make a set to check sg_id in ...\n\nI believe you can just do\n\nif sg_id in device.get(\u0027security_group_source_groups\u0027, [])\n\n\u003e\u003e\u003e \u0027a\u0027 in [\u002711\u0027,\u0027a\u0027,\u0027b\u0027]\nTrue\n\u003e\u003e\u003e \u0027a\u0027 in [\u002711\u0027,\u0027b\u0027]\nFalse\n\nIt\u0027s going to be faster, since, you also need to traverse all the list to make the set,and then use the set function to lookup.","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                    for device in self.filtered_ports.values():"},{"line_number":122,"context_line":"                        if sg_id in set("},{"line_number":123,"context_line":"                                device.get(\u0027security_group_source_groups\u0027,"},{"line_number":124,"context_line":"                                        [])):"},{"line_number":125,"context_line":"                            self.updated_remote_sg_members[sg_id].append("},{"line_number":126,"context_line":"                                device)"},{"line_number":127,"context_line":""}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_7324c6ae","line":124,"in_reply_to":"fa32b979_96e39c05","updated":"2015-06-20 01:11:33.000000000","message":"good suggestion","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":716,"context_line":"        for sg_id in self.updated_rule_sg_ids:"},{"line_number":717,"context_line":"            device_list \u003d list()"},{"line_number":718,"context_line":"            del_rules \u003d list()"},{"line_number":719,"context_line":"            for pre_rule in self.pre_sg_rules[sg_id]:"},{"line_number":720,"context_line":"                if pre_rule not in self.sg_rules[sg_id]:"},{"line_number":721,"context_line":"                    del_rules.append(pre_rule)"},{"line_number":722,"context_line":"            if not del_rules:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_b6a90093","line":719,"updated":"2015-06-19 09:50:53.000000000","message":"refactor this for to _find_deleted_sg_rules?\n\ndel_rules \u003d self._find_deleted_sg_rules(sg_id)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":716,"context_line":"        for sg_id in self.updated_rule_sg_ids:"},{"line_number":717,"context_line":"            device_list \u003d list()"},{"line_number":718,"context_line":"            del_rules \u003d list()"},{"line_number":719,"context_line":"            for pre_rule in self.pre_sg_rules[sg_id]:"},{"line_number":720,"context_line":"                if pre_rule not in self.sg_rules[sg_id]:"},{"line_number":721,"context_line":"                    del_rules.append(pre_rule)"},{"line_number":722,"context_line":"            if not del_rules:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_33371ee5","line":719,"in_reply_to":"fa32b979_b6a90093","updated":"2015-06-20 01:11:33.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":721,"context_line":"                    del_rules.append(pre_rule)"},{"line_number":722,"context_line":"            if not del_rules:"},{"line_number":723,"context_line":"                continue"},{"line_number":724,"context_line":"            for device in self.filtered_ports.values():"},{"line_number":725,"context_line":"                if sg_id in device.get(\u0027security_groups\u0027):"},{"line_number":726,"context_line":"                    device_list.append(device)"},{"line_number":727,"context_line":"            for rule in del_rules:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_969f1c50","line":724,"updated":"2015-06-19 09:50:53.000000000","message":"refactor for to :\ndevices_list \u003d self._find_devices_on_security_group(sg_id)?\n\n? :)","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":721,"context_line":"                    del_rules.append(pre_rule)"},{"line_number":722,"context_line":"            if not del_rules:"},{"line_number":723,"context_line":"                continue"},{"line_number":724,"context_line":"            for device in self.filtered_ports.values():"},{"line_number":725,"context_line":"                if sg_id in device.get(\u0027security_groups\u0027):"},{"line_number":726,"context_line":"                    device_list.append(device)"},{"line_number":727,"context_line":"            for rule in del_rules:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_d33352f5","line":724,"in_reply_to":"fa32b979_969f1c50","updated":"2015-06-20 01:11:33.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":726,"context_line":"                    device_list.append(device)"},{"line_number":727,"context_line":"            for rule in del_rules:"},{"line_number":728,"context_line":"                if rule.get(\u0027direction\u0027) \u003d\u003d EGRESS_DIRECTION:"},{"line_number":729,"context_line":"                    continue"},{"line_number":730,"context_line":"                self.ipconntrack.delete_conntrack_state_by_rule("},{"line_number":731,"context_line":"                    device_list, rule)"},{"line_number":732,"context_line":"            deleted_sg_ids.add(sg_id)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_76d058f8","line":729,"updated":"2015-06-19 09:50:53.000000000","message":"Why do we skip egress direction rules? may be that\u0027s ok for the default egress all, but that can be changed by the tenant.\n\nProbably I\u0027m missing some detail.","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"1f1dc15233303cbdbcd1e12c644ee263ea7c39c3","unresolved":false,"context_lines":[{"line_number":726,"context_line":"                    device_list.append(device)"},{"line_number":727,"context_line":"            for rule in del_rules:"},{"line_number":728,"context_line":"                if rule.get(\u0027direction\u0027) \u003d\u003d EGRESS_DIRECTION:"},{"line_number":729,"context_line":"                    continue"},{"line_number":730,"context_line":"                self.ipconntrack.delete_conntrack_state_by_rule("},{"line_number":731,"context_line":"                    device_list, rule)"},{"line_number":732,"context_line":"            deleted_sg_ids.add(sg_id)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_47f52781","line":729,"in_reply_to":"fa32b979_3374fecd","updated":"2015-06-22 08:36:15.000000000","message":"I think you are right, I miss it","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":726,"context_line":"                    device_list.append(device)"},{"line_number":727,"context_line":"            for rule in del_rules:"},{"line_number":728,"context_line":"                if rule.get(\u0027direction\u0027) \u003d\u003d EGRESS_DIRECTION:"},{"line_number":729,"context_line":"                    continue"},{"line_number":730,"context_line":"                self.ipconntrack.delete_conntrack_state_by_rule("},{"line_number":731,"context_line":"                    device_list, rule)"},{"line_number":732,"context_line":"            deleted_sg_ids.add(sg_id)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_935dcaee","line":729,"in_reply_to":"fa32b979_76d058f8","updated":"2015-06-20 01:11:33.000000000","message":"I think there are two reasons:\n1. the iptable rule for state RELATED,ESTABLISHED are apply on ingress TAP\n2. in most cases, the default egress all","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"2931d22f65505c47778cc57ffea667715f64415a","unresolved":false,"context_lines":[{"line_number":726,"context_line":"                    device_list.append(device)"},{"line_number":727,"context_line":"            for rule in del_rules:"},{"line_number":728,"context_line":"                if rule.get(\u0027direction\u0027) \u003d\u003d EGRESS_DIRECTION:"},{"line_number":729,"context_line":"                    continue"},{"line_number":730,"context_line":"                self.ipconntrack.delete_conntrack_state_by_rule("},{"line_number":731,"context_line":"                    device_list, rule)"},{"line_number":732,"context_line":"            deleted_sg_ids.add(sg_id)"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_3374fecd","line":729,"in_reply_to":"fa32b979_935dcaee","updated":"2015-06-20 02:14:37.000000000","message":"RELATED,ESTABLISHED is also used on egress AFAIK\n\nWe should clear also egress direction when egress rules are deleted.\n\nIf we have an egress all rule those will be recreated very quickly, if we don\u0027t the traffic should stop, and it will.\n\nexample:\n\nChain neutron-openvswi-id152bdc4-0 (1 references)\ntarget     prot opt source               destination\nDROP       all  --  anywhere             anywhere             state INVALID\nRETURN     all  --  anywhere             anywhere             state RELATED,ESTABLISHED\nRETURN     udp  --  10.2.0.6             anywhere             udp spt:bootps dpt:bootpc\nRETURN     tcp  --  anywhere             anywhere             tcp multiport dports tcpmux:65535\nRETURN     udp  --  anywhere             anywhere             udp multiport dports tcpmux:65535\nRETURN     icmp --  anywhere             anywhere\nneutron-openvswi-sg-fallback  all  --  anywhere             anywhere\n\nChain neutron-openvswi-od152bdc4-0 (2 references)\ntarget     prot opt source               destination\nRETURN     udp  --  anywhere             anywhere             udp spt:bootpc dpt:bootps\nneutron-openvswi-sd152bdc4-0  all  --  anywhere             anywhere\nDROP       udp  --  anywhere             anywhere             udp spt:bootps dpt:bootpc\nDROP       all  --  anywhere             anywhere             state INVALID\nRETURN     all  --  anywhere             anywhere             state RELATED,ESTABLISHED\nRETURN     all  --  anywhere             anywhere","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"824d0ea660a923d38085bf53e03ee69c96954ea6","unresolved":false,"context_lines":[{"line_number":742,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":743,"context_line":"                continue"},{"line_number":744,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":745,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":746,"context_line":"                    sec_group_change \u003d True"},{"line_number":747,"context_line":"                    break"},{"line_number":748,"context_line":"            if not sec_group_change:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_c285e207","line":745,"updated":"2015-06-19 07:58:48.000000000","message":"I noticed several of these N*M algorithms in this change. Did you notice any performance issues if you had ~200 ports?","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9b099c33bc31b4daee57636cdca4aa4a3694c010","unresolved":false,"context_lines":[{"line_number":742,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":743,"context_line":"                continue"},{"line_number":744,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":745,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":746,"context_line":"                    sec_group_change \u003d True"},{"line_number":747,"context_line":"                    break"},{"line_number":748,"context_line":"            if not sec_group_change:"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_0578b48e","line":745,"in_reply_to":"fa32b979_c285e207","updated":"2015-06-19 08:20:07.000000000","message":"what you concerned about is important, but in most cases,the N and M is will not large, for example, in above case, ports witch change their security group in one compute node  will not large, meanwhile， one port does not belong to many security group","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"36d4556d6d7b1119247e81227f24737b64ca18e7","unresolved":false,"context_lines":[{"line_number":770,"context_line":"        for id in deleted_sg_ids:"},{"line_number":771,"context_line":"            self.updated_remote_sg_members.pop(id, None)"},{"line_number":772,"context_line":""},{"line_number":773,"context_line":"    def _remove_conntrack_entries_from_cache(self):"},{"line_number":774,"context_line":"        self._clean_deleted_sg_rule_conntrack_entries()"},{"line_number":775,"context_line":"        self._clean_updated_sg_member_conntrack_entries()"},{"line_number":776,"context_line":"        self._clean_deleted_remote_sg_members_conntrack_entries()"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_f65ea878","line":773,"updated":"2015-06-19 09:50:53.000000000","message":"nit: _from_cache -\u003e _from_sg_updates ?","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"24455966625ea1471041dce363712af260ccb389","unresolved":false,"context_lines":[{"line_number":770,"context_line":"        for id in deleted_sg_ids:"},{"line_number":771,"context_line":"            self.updated_remote_sg_members.pop(id, None)"},{"line_number":772,"context_line":""},{"line_number":773,"context_line":"    def _remove_conntrack_entries_from_cache(self):"},{"line_number":774,"context_line":"        self._clean_deleted_sg_rule_conntrack_entries()"},{"line_number":775,"context_line":"        self._clean_updated_sg_member_conntrack_entries()"},{"line_number":776,"context_line":"        self._clean_deleted_remote_sg_members_conntrack_entries()"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_535742ca","line":773,"in_reply_to":"fa32b979_f65ea878","updated":"2015-06-20 01:11:33.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f748b34dcd19fd9313492b83b4bc932b01e11524","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        self._enabled_netfilter_for_bridges \u003d False"},{"line_number":79,"context_line":"        self.updated_rule_sg_ids \u003d set()"},{"line_number":80,"context_line":"        self.updated_sg_members \u003d set()"},{"line_number":81,"context_line":"        self.updated_remote_sg_members \u003d collections.defaultdict(list)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def _enable_netfilter_for_bridges(self):"},{"line_number":84,"context_line":"        # we only need to set these values once, but it has to be when"}],"source_content_type":"text/x-python","patch_set":19,"id":"fa32b979_acbce86c","line":81,"updated":"2015-06-23 05:39:47.000000000","message":"just one last move, if you find it reasonable:\n\ndevices_with_udpated_sg_members?\ndevices_with_updated_remote_sg_members ? \n\nprobably it\u0027s too long, if you can think of a shorter name, then ok, otherwise leave as it is. It sounds a bit confusing since you keep devices, but it seems like you stored sg_members.","commit_id":"138d910e4e3821c3ef32023619140f7521c7e406"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"a532133d85d2b6f5356c766ec26b19977ef56ca9","unresolved":false,"context_lines":[{"line_number":78,"context_line":"        self._enabled_netfilter_for_bridges \u003d False"},{"line_number":79,"context_line":"        self.updated_rule_sg_ids \u003d set()"},{"line_number":80,"context_line":"        self.updated_sg_members \u003d set()"},{"line_number":81,"context_line":"        self.updated_remote_sg_members \u003d collections.defaultdict(list)"},{"line_number":82,"context_line":""},{"line_number":83,"context_line":"    def _enable_netfilter_for_bridges(self):"},{"line_number":84,"context_line":"        # we only need to set these values once, but it has to be when"}],"source_content_type":"text/x-python","patch_set":19,"id":"fa32b979_a2d06f54","line":81,"in_reply_to":"fa32b979_acbce86c","updated":"2015-06-23 06:28:06.000000000","message":"agree, thx for your good suggestion!","commit_id":"138d910e4e3821c3ef32023619140f7521c7e406"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f748b34dcd19fd9313492b83b4bc932b01e11524","unresolved":false,"context_lines":[{"line_number":711,"context_line":"            if not sg_has_members:"},{"line_number":712,"context_line":"                del self.sg_members[sg_id]"},{"line_number":713,"context_line":""},{"line_number":714,"context_line":"    def _find_deleted_sg_rules(self, sg_id):"},{"line_number":715,"context_line":"        del_rules \u003d list()"},{"line_number":716,"context_line":"        for pre_rule in self.pre_sg_rules[sg_id]:"},{"line_number":717,"context_line":"            if pre_rule not in self.sg_rules[sg_id]:"}],"source_content_type":"text/x-python","patch_set":19,"id":"fa32b979_8c7004de","line":714,"updated":"2015-06-23 05:39:47.000000000","message":"+1!","commit_id":"138d910e4e3821c3ef32023619140f7521c7e406"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f748b34dcd19fd9313492b83b4bc932b01e11524","unresolved":false,"context_lines":[{"line_number":718,"context_line":"                del_rules.append(pre_rule)"},{"line_number":719,"context_line":"        return del_rules"},{"line_number":720,"context_line":""},{"line_number":721,"context_line":"    def _find_devices_on_security_group(self, sg_id):"},{"line_number":722,"context_line":"        device_list \u003d list()"},{"line_number":723,"context_line":"        for device in self.filtered_ports.values():"},{"line_number":724,"context_line":"            if sg_id in device.get(\u0027security_groups\u0027):"}],"source_content_type":"text/x-python","patch_set":19,"id":"fa32b979_2c78d8c3","line":721,"updated":"2015-06-23 05:39:47.000000000","message":"+1!","commit_id":"138d910e4e3821c3ef32023619140f7521c7e406"},{"author":{"_account_id":9423,"name":"Roey Chen","email":"roeyc@vmware.com","username":"roeyc"},"change_message_id":"d08f7dcc3e6ac4b73a73266269ab6fe77dacc772","unresolved":false,"context_lines":[{"line_number":721,"context_line":"    def _find_devices_on_security_group(self, sg_id):"},{"line_number":722,"context_line":"        device_list \u003d list()"},{"line_number":723,"context_line":"        for device in self.filtered_ports.values():"},{"line_number":724,"context_line":"            if sg_id in device.get(\u0027security_groups\u0027):"},{"line_number":725,"context_line":"                device_list.append(device)"},{"line_number":726,"context_line":"        return device_list"},{"line_number":727,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"fa32b979_fb498161","line":724,"updated":"2015-06-26 18:52:25.000000000","message":"should be device.get(\u0027security_groups\u0027, []), otherwise you may get TypeError because None is not iterable","commit_id":"f42d3fe3bde8d408ac7818e48a6df3331b77a9d2"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"e5834495206145b7dae1a17e31ac32c0a0360042","unresolved":false,"context_lines":[{"line_number":721,"context_line":"    def _find_devices_on_security_group(self, sg_id):"},{"line_number":722,"context_line":"        device_list \u003d list()"},{"line_number":723,"context_line":"        for device in self.filtered_ports.values():"},{"line_number":724,"context_line":"            if sg_id in device.get(\u0027security_groups\u0027):"},{"line_number":725,"context_line":"                device_list.append(device)"},{"line_number":726,"context_line":"        return device_list"},{"line_number":727,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"ba3cc151_69ce3d85","line":724,"in_reply_to":"fa32b979_c124cab3","updated":"2015-06-29 02:05:39.000000000","message":"I agree!","commit_id":"f42d3fe3bde8d408ac7818e48a6df3331b77a9d2"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"e5834495206145b7dae1a17e31ac32c0a0360042","unresolved":false,"context_lines":[{"line_number":721,"context_line":"    def _find_devices_on_security_group(self, sg_id):"},{"line_number":722,"context_line":"        device_list \u003d list()"},{"line_number":723,"context_line":"        for device in self.filtered_ports.values():"},{"line_number":724,"context_line":"            if sg_id in device.get(\u0027security_groups\u0027):"},{"line_number":725,"context_line":"                device_list.append(device)"},{"line_number":726,"context_line":"        return device_list"},{"line_number":727,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"ba3cc151_e9b9eded","line":724,"in_reply_to":"fa32b979_fb498161","updated":"2015-06-29 02:05:39.000000000","message":"Done","commit_id":"f42d3fe3bde8d408ac7818e48a6df3331b77a9d2"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"4af9d7a0de5f64b04aa8759706e999592d118c77","unresolved":false,"context_lines":[{"line_number":721,"context_line":"    def _find_devices_on_security_group(self, sg_id):"},{"line_number":722,"context_line":"        device_list \u003d list()"},{"line_number":723,"context_line":"        for device in self.filtered_ports.values():"},{"line_number":724,"context_line":"            if sg_id in device.get(\u0027security_groups\u0027):"},{"line_number":725,"context_line":"                device_list.append(device)"},{"line_number":726,"context_line":"        return device_list"},{"line_number":727,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"fa32b979_c124cab3","line":724,"in_reply_to":"fa32b979_fb498161","updated":"2015-06-26 19:38:09.000000000","message":"I think that works because security_groups is always a list by definition, never None (AFAIK).\n\nBut adding [] would hurt nobody.","commit_id":"f42d3fe3bde8d408ac7818e48a6df3331b77a9d2"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"d6cf10610510981140c141e79f2b8040b58732ec","unresolved":false,"context_lines":[{"line_number":747,"context_line":"            pre_device_info \u003d self._pre_defer_filtered_ports.get(device)"},{"line_number":748,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":749,"context_line":"                continue"},{"line_number":750,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":751,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":752,"context_line":"                    sec_group_change \u003d True"},{"line_number":753,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":23,"id":"ba3cc151_1c823801","line":750,"updated":"2015-07-17 11:35:47.000000000","message":"I think comments to PS 22 apply here too","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"21132975481469e5331940c49a26dee60ad65ae9","unresolved":false,"context_lines":[{"line_number":747,"context_line":"            pre_device_info \u003d self._pre_defer_filtered_ports.get(device)"},{"line_number":748,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":749,"context_line":"                continue"},{"line_number":750,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":751,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":752,"context_line":"                    sec_group_change \u003d True"},{"line_number":753,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":23,"id":"3a50d1a3_d8ed7926","line":750,"in_reply_to":"3a50d1a3_4b8d717a","updated":"2015-07-21 11:55:02.000000000","message":"I meant comments to L724. Here you can also get TypeError if pre_device_info.get(\u0027security_groups\u0027) returns None","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"4868f8346224320b19655e9310252357170a6fd6","unresolved":false,"context_lines":[{"line_number":747,"context_line":"            pre_device_info \u003d self._pre_defer_filtered_ports.get(device)"},{"line_number":748,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":749,"context_line":"                continue"},{"line_number":750,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":751,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":752,"context_line":"                    sec_group_change \u003d True"},{"line_number":753,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":23,"id":"3a50d1a3_9bb4cbd1","line":750,"in_reply_to":"3a50d1a3_d8ed7926","updated":"2015-07-21 12:22:15.000000000","message":"sorry, I forgot this comment, I will address it in next patch!","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"c4051362aaf56546c0bcbcc40b16052dc6fb1cad","unresolved":false,"context_lines":[{"line_number":747,"context_line":"            pre_device_info \u003d self._pre_defer_filtered_ports.get(device)"},{"line_number":748,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":749,"context_line":"                continue"},{"line_number":750,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":751,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":752,"context_line":"                    sec_group_change \u003d True"},{"line_number":753,"context_line":"                    break"}],"source_content_type":"text/x-python","patch_set":23,"id":"3a50d1a3_4b8d717a","line":750,"in_reply_to":"ba3cc151_1c823801","updated":"2015-07-19 05:45:22.000000000","message":"hi Elena Ezhova, can you explain which comments?","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"},{"author":{"_account_id":7293,"name":"Elena Ezhova","email":"ezhovaelena19@gmail.com","username":"elena"},"change_message_id":"d6cf10610510981140c141e79f2b8040b58732ec","unresolved":false,"context_lines":[{"line_number":748,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":749,"context_line":"                continue"},{"line_number":750,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":751,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":752,"context_line":"                    sec_group_change \u003d True"},{"line_number":753,"context_line":"                    break"},{"line_number":754,"context_line":"            if not sec_group_change:"}],"source_content_type":"text/x-python","patch_set":23,"id":"ba3cc151_7c94a436","line":751,"updated":"2015-07-17 11:35:47.000000000","message":"ditto","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"c4051362aaf56546c0bcbcc40b16052dc6fb1cad","unresolved":false,"context_lines":[{"line_number":748,"context_line":"            if not (device_info or pre_device_info):"},{"line_number":749,"context_line":"                continue"},{"line_number":750,"context_line":"            for sg_id in pre_device_info.get(\u0027security_groups\u0027):"},{"line_number":751,"context_line":"                if sg_id not in device_info.get(\u0027security_groups\u0027):"},{"line_number":752,"context_line":"                    sec_group_change \u003d True"},{"line_number":753,"context_line":"                    break"},{"line_number":754,"context_line":"            if not sec_group_change:"}],"source_content_type":"text/x-python","patch_set":23,"id":"3a50d1a3_ebe8fd18","line":751,"in_reply_to":"ba3cc151_7c94a436","updated":"2015-07-19 05:45:22.000000000","message":"Done","commit_id":"b1157a5be89d55a56b5de02c00db35c950bc1360"}],"neutron/agent/securitygroups_rpc.py":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":251,"context_line":"    def security_groups_rule_updated(self, security_groups):"},{"line_number":252,"context_line":"        LOG.info(_LI(\"Security group rule updated %r\"),"},{"line_number":253,"context_line":"                 security_groups.keys()"},{"line_number":254,"context_line":"                 if isinstance(security_groups, dict) else security_groups)"},{"line_number":255,"context_line":"        self._security_group_updated("},{"line_number":256,"context_line":"            security_groups,"},{"line_number":257,"context_line":"            \u0027security_groups\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_a1908450","line":254,"updated":"2015-01-19 13:37:12.000000000","message":"I don\u0027t think you need to distinguish between the case of dict and list here. When security_groups is a dict, if you use the previous code it should log keys only.\nDoes it work differently?","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":251,"context_line":"    def security_groups_rule_updated(self, security_groups):"},{"line_number":252,"context_line":"        LOG.info(_LI(\"Security group rule updated %r\"),"},{"line_number":253,"context_line":"                 security_groups.keys()"},{"line_number":254,"context_line":"                 if isinstance(security_groups, dict) else security_groups)"},{"line_number":255,"context_line":"        self._security_group_updated("},{"line_number":256,"context_line":"            security_groups,"},{"line_number":257,"context_line":"            \u0027security_groups\u0027)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_fe77743a","line":254,"in_reply_to":"3a961159_a1908450","updated":"2015-01-20 04:05:40.000000000","message":"yes, it can use the previous code","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":270,"context_line":"            if sec_grp_set \u0026 set(device.get(attribute, [])):"},{"line_number":271,"context_line":"                devices.append(device[\u0027device\u0027])"},{"line_number":272,"context_line":"        if devices:"},{"line_number":273,"context_line":"            if isinstance(security_groups, dict):"},{"line_number":274,"context_line":"                for sg_rule in security_groups.values():"},{"line_number":275,"context_line":"                    if sg_rule.get(\u0027action\u0027) \u003d\u003d \u0027delete\u0027:"},{"line_number":276,"context_line":"                        self.firewall.update_defer_sg_rule("}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_41b7e0d7","line":273,"updated":"2015-01-19 13:37:12.000000000","message":"You are being quite clever in changing the RPC interface without having to alter versioning. This should also work during upgrades. I often get confused in this are so we should ask around to check whether this is ok or there can be problems.","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":270,"context_line":"            if sec_grp_set \u0026 set(device.get(attribute, [])):"},{"line_number":271,"context_line":"                devices.append(device[\u0027device\u0027])"},{"line_number":272,"context_line":"        if devices:"},{"line_number":273,"context_line":"            if isinstance(security_groups, dict):"},{"line_number":274,"context_line":"                for sg_rule in security_groups.values():"},{"line_number":275,"context_line":"                    if sg_rule.get(\u0027action\u0027) \u003d\u003d \u0027delete\u0027:"},{"line_number":276,"context_line":"                        self.firewall.update_defer_sg_rule("}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_f42153fe","line":273,"in_reply_to":"3a961159_41b7e0d7","updated":"2015-01-20 04:05:40.000000000","message":"I this this change is tiny, so it does not need change RPC interface, what do other reviewers think?","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"ac00db88315b5358db01c51dce2a43a56e22f652","unresolved":false,"context_lines":[{"line_number":283,"context_line":"    def _get_sec_grp_info(self, security_groups):"},{"line_number":284,"context_line":"        sg_id \u003d set()"},{"line_number":285,"context_line":"        sg_rules \u003d list()"},{"line_number":286,"context_line":"        if isinstance(security_groups, dict):"},{"line_number":287,"context_line":"            for sg_rule_info in security_groups.values():"},{"line_number":288,"context_line":"                rule \u003d sg_rule_info.get(\u0027rule\u0027, {})"},{"line_number":289,"context_line":"                sg_id.update([rule.get(\u0027security_group_id\u0027)])"}],"source_content_type":"text/x-python","patch_set":8,"id":"fa81d914_17af5b95","line":286,"updated":"2015-01-30 06:38:31.000000000","message":"The code that calls in here should only be passing in a dict or a list. We should make sure that  security_groups_rule_updated() only gets one or the other.","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"344f32da281e2719065b020291a1d0fc6cbb9136","unresolved":false,"context_lines":[{"line_number":283,"context_line":"    def _get_sec_grp_info(self, security_groups):"},{"line_number":284,"context_line":"        sg_id \u003d set()"},{"line_number":285,"context_line":"        sg_rules \u003d list()"},{"line_number":286,"context_line":"        if isinstance(security_groups, dict):"},{"line_number":287,"context_line":"            for sg_rule_info in security_groups.values():"},{"line_number":288,"context_line":"                rule \u003d sg_rule_info.get(\u0027rule\u0027, {})"},{"line_number":289,"context_line":"                sg_id.update([rule.get(\u0027security_group_id\u0027)])"}],"source_content_type":"text/x-python","patch_set":8,"id":"fa81d914_1a3f82d7","line":286,"in_reply_to":"fa81d914_17af5b95","updated":"2015-01-30 07:49:39.000000000","message":"thanks for your review, but both \u0027security_groups_rule_updated\u0027 and \u0027security_groups_member_updated\u0027 call \u0027_security_group_updated\u0027, and \u0027security_groups_member_updated\u0027 pass a list of security group ids, do you have other idea?","commit_id":"93d798efdb20b37e282b2e54e0e92e65babdbdc1"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":207,"context_line":"            security_groups,"},{"line_number":208,"context_line":"            \u0027security_group_source_groups\u0027)"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"    def _get_sec_grp_info(self, security_groups):"},{"line_number":211,"context_line":"        sg_id \u003d set()"},{"line_number":212,"context_line":"        sg_rules \u003d list()"},{"line_number":213,"context_line":"        if isinstance(security_groups, dict):"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_1b1b6ccb","line":210,"updated":"2015-06-18 10:18:15.000000000","message":"I\u0027d add a docstring explaining that this function is used to support both \"dict\" and non dict parameters of security_group_member_update\n\nAnd that non-dict could be deprecated later in time?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":208,"context_line":"            \u0027security_group_source_groups\u0027)"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":"    def _get_sec_grp_info(self, security_groups):"},{"line_number":211,"context_line":"        sg_id \u003d set()"},{"line_number":212,"context_line":"        sg_rules \u003d list()"},{"line_number":213,"context_line":"        if isinstance(security_groups, dict):"},{"line_number":214,"context_line":"            for sg_rule_info in security_groups.values():"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_fbf1e895","line":211,"updated":"2015-06-18 10:18:15.000000000","message":"sg_id -\u003e sg_ids ?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":209,"context_line":""},{"line_number":210,"context_line":"    def _get_sec_grp_info(self, security_groups):"},{"line_number":211,"context_line":"        sg_id \u003d set()"},{"line_number":212,"context_line":"        sg_rules \u003d list()"},{"line_number":213,"context_line":"        if isinstance(security_groups, dict):"},{"line_number":214,"context_line":"            for sg_rule_info in security_groups.values():"},{"line_number":215,"context_line":"                rule \u003d sg_rule_info.get(\u0027rule\u0027, {})"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_36176549","line":212,"updated":"2015-06-18 10:18:15.000000000","message":"sg_rules -\u003e sg_rules_to_delete ?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":222,"context_line":""},{"line_number":223,"context_line":"    def _security_group_updated(self, security_groups, attribute):"},{"line_number":224,"context_line":"        devices \u003d []"},{"line_number":225,"context_line":"        sec_grp_set, sg_rules \u003d self._get_sec_grp_info(security_groups)"},{"line_number":226,"context_line":"        for device in self.firewall.ports.values():"},{"line_number":227,"context_line":"            if sec_grp_set \u0026 set(device.get(attribute, [])):"},{"line_number":228,"context_line":"                devices.append(device[\u0027device\u0027])"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_b629358c","line":225,"updated":"2015-06-18 10:18:15.000000000","message":"sg_rules \u003d sg_rules_to_delete","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"c9c7eb4278bf0b959235bf3f0ef88936d1a861d9","unresolved":false,"context_lines":[{"line_number":228,"context_line":"                devices.append(device[\u0027device\u0027])"},{"line_number":229,"context_line":"        if devices:"},{"line_number":230,"context_line":"            for sg_rule in sg_rules:"},{"line_number":231,"context_line":"                self.firewall.update_defer_sg_rule(devices, sg_rule)"},{"line_number":232,"context_line":"            for sg in sec_grp_set:"},{"line_number":233,"context_line":"                self.firewall.update_defer_sg(sg)"},{"line_number":234,"context_line":"            if self.defer_refresh_firewall:"}],"source_content_type":"text/x-python","patch_set":16,"id":"fa32b979_5639c9d5","line":231,"updated":"2015-06-18 10:18:15.000000000","message":"update_defer_sg_rule \u003d\u003e delete_defer_sg_rule ?","commit_id":"95f4006b4e2e636bba123d74023e841015069cf4"}],"neutron/db/securitygroups_rpc_base.py":[{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"9707f6ed404391bdc00c4fc7cf15641a73dfb1b2","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        for rule in rules:"},{"line_number":97,"context_line":"            security_groups.setdefault(rule[\u0027security_group_id\u0027], {})"},{"line_number":98,"context_line":"            security_groups[rule[\u0027security_group_id\u0027]][\u0027action\u0027] \u003d action"},{"line_number":99,"context_line":"            security_groups[rule[\u0027security_group_id\u0027]][\u0027rule\u0027] \u003d rule"},{"line_number":100,"context_line":"        return security_groups"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    def update_security_group_on_port(self, context, id, port,"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_21273420","line":99,"updated":"2015-01-19 13:37:12.000000000","message":"This looks a bit strange - or at least there is something I do not understand.\n\nIt seems like you\u0027re mapping either CREATE or DELETE action to a single rule in the security groups. If there are more than one rule then only the last one in the iteration is considered, as the previous is overwritten. Is that intentional?","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"299022014772cf76f251bcfc46f0696d2e835000","unresolved":false,"context_lines":[{"line_number":96,"context_line":"        for rule in rules:"},{"line_number":97,"context_line":"            security_groups.setdefault(rule[\u0027security_group_id\u0027], {})"},{"line_number":98,"context_line":"            security_groups[rule[\u0027security_group_id\u0027]][\u0027action\u0027] \u003d action"},{"line_number":99,"context_line":"            security_groups[rule[\u0027security_group_id\u0027]][\u0027rule\u0027] \u003d rule"},{"line_number":100,"context_line":"        return security_groups"},{"line_number":101,"context_line":""},{"line_number":102,"context_line":"    def update_security_group_on_port(self, context, id, port,"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_5989826e","line":99,"in_reply_to":"3a961159_21273420","updated":"2015-01-20 04:05:40.000000000","message":"it just need DELETE action, in order to keep consistent, I do that for CREATE, but I agree with you, it can use rule id for the key","commit_id":"a342b5db4f9c18b2c15c8a6da24449e1543ab55d"}],"neutron/tests/unit/agent/linux/test_iptables_firewall.py":[{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"824d0ea660a923d38085bf53e03ee69c96954ea6","unresolved":false,"context_lines":[{"line_number":1083,"context_line":"                 \u0027-d\u0027, \u002710.0.0.1\u0027, \u0027-w\u0027, 1],"},{"line_number":1084,"context_line":"                run_as_root\u003dTrue, check_exit_code\u003dTrue, extra_ok_codes\u003d[1])]"},{"line_number":1085,"context_line":"        self.utils_exec.assert_has_calls(calls)"},{"line_number":1086,"context_line":""},{"line_number":1087,"context_line":"    def test_update_port_filter_delete_rule_ipv6(self):"},{"line_number":1088,"context_line":"        port \u003d self._fake_port()"},{"line_number":1089,"context_line":"        port[\u0027zone_id\u0027] \u003d 1"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_627bb62a","line":1086,"updated":"2015-06-19 07:58:48.000000000","message":"after you do the small refactor i suggested above to separate out the command generation, add some tests to just generate commands when given specific inputs to exercise all of the branches.","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8976,"name":"shihanzhang","email":"ayshihanzhang@gmail.com","username":"shihanzhang"},"change_message_id":"9b099c33bc31b4daee57636cdca4aa4a3694c010","unresolved":false,"context_lines":[{"line_number":1083,"context_line":"                 \u0027-d\u0027, \u002710.0.0.1\u0027, \u0027-w\u0027, 1],"},{"line_number":1084,"context_line":"                run_as_root\u003dTrue, check_exit_code\u003dTrue, extra_ok_codes\u003d[1])]"},{"line_number":1085,"context_line":"        self.utils_exec.assert_has_calls(calls)"},{"line_number":1086,"context_line":""},{"line_number":1087,"context_line":"    def test_update_port_filter_delete_rule_ipv6(self):"},{"line_number":1088,"context_line":"        port \u003d self._fake_port()"},{"line_number":1089,"context_line":"        port[\u0027zone_id\u0027] \u003d 1"}],"source_content_type":"text/x-python","patch_set":18,"id":"fa32b979_455ebc13","line":1086,"in_reply_to":"fa32b979_627bb62a","updated":"2015-06-19 08:20:07.000000000","message":"agree","commit_id":"6f78c95855ccbb76ce2f63f72f3720dc9231b977"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f748b34dcd19fd9313492b83b4bc932b01e11524","unresolved":false,"context_lines":[{"line_number":1083,"context_line":"                 \u0027-d\u0027, \u002710.0.0.1\u0027, \u0027-w\u0027, 1],"},{"line_number":1084,"context_line":"                run_as_root\u003dTrue, check_exit_code\u003dTrue, extra_ok_codes\u003d[1])]"},{"line_number":1085,"context_line":"        self.utils_exec.assert_has_calls(calls)"},{"line_number":1086,"context_line":""},{"line_number":1087,"context_line":"    def test_update_port_filter_delete_rule_ipv6(self):"},{"line_number":1088,"context_line":"        port \u003d self._fake_port()"},{"line_number":1089,"context_line":"        port[\u0027zone_id\u0027] \u003d 1"}],"source_content_type":"text/x-python","patch_set":19,"id":"fa32b979_4c5afc51","line":1086,"updated":"2015-06-23 05:39:47.000000000","message":"You missed kevin\u0027s comment on PS18","commit_id":"138d910e4e3821c3ef32023619140f7521c7e406"}]}
