)]}'
{"neutron/db/ipam_backend_mixin.py":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"320c41550df929a228d064a7d8b27268bf4d5108","unresolved":false,"context_lines":[{"line_number":392,"context_line":"                        return subnet"},{"line_number":393,"context_line":"            subnet \u003d get_matching_subnet()"},{"line_number":394,"context_line":"            if not subnet:"},{"line_number":395,"context_line":"                self._get_subnet_object(context, fixed[\u0027subnet_id\u0027])"},{"line_number":396,"context_line":"                msg \u003d (_(\"Failed to create port on network %(network_id)s\""},{"line_number":397,"context_line":"                         \", because fixed_ips included invalid subnet \""},{"line_number":398,"context_line":"                         \"%(subnet_id)s\") %"}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_ed8788b4","line":395,"range":{"start_line":395,"start_character":16,"end_line":395,"end_character":68},"updated":"2019-09-24 22:31:27.000000000","message":"So, why still call this function without any use?","commit_id":"c275cc06d7c86d3a5e8842f977eed51552e51e86"},{"author":{"_account_id":18480,"name":"zhengy","email":"zhengy23@163.com","username":"zhengyong"},"change_message_id":"4786087ce0c9b7f040501f6d7932ff966795d964","unresolved":false,"context_lines":[{"line_number":392,"context_line":"                        return subnet"},{"line_number":393,"context_line":"            subnet \u003d get_matching_subnet()"},{"line_number":394,"context_line":"            if not subnet:"},{"line_number":395,"context_line":"                self._get_subnet_object(context, fixed[\u0027subnet_id\u0027])"},{"line_number":396,"context_line":"                msg \u003d (_(\"Failed to create port on network %(network_id)s\""},{"line_number":397,"context_line":"                         \", because fixed_ips included invalid subnet \""},{"line_number":398,"context_line":"                         \"%(subnet_id)s\") %"}],"source_content_type":"text/x-python","patch_set":4,"id":"3fa7e38b_f0875bb4","line":395,"range":{"start_line":395,"start_character":16,"end_line":395,"end_character":68},"in_reply_to":"3fa7e38b_ed8788b4","updated":"2019-09-25 00:47:50.000000000","message":"just as the following two test cases do,  this function can tell us the not found subnets, maybe I should delete it, I\u0027m not sure\n\nCase 1:\nFile \"/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/unit/db/test_db_base_plugin_v2.py\", line 2469, in test_requested_invalid_fixed_ips\nself.assertEqual(webob.exc.HTTPNotFound.code, res.status_int)\n\nCase 2:\nFile \"/home/zuul/src/opendev.org/openstack/neutron/neutron/tests/unit/plugins/ml2/test_plugin.py\", line 723, in test_port_update_subnetnotfound\nself.assertEqual(204, res.status_int)","commit_id":"c275cc06d7c86d3a5e8842f977eed51552e51e86"}],"neutron/tests/unit/plugins/ml2/test_plugin.py":[{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"d60b955479e9dc39d69aabfb1d80fac76028047d","unresolved":false,"context_lines":[{"line_number":720,"context_line":"                    req \u003d self.new_delete_request(\u0027subnets\u0027,"},{"line_number":721,"context_line":"                                                  s1[\u0027subnet\u0027][\u0027id\u0027])"},{"line_number":722,"context_line":"                    res \u003d req.get_response(self.api)"},{"line_number":723,"context_line":"                    self.assertEqual(webob.exc.HTTPBadRequest.code,"},{"line_number":724,"context_line":"                                     res.status_int)"},{"line_number":725,"context_line":"                    # ensure port has IP on s1 and s3"},{"line_number":726,"context_line":"                    port \u003d self._show(\u0027ports\u0027, p[\u0027port\u0027][\u0027id\u0027])[\u0027port\u0027]"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_7d94698b","line":723,"updated":"2019-10-15 07:18:39.000000000","message":"I don\u0027t understand exactly. Why this response was changed?","commit_id":"f06200f6c5f80067fd816589e6d8fbd3f9ecbeb0"},{"author":{"_account_id":18480,"name":"zhengy","email":"zhengy23@163.com","username":"zhengyong"},"change_message_id":"f08a0f87edce86794563c31a8179b4da75cdd996","unresolved":false,"context_lines":[{"line_number":720,"context_line":"                    req \u003d self.new_delete_request(\u0027subnets\u0027,"},{"line_number":721,"context_line":"                                                  s1[\u0027subnet\u0027][\u0027id\u0027])"},{"line_number":722,"context_line":"                    res \u003d req.get_response(self.api)"},{"line_number":723,"context_line":"                    self.assertEqual(webob.exc.HTTPBadRequest.code,"},{"line_number":724,"context_line":"                                     res.status_int)"},{"line_number":725,"context_line":"                    # ensure port has IP on s1 and s3"},{"line_number":726,"context_line":"                    port \u003d self._show(\u0027ports\u0027, p[\u0027port\u0027][\u0027id\u0027])[\u0027port\u0027]"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_cf77833b","line":723,"in_reply_to":"3fa7e38b_4f8cf334","updated":"2019-11-11 02:50:59.000000000","message":"maybe because I delete param context of _test_fixed_ips_for_port, but did not remove places used this function","commit_id":"f06200f6c5f80067fd816589e6d8fbd3f9ecbeb0"},{"author":{"_account_id":18480,"name":"zhengy","email":"zhengy23@163.com","username":"zhengyong"},"change_message_id":"51cc1271a9c9c00126508e1412fa598e8670174e","unresolved":false,"context_lines":[{"line_number":720,"context_line":"                    req \u003d self.new_delete_request(\u0027subnets\u0027,"},{"line_number":721,"context_line":"                                                  s1[\u0027subnet\u0027][\u0027id\u0027])"},{"line_number":722,"context_line":"                    res \u003d req.get_response(self.api)"},{"line_number":723,"context_line":"                    self.assertEqual(webob.exc.HTTPBadRequest.code,"},{"line_number":724,"context_line":"                                     res.status_int)"},{"line_number":725,"context_line":"                    # ensure port has IP on s1 and s3"},{"line_number":726,"context_line":"                    port \u003d self._show(\u0027ports\u0027, p[\u0027port\u0027][\u0027id\u0027])[\u0027port\u0027]"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_4f8cf334","line":723,"in_reply_to":"3fa7e38b_7d94698b","updated":"2019-11-11 02:46:12.000000000","message":"I am also confused","commit_id":"f06200f6c5f80067fd816589e6d8fbd3f9ecbeb0"},{"author":{"_account_id":18480,"name":"zhengy","email":"zhengy23@163.com","username":"zhengyong"},"change_message_id":"c52e09c2fc9f71f08f8662462b1f6990fb64b890","unresolved":false,"context_lines":[{"line_number":720,"context_line":"                    req \u003d self.new_delete_request(\u0027subnets\u0027,"},{"line_number":721,"context_line":"                                                  s1[\u0027subnet\u0027][\u0027id\u0027])"},{"line_number":722,"context_line":"                    res \u003d req.get_response(self.api)"},{"line_number":723,"context_line":"                    self.assertEqual(webob.exc.HTTPBadRequest.code,"},{"line_number":724,"context_line":"                                     res.status_int)"},{"line_number":725,"context_line":"                    # ensure port has IP on s1 and s3"},{"line_number":726,"context_line":"                    port \u003d self._show(\u0027ports\u0027, p[\u0027port\u0027][\u0027id\u0027])[\u0027port\u0027]"}],"source_content_type":"text/x-python","patch_set":8,"id":"3fa7e38b_6fcc45bb","line":723,"in_reply_to":"3fa7e38b_cf77833b","updated":"2019-11-11 22:59:38.000000000","message":"def _get_subnet_for_fixed_ip(self, context, fixed, subnets):\n        # Subnets are all the subnets belonging to the same network.\n        if not subnets:\n            msg \u003d _(\u0027IP allocation requires subnets for network\u0027)\n            raise exc.InvalidInput(error_message\u003dmsg)\n\n        if \u0027subnet_id\u0027 in fixed:\n            def get_matching_subnet():\n                for subnet in subnets:\n                    if subnet[\u0027id\u0027] \u003d\u003d fixed[\u0027subnet_id\u0027]:\n                        return subnet\n            subnet \u003d get_matching_subnet()\n            if not subnet:\n                subnet \u003d self._get_subnet(context, fixed[\u0027subnet_id\u0027])\n                msg \u003d (_(\"Failed to create port on network %(network_id)s\"\n                         \", because fixed_ips included invalid subnet \"\n                         \"%(subnet_id)s\") %\n                       {\u0027network_id\u0027: subnet[\u0027network_id\u0027],\n                        \u0027subnet_id\u0027: fixed[\u0027subnet_id\u0027]})\n                raise exc.InvalidInput(error_message\u003dmsg)\n\n    def _get_subnet(self, context, id):\n        try:\n            subnet \u003d model_query.get_by_id(context, models_v2.Subnet, id)\n        except exc.NoResultFound:\n            raise n_exc.SubnetNotFound(subnet_id\u003did)\n        return subnet\n\n------------\ndebug code, I found that after delete subnet s2,  in function _get_subnet_for_fixed_ip, param fixed is s2, but s2 is not in param subnets,  here no matching subnet is found, so it will run \"if not subnet\".\nwith call of self._get_subnet, it will raise n_exc.SubnetNotFound(subnet_id\u003did), lead response status code to 204. without this function it will raise \nraise exc.InvalidInput(error_message\u003dmsg),  lead response status code to 400.","commit_id":"f06200f6c5f80067fd816589e6d8fbd3f9ecbeb0"}]}
