)]}'
{"quantum/common/exceptions.py":[{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"unresolved":false,"context_lines":[{"line_number":43,"context_line":""},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"class Conflict(QuantumException):"},{"line_number":46,"context_line":"    pass"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"class NotAuthorized(QuantumException):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAMX%2F%2F%2F3Q%3D","line":46,"updated":"2012-12-03 00:32:10.000000000","message":"Is it used?","commit_id":"0c0e1fe7ef2fd52772a470e408f69a821545b03f"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"unresolved":false,"context_lines":[{"line_number":43,"context_line":""},{"line_number":44,"context_line":""},{"line_number":45,"context_line":"class Conflict(QuantumException):"},{"line_number":46,"context_line":"    pass"},{"line_number":47,"context_line":""},{"line_number":48,"context_line":""},{"line_number":49,"context_line":"class NotAuthorized(QuantumException):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAMX%2F%2F%2F28%3D","line":46,"in_reply_to":"AAAAMX%2F%2F%2F3Q%3D","updated":"2012-12-03 00:51:43.000000000","message":"It is used in SubnetMismatchForPort below.\nThe reason I created this class is to make exception mapping in api/v2/base.py simple. I think exceptions translated into HTTPConflict in api/v2/base.py like InvalidSharedSetting or OverlappingAllocationPools can inherit this class.","commit_id":"0c0e1fe7ef2fd52772a470e408f69a821545b03f"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"unresolved":false,"context_lines":[{"line_number":160,"context_line":"                \"already plugged into port %(att_port_id)s\")"},{"line_number":161,"context_line":""},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"class SubnetMismatchForPort(Conflict):"},{"line_number":164,"context_line":"    message \u003d _(\"Subnet on port %(port_id)s does not match \""},{"line_number":165,"context_line":"                \"the requested subnet %(subnet_id)s\")"},{"line_number":166,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAMX%2F%2F%2F24%3D","line":163,"updated":"2012-12-03 00:51:43.000000000","message":"This exception is only used in l3_db.py, but I feel the error is not limited to l3_db, so I added this to this module.","commit_id":"0c0e1fe7ef2fd52772a470e408f69a821545b03f"}],"quantum/db/l3_db.py":[{"author":{"_account_id":2649,"name":"Zhang Hua","email":"zhuadl@cn.ibm.com","username":"zhang-hare"},"change_message_id":"4a2d0f607564fd4d7223bf3c4e9e400079391f34","unresolved":false,"context_lines":[{"line_number":345,"context_line":"            raise l3.RouterNotFound(router_id\u003drouter_id)"},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"        if not interface_info:"},{"line_number":348,"context_line":"            msg \u003d \"Either subnet_id or port_id must be specified\""},{"line_number":349,"context_line":"            raise q_exc.BadRequest(resource\u003d\u0027router\u0027, msg\u003dmsg)"},{"line_number":350,"context_line":"        if \u0027port_id\u0027 in interface_info:"},{"line_number":351,"context_line":"            port_id \u003d interface_info[\u0027port_id\u0027]"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2Fxc8%3D","line":348,"updated":"2012-11-07 08:13:13.000000000","message":"we should use _ function for i18n message.","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":350,"context_line":"        if \u0027port_id\u0027 in interface_info:"},{"line_number":351,"context_line":"            port_id \u003d interface_info[\u0027port_id\u0027]"},{"line_number":352,"context_line":"            port_db \u003d self._get_port(context, port_id)"},{"line_number":353,"context_line":"            if not (port_db[\u0027device_owner\u0027] \u003d\u003d DEVICE_OWNER_ROUTER_INTF and"},{"line_number":354,"context_line":"                    port_db[\u0027device_id\u0027] \u003d\u003d router_id):"},{"line_number":355,"context_line":"                raise w_exc.HTTPNotFound(\"Router %(router_id)s does not have \""},{"line_number":356,"context_line":"                                         \" an interface with id %(port_id)s\""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2Fy%2B8%3D","line":353,"updated":"2012-11-06 01:36:30.000000000","message":"I think this if-else should first check,\n\n if port_db[\u0027device_id\u0027] \u003d\u003d router_id:\n     if port_db[\u0027device_owner\u0027] \u003d\u003d DEVICE_OWNER_ROUTER_INTF:\n         raise HTTPNotFound\n else:\n     raise HTTPConflict\n if \u0027subnet_id\u0027 in interface_info:\n     ...","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":350,"context_line":"        if \u0027port_id\u0027 in interface_info:"},{"line_number":351,"context_line":"            port_id \u003d interface_info[\u0027port_id\u0027]"},{"line_number":352,"context_line":"            port_db \u003d self._get_port(context, port_id)"},{"line_number":353,"context_line":"            if not (port_db[\u0027device_owner\u0027] \u003d\u003d DEVICE_OWNER_ROUTER_INTF and"},{"line_number":354,"context_line":"                    port_db[\u0027device_id\u0027] \u003d\u003d router_id):"},{"line_number":355,"context_line":"                raise w_exc.HTTPNotFound(\"Router %(router_id)s does not have \""},{"line_number":356,"context_line":"                                         \" an interface with id %(port_id)s\""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2Fyu4%3D","line":353,"in_reply_to":"AAAALn%2F%2Fy%2B8%3D","updated":"2012-11-06 07:45:48.000000000","message":"Oh, I didn\u0027t see the \u0027not\u0027 next to \u0027if\u0027","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":1994,"name":"Zhongyue Luo","email":"zhongyue.luo@gmail.com","username":"zyluo"},"unresolved":false,"context_lines":[{"line_number":350,"context_line":"        if \u0027port_id\u0027 in interface_info:"},{"line_number":351,"context_line":"            port_id \u003d interface_info[\u0027port_id\u0027]"},{"line_number":352,"context_line":"            port_db \u003d self._get_port(context, port_id)"},{"line_number":353,"context_line":"            if not (port_db[\u0027device_owner\u0027] \u003d\u003d DEVICE_OWNER_ROUTER_INTF and"},{"line_number":354,"context_line":"                    port_db[\u0027device_id\u0027] \u003d\u003d router_id):"},{"line_number":355,"context_line":"                raise w_exc.HTTPNotFound(\"Router %(router_id)s does not have \""},{"line_number":356,"context_line":"                                         \" an interface with id %(port_id)s\""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2FxsY%3D","line":353,"in_reply_to":"AAAALn%2F%2Fyu4%3D","updated":"2012-11-07 01:54:40.000000000","message":"Maybe this way you can preserve the original logic without comparing port_db[\u0027device_id\u0027] with router_id twice:\n\nif port_db[\u0027device_id\u0027] !\u003d router_id:\n     if port_db[\u0027device_owner\u0027] !\u003d DEVICE_OWNER_ROUTER_INTF:\n         raise w_exc.HTTPNotFound(\"Router %(router_id)s does not \"\n                                  \"have an interface \"\n                                  \"with id %(port_id)s\" % locals())\n     else:\n         raise w_exc.HTTPConflict(\"port_id %s not used by router\" %\n                                  port_db[\u0027id\u0027])","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"38d9da35e83cb83171a94c6e0889e06235f7b97f","unresolved":false,"context_lines":[{"line_number":352,"context_line":"            port_db \u003d self._get_port(context, port_id)"},{"line_number":353,"context_line":"            if not (port_db[\u0027device_owner\u0027] \u003d\u003d DEVICE_OWNER_ROUTER_INTF and"},{"line_number":354,"context_line":"                    port_db[\u0027device_id\u0027] \u003d\u003d router_id):"},{"line_number":355,"context_line":"                raise w_exc.HTTPNotFound(\"Router %(router_id)s does not have \""},{"line_number":356,"context_line":"                                         \" an interface with id %(port_id)s\""},{"line_number":357,"context_line":"                                         % locals())"},{"line_number":358,"context_line":"            if \u0027subnet_id\u0027 in interface_info:"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2FzuU%3D","line":355,"updated":"2012-11-05 16:16:41.000000000","message":"The two checks raise different exceptions.  What should be correct one?  I\u0027m not sure that HTTPNotFound is correct . Conflict might make more sense.  Salvatore?","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":2649,"name":"Zhang Hua","email":"zhuadl@cn.ibm.com","username":"zhang-hare"},"change_message_id":"4a2d0f607564fd4d7223bf3c4e9e400079391f34","unresolved":false,"context_lines":[{"line_number":352,"context_line":"            port_db \u003d self._get_port(context, port_id)"},{"line_number":353,"context_line":"            if not (port_db[\u0027device_owner\u0027] \u003d\u003d DEVICE_OWNER_ROUTER_INTF and"},{"line_number":354,"context_line":"                    port_db[\u0027device_id\u0027] \u003d\u003d router_id):"},{"line_number":355,"context_line":"                raise w_exc.HTTPNotFound(\"Router %(router_id)s does not have \""},{"line_number":356,"context_line":"                                         \" an interface with id %(port_id)s\""},{"line_number":357,"context_line":"                                         % locals())"},{"line_number":358,"context_line":"            if \u0027subnet_id\u0027 in interface_info:"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2Fxc4%3D","line":355,"updated":"2012-11-07 08:13:13.000000000","message":"we should use _ function for i18n message.","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"unresolved":false,"context_lines":[{"line_number":352,"context_line":"            port_db \u003d self._get_port(context, port_id)"},{"line_number":353,"context_line":"            if not (port_db[\u0027device_owner\u0027] \u003d\u003d DEVICE_OWNER_ROUTER_INTF and"},{"line_number":354,"context_line":"                    port_db[\u0027device_id\u0027] \u003d\u003d router_id):"},{"line_number":355,"context_line":"                raise w_exc.HTTPNotFound(\"Router %(router_id)s does not have \""},{"line_number":356,"context_line":"                                         \" an interface with id %(port_id)s\""},{"line_number":357,"context_line":"                                         % locals())"},{"line_number":358,"context_line":"            if \u0027subnet_id\u0027 in interface_info:"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2FyvQ%3D","line":355,"in_reply_to":"AAAALn%2F%2FzuU%3D","updated":"2012-11-06 07:32:30.000000000","message":"It depends on API design decision which should be returned.\n\nThere is a conflict between the request and the existing resource. When I wrote the patch, I thought HTTPConflict should be returned in case there is a conflict between requested parameters.","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":2649,"name":"Zhang Hua","email":"zhuadl@cn.ibm.com","username":"zhang-hare"},"change_message_id":"4a2d0f607564fd4d7223bf3c4e9e400079391f34","unresolved":false,"context_lines":[{"line_number":358,"context_line":"            if \u0027subnet_id\u0027 in interface_info:"},{"line_number":359,"context_line":"                port_subnet_id \u003d port_db[\u0027fixed_ips\u0027][0][\u0027subnet_id\u0027]"},{"line_number":360,"context_line":"                if port_subnet_id !\u003d interface_info[\u0027subnet_id\u0027]:"},{"line_number":361,"context_line":"                    raise w_exc.HTTPConflict(\"subnet_id %s on port does not \""},{"line_number":362,"context_line":"                                             \"match requested one (%s)\""},{"line_number":363,"context_line":"                                             % (port_subnet_id,"},{"line_number":364,"context_line":"                                                interface_info[\u0027subnet_id\u0027]))"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAALn%2F%2FxdA%3D","line":361,"updated":"2012-11-07 08:13:13.000000000","message":"we should use _ function for i18n message.","commit_id":"1e3aaa012c9af8a59a4369e06509e70c9e38f79d"},{"author":{"_account_id":447,"name":"dan wendlandt","email":"dan@nicira.com","username":"danwent"},"unresolved":false,"context_lines":[{"line_number":369,"context_line":"                                                interface_info[\u0027subnet_id\u0027]))"},{"line_number":370,"context_line":"            if port_db[\u0027device_id\u0027] !\u003d router_id:"},{"line_number":371,"context_line":"                raise w_exc.HTTPConflict(\"port_id %s not used by router\" %"},{"line_number":372,"context_line":"                                         port_db[\u0027id\u0027])"},{"line_number":373,"context_line":"            self.delete_port(context, port_db[\u0027id\u0027], l3_port_check\u003dFalse)"},{"line_number":374,"context_line":"        elif \u0027subnet_id\u0027 in interface_info:"},{"line_number":375,"context_line":"            subnet_id \u003d interface_info[\u0027subnet_id\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAMH%2F%2F7IU%3D","side":"PARENT","line":372,"updated":"2012-11-15 17:47:54.000000000","message":"yes, this check is duplicate and can be removed.","commit_id":"6830ff4d946af39f39cfdaf4c94db1d344ffc80c"},{"author":{"_account_id":5754,"name":"Alex Xu","email":"hejie.xu@intel.com","username":"xuhj"},"change_message_id":"85004fd3407a5d41b381f56f5629ed7c71a6bfe1","unresolved":false,"context_lines":[{"line_number":358,"context_line":"                                         \"an interface with id %(port_id)s\""},{"line_number":359,"context_line":"                                         % locals())"},{"line_number":360,"context_line":"            elif port_db[\u0027device_owner\u0027] !\u003d DEVICE_OWNER_ROUTER_INTF:"},{"line_number":361,"context_line":"                raise w_exc.HTTPConflict(\"The specified port %(port_id)s is \""},{"line_number":362,"context_line":"                                         \"not a valid interface of router \""},{"line_number":363,"context_line":"                                         \"%(router_id)s\""},{"line_number":364,"context_line":"                                         % locals())"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAMH%2F%2FyD8%3D","line":361,"updated":"2012-11-25 09:23:52.000000000","message":"Why we don\u0027t use or define one of exceptions in quantum.common.exceptions.py?","commit_id":"a289eed2d09d33b96af3759444d298e659fce9d0"},{"author":{"_account_id":447,"name":"dan wendlandt","email":"dan@nicira.com","username":"danwent"},"unresolved":false,"context_lines":[{"line_number":360,"context_line":"            elif port_db[\u0027device_owner\u0027] !\u003d DEVICE_OWNER_ROUTER_INTF:"},{"line_number":361,"context_line":"                raise w_exc.HTTPConflict(\"The specified port %(port_id)s is \""},{"line_number":362,"context_line":"                                         \"not a valid interface of router \""},{"line_number":363,"context_line":"                                         \"%(router_id)s\""},{"line_number":364,"context_line":"                                         % locals())"},{"line_number":365,"context_line":"            if \u0027subnet_id\u0027 in interface_info:"},{"line_number":366,"context_line":"                port_subnet_id \u003d port_db[\u0027fixed_ips\u0027][0][\u0027subnet_id\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAMH%2F%2F7IY%3D","line":363,"updated":"2012-11-15 17:47:54.000000000","message":"Can you explain the rational for splitting this into two checks with essentially the same error message, but different codes?  This is not really a standard use an HTTPConflict error in my opinion (usually 409 is used to indicate that a UUID specified already \"in use\").","commit_id":"a289eed2d09d33b96af3759444d298e659fce9d0"},{"author":{"_account_id":447,"name":"dan wendlandt","email":"dan@nicira.com","username":"danwent"},"unresolved":false,"context_lines":[{"line_number":360,"context_line":"            elif port_db[\u0027device_owner\u0027] !\u003d DEVICE_OWNER_ROUTER_INTF:"},{"line_number":361,"context_line":"                raise w_exc.HTTPConflict(\"The specified port %(port_id)s is \""},{"line_number":362,"context_line":"                                         \"not a valid interface of router \""},{"line_number":363,"context_line":"                                         \"%(router_id)s\""},{"line_number":364,"context_line":"                                         % locals())"},{"line_number":365,"context_line":"            if \u0027subnet_id\u0027 in interface_info:"},{"line_number":366,"context_line":"                port_subnet_id \u003d port_db[\u0027fixed_ips\u0027][0][\u0027subnet_id\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAMH%2F%2FrgM%3D","line":363,"in_reply_to":"AAAAMH%2F%2F508%3D","updated":"2012-11-30 20:21:50.000000000","message":"yes, to me a 404 in both cases (as happened in the old version of the code) would be appropriate.","commit_id":"a289eed2d09d33b96af3759444d298e659fce9d0"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"unresolved":false,"context_lines":[{"line_number":360,"context_line":"            elif port_db[\u0027device_owner\u0027] !\u003d DEVICE_OWNER_ROUTER_INTF:"},{"line_number":361,"context_line":"                raise w_exc.HTTPConflict(\"The specified port %(port_id)s is \""},{"line_number":362,"context_line":"                                         \"not a valid interface of router \""},{"line_number":363,"context_line":"                                         \"%(router_id)s\""},{"line_number":364,"context_line":"                                         % locals())"},{"line_number":365,"context_line":"            if \u0027subnet_id\u0027 in interface_info:"},{"line_number":366,"context_line":"                port_subnet_id \u003d port_db[\u0027fixed_ips\u0027][0][\u0027subnet_id\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAMH%2F%2F508%3D","line":363,"in_reply_to":"AAAAMH%2F%2F7IY%3D","updated":"2012-11-16 08:36:37.000000000","message":"To be honest, I do not have a generic criteria which should be used 404 or 409 for such case.\n\nIn the former case the router cannot see the specified port and in the latter case the router can see the port but it is not a router interface. When I wrote the patch I think the latter is a conflict.\n\nTo know a better answer I reviewed RFC2616 HTTP/1.1 and it says in 409 Conflict section that \"The request could not be completed due to a conflict with the current state of the resource. This code  is only allowed in situations where it is expected that the user might be able to resolve the conflict and resubmit the request.\"\nAccording to it, there is no way to resolve the situation in this case, so 404 looks  suitable. How do you think?","commit_id":"a289eed2d09d33b96af3759444d298e659fce9d0"}]}
