)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"7c4ee8f0d325a2aed42d53c45338ac7900439a79","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     liyingjun \u003cyingjun.li@kylin-cloud.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-01-29 09:23:13 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Improve \u0027attach interface\u0027"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Raise HTTPBadRequest exception when trying to attach a port with"},{"line_number":10,"context_line":"different tenant_id to an instance."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"da86d52c_eae5e80a","line":7,"updated":"2015-02-08 19:16:13.000000000","message":"This title is a little misleading. Please consider:\nImprove \u0027attach interface\u0027 exception handling","commit_id":"69f5a283f54c118821df3457a46c055ee5873854"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"192ed6d7630a7ff9fd17b18815e8e6a68e2e3bbe","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     liyingjun \u003cyingjun.li@kylin-cloud.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2015-01-29 09:23:13 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Improve \u0027attach interface\u0027"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Raise HTTPBadRequest exception when trying to attach a port with"},{"line_number":10,"context_line":"different tenant_id to an instance."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":7,"id":"da86d52c_257652d9","line":7,"in_reply_to":"da86d52c_eae5e80a","updated":"2015-02-09 01:03:56.000000000","message":"Done","commit_id":"69f5a283f54c118821df3457a46c055ee5873854"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"fa637b8c604781650e3e218dcf38a5121d2cbeda","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Improve \u0027attach interface\u0027 exception handling"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Raise HTTPBadRequest exception when trying to attach a port with"},{"line_number":10,"context_line":"different tenant_id to an instance."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I4a4017407ac7358490974cbffc5b7dbb7a200f44"},{"line_number":13,"context_line":"Closes-bug: #1409617"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"da86d52c_bc6219d6","line":10,"updated":"2015-02-10 09:57:34.000000000","message":"should be exception.Forbidden or exc.HTTPConflict much more accurate?","commit_id":"bc844f8af4166a8961a7eb4e1c24d07f4159c67a"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"86ec1f61faf0d2f8d023078c6e793afb15afccfc","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Improve \u0027attach interface\u0027 exception handling"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Raise HTTPBadRequest exception when trying to attach a port with"},{"line_number":10,"context_line":"different tenant_id to an instance."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I4a4017407ac7358490974cbffc5b7dbb7a200f44"},{"line_number":13,"context_line":"Closes-bug: #1409617"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"da86d52c_caf7f657","line":10,"in_reply_to":"da86d52c_bc6219d6","updated":"2015-02-10 13:21:58.000000000","message":"make sense, Done","commit_id":"bc844f8af4166a8961a7eb4e1c24d07f4159c67a"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fe0785396acbb51094bdb0b9e629595fab23306f","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Improve \u0027attach interface\u0027 exception handling"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Raise HTTPForbidden exception when trying to attach a port with"},{"line_number":10,"context_line":"different tenant_id to an instance."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I4a4017407ac7358490974cbffc5b7dbb7a200f44"},{"line_number":13,"context_line":"Closes-bug: #1409617"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"da86d52c_a44912b9","line":10,"updated":"2015-02-10 15:46:43.000000000","message":"Please improve the description of the code changes here. How about adding:\n\n Previously, if a user attempted to launch an instance and specified a\n port that belonged to a different tenant, an HTTP 500 Server\n Error was returned to the user. This patch changes that to a\n more informative HTTPNotFound exception.","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"234962114e133a5cdf76344127b4dbc7d1cea18a","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Improve \u0027attach interface\u0027 exception handling"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Raise HTTPForbidden exception when trying to attach a port with"},{"line_number":10,"context_line":"different tenant_id to an instance."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: I4a4017407ac7358490974cbffc5b7dbb7a200f44"},{"line_number":13,"context_line":"Closes-bug: #1409617"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"da86d52c_c596edef","line":10,"in_reply_to":"da86d52c_a44912b9","updated":"2015-02-11 01:13:04.000000000","message":"Done","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"}],"nova/api/openstack/compute/contrib/attach_interfaces.py":[{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"577b5421c4e821750dd21f346932b14812642bd2","unresolved":false,"context_lines":[{"line_number":119,"context_line":"                                           want_objects\u003dTrue)"},{"line_number":120,"context_line":"            if port_id:"},{"line_number":121,"context_line":"                # Check if port belongs to the tenant for the instance."},{"line_number":122,"context_line":"                port_info \u003d self.network_api.show_port(context, port_id)"},{"line_number":123,"context_line":"                if port_info[\u0027port\u0027][\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":124,"context_line":"                    msg_dict \u003d {\u0027port\u0027: port_id, \u0027instance\u0027: server_id,"},{"line_number":125,"context_line":"                                \u0027tenant\u0027: instance.project_id}"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_1a333af8","line":122,"updated":"2015-01-13 09:20:58.000000000","message":"question:\nI didn\u0027t see an implementation of show_port in nova-network\nwill it lead to failure?","commit_id":"ea41e1b099c0590e10802a4c584252a652251eac"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"2e72d01e351d7aff27005ed715f8548fd16f9312","unresolved":false,"context_lines":[{"line_number":119,"context_line":"                                           want_objects\u003dTrue)"},{"line_number":120,"context_line":"            if port_id:"},{"line_number":121,"context_line":"                # Check if port belongs to the tenant for the instance."},{"line_number":122,"context_line":"                port_info \u003d self.network_api.show_port(context, port_id)"},{"line_number":123,"context_line":"                if port_info[\u0027port\u0027][\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":124,"context_line":"                    msg_dict \u003d {\u0027port\u0027: port_id, \u0027instance\u0027: server_id,"},{"line_number":125,"context_line":"                                \u0027tenant\u0027: instance.project_id}"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_deec2695","line":122,"in_reply_to":"3a961159_1a333af8","updated":"2015-01-14 01:09:34.000000000","message":"Right, will handle this in the next patch","commit_id":"ea41e1b099c0590e10802a4c584252a652251eac"},{"author":{"_account_id":6062,"name":"jichenjc","email":"jichenjc@cn.ibm.com","username":"jichenjc"},"change_message_id":"577b5421c4e821750dd21f346932b14812642bd2","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                exception.NetworkNotFound) as e:"},{"line_number":140,"context_line":"            raise exc.HTTPBadRequest(explanation\u003de.format_message())"},{"line_number":141,"context_line":"        except exception.Forbidden as e:"},{"line_number":142,"context_line":"            raise exc.HTTPForbidden(explanation\u003de.format_message())"},{"line_number":143,"context_line":"        except exception.InstanceIsLocked as e:"},{"line_number":144,"context_line":"            raise exc.HTTPConflict(explanation\u003de.format_message())"},{"line_number":145,"context_line":"        except NotImplementedError:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_bf3938f4","line":142,"updated":"2015-01-13 09:20:58.000000000","message":"Question:where are those exceptions come from? .show_port?","commit_id":"ea41e1b099c0590e10802a4c584252a652251eac"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"2e72d01e351d7aff27005ed715f8548fd16f9312","unresolved":false,"context_lines":[{"line_number":139,"context_line":"                exception.NetworkNotFound) as e:"},{"line_number":140,"context_line":"            raise exc.HTTPBadRequest(explanation\u003de.format_message())"},{"line_number":141,"context_line":"        except exception.Forbidden as e:"},{"line_number":142,"context_line":"            raise exc.HTTPForbidden(explanation\u003de.format_message())"},{"line_number":143,"context_line":"        except exception.InstanceIsLocked as e:"},{"line_number":144,"context_line":"            raise exc.HTTPConflict(explanation\u003de.format_message())"},{"line_number":145,"context_line":"        except NotImplementedError:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_be8cbad8","line":142,"in_reply_to":"3a961159_bf3938f4","updated":"2015-01-14 01:09:34.000000000","message":"Yes, see line 75","commit_id":"ea41e1b099c0590e10802a4c584252a652251eac"},{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"d69c4746f790b5f1d5fd7fd712758e441e0627e3","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                                \u0027tenant\u0027: instance.project_id}"},{"line_number":125,"context_line":"                    msg \u003d _(\"Port: %(port)s is not allowed to attach \""},{"line_number":126,"context_line":"                            \"to instance: %(instance)s, since it doesn\u0027t \""},{"line_number":127,"context_line":"                            \"belong to tenant: %(tenant)s.\") % msg_dict"},{"line_number":128,"context_line":"                    raise exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":129,"context_line":"            except NotImplementedError:"},{"line_number":130,"context_line":"                # Pass when using nova-network."}],"source_content_type":"text/x-python","patch_set":6,"id":"fa81d914_c13f04d5","line":127,"updated":"2015-01-28 22:49:15.000000000","message":"nit: suggest removing colons (\u0027:\u0027) in future version of change.","commit_id":"eb8e2179bb8bda07cb98a7b71fcc506456c009ef"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"2c14134da8a5b805e270f040048fd737a147cace","unresolved":false,"context_lines":[{"line_number":124,"context_line":"                                \u0027tenant\u0027: instance.project_id}"},{"line_number":125,"context_line":"                    msg \u003d _(\"Port: %(port)s is not allowed to attach \""},{"line_number":126,"context_line":"                            \"to instance: %(instance)s, since it doesn\u0027t \""},{"line_number":127,"context_line":"                            \"belong to tenant: %(tenant)s.\") % msg_dict"},{"line_number":128,"context_line":"                    raise exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":129,"context_line":"            except NotImplementedError:"},{"line_number":130,"context_line":"                # Pass when using nova-network."}],"source_content_type":"text/x-python","patch_set":6,"id":"fa81d914_6dff26ab","line":127,"in_reply_to":"fa81d914_c13f04d5","updated":"2015-01-29 01:24:52.000000000","message":"Done","commit_id":"eb8e2179bb8bda07cb98a7b71fcc506456c009ef"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"7c4ee8f0d325a2aed42d53c45338ac7900439a79","unresolved":false,"context_lines":[{"line_number":119,"context_line":"            try:"},{"line_number":120,"context_line":"                # Check if port belongs to the tenant for the instance."},{"line_number":121,"context_line":"                port_info \u003d self.network_api.show_port(context, port_id)"},{"line_number":122,"context_line":"                if port_info[\u0027port\u0027][\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":123,"context_line":"                    msg_dict \u003d {\u0027port\u0027: port_id, \u0027instance\u0027: server_id,"},{"line_number":124,"context_line":"                                \u0027tenant\u0027: instance.project_id}"},{"line_number":125,"context_line":"                    msg \u003d _(\"Port %(port)s is not allowed to attach \""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_eacc088d","line":122,"updated":"2015-02-08 19:16:13.000000000","message":"what if this is an admin user? should that user be able to attach an interface to the tenant users instance?","commit_id":"69f5a283f54c118821df3457a46c055ee5873854"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"192ed6d7630a7ff9fd17b18815e8e6a68e2e3bbe","unresolved":false,"context_lines":[{"line_number":119,"context_line":"            try:"},{"line_number":120,"context_line":"                # Check if port belongs to the tenant for the instance."},{"line_number":121,"context_line":"                port_info \u003d self.network_api.show_port(context, port_id)"},{"line_number":122,"context_line":"                if port_info[\u0027port\u0027][\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":123,"context_line":"                    msg_dict \u003d {\u0027port\u0027: port_id, \u0027instance\u0027: server_id,"},{"line_number":124,"context_line":"                                \u0027tenant\u0027: instance.project_id}"},{"line_number":125,"context_line":"                    msg \u003d _(\"Port %(port)s is not allowed to attach \""}],"source_content_type":"text/x-python","patch_set":7,"id":"da86d52c_e56c3a0b","line":122,"in_reply_to":"da86d52c_eacc088d","updated":"2015-02-09 01:03:56.000000000","message":"Actually, the bug could be reproduced by an admin user, see bug report for detail.","commit_id":"69f5a283f54c118821df3457a46c055ee5873854"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fe0785396acbb51094bdb0b9e629595fab23306f","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            vif \u003d self.compute_api.attach_interface(context,"},{"line_number":122,"context_line":"                instance, network_id, port_id, req_ip)"},{"line_number":123,"context_line":"        except exception.PortNotUsable as e:"},{"line_number":124,"context_line":"            raise exc.HTTPForbidden(explanation\u003de.format_message())"},{"line_number":125,"context_line":"        except (exception.PortNotFound,"},{"line_number":126,"context_line":"                exception.FixedIpAlreadyInUse,"},{"line_number":127,"context_line":"                exception.PortInUse,"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_04e9fe7f","line":124,"updated":"2015-02-10 15:46:43.000000000","message":"I believe this should be HTTPNotFound. HTTPForbidden should be reserved for those occasions when a user does not have permission to perform an action. That is not the case here. The situation here is that the user is accessing something that does not belong to them. This should return a 404 Not Found.","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"234962114e133a5cdf76344127b4dbc7d1cea18a","unresolved":false,"context_lines":[{"line_number":121,"context_line":"            vif \u003d self.compute_api.attach_interface(context,"},{"line_number":122,"context_line":"                instance, network_id, port_id, req_ip)"},{"line_number":123,"context_line":"        except exception.PortNotUsable as e:"},{"line_number":124,"context_line":"            raise exc.HTTPForbidden(explanation\u003de.format_message())"},{"line_number":125,"context_line":"        except (exception.PortNotFound,"},{"line_number":126,"context_line":"                exception.FixedIpAlreadyInUse,"},{"line_number":127,"context_line":"                exception.PortInUse,"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_457d9d1b","line":124,"in_reply_to":"da86d52c_04e9fe7f","updated":"2015-02-11 01:13:04.000000000","message":"Done","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"84d9fedffcd082c113ceec80b256a4f6dc91fde0","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            vif \u003d self.compute_api.attach_interface(context,"},{"line_number":123,"context_line":"                instance, network_id, port_id, req_ip)"},{"line_number":124,"context_line":"        except (exception.PortNotFound,"},{"line_number":125,"context_line":"                exception.NetworkNotFound) as e:"},{"line_number":126,"context_line":"            raise exc.HTTPNotFound(explanation\u003de.format_message())"},{"line_number":127,"context_line":"        except (exception.FixedIpAlreadyInUse,"},{"line_number":128,"context_line":"                exception.NoMoreFixedIps,"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a80dd14_4c1d2f0f","line":125,"updated":"2015-03-04 20:11:00.000000000","message":"This is actually fixing a different bug and arguably shouldn\u0027t be here, you should have a different change to return 404 for the existing PortNotFound/NetworkNotFound errors already handled here.","commit_id":"d6e077a09676edf1cf1c0daeb790d95d75533f70"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"beac83bfda712129944d9b47093a1c545ee4fc57","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            vif \u003d self.compute_api.attach_interface(context,"},{"line_number":123,"context_line":"                instance, network_id, port_id, req_ip)"},{"line_number":124,"context_line":"        except (exception.PortNotFound,"},{"line_number":125,"context_line":"                exception.NetworkNotFound) as e:"},{"line_number":126,"context_line":"            raise exc.HTTPNotFound(explanation\u003de.format_message())"},{"line_number":127,"context_line":"        except (exception.FixedIpAlreadyInUse,"},{"line_number":128,"context_line":"                exception.NoMoreFixedIps,"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a80dd14_de4a8e82","line":125,"in_reply_to":"9a80dd14_4c1d2f0f","updated":"2015-03-05 06:37:58.000000000","message":"New patch for this: https://review.openstack.org/161618","commit_id":"d6e077a09676edf1cf1c0daeb790d95d75533f70"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"3d72fb16f0af3111023fa5b3915729d92fc55948","unresolved":false,"context_lines":[{"line_number":127,"context_line":"                exception.NetworkDuplicated,"},{"line_number":128,"context_line":"                exception.NetworkAmbiguous,"},{"line_number":129,"context_line":"                exception.NetworkNotFound,"},{"line_number":130,"context_line":"                exception.PortNotUsable) as e:"},{"line_number":131,"context_line":"            raise exc.HTTPBadRequest(explanation\u003de.format_message())"},{"line_number":132,"context_line":"        except exception.InstanceIsLocked as e:"},{"line_number":133,"context_line":"            raise exc.HTTPConflict(explanation\u003de.format_message())"}],"source_content_type":"text/x-python","patch_set":18,"id":"9a80dd14_d51b771a","line":130,"updated":"2015-03-10 18:32:31.000000000","message":"Don\u0027t you want to rebase this change on top of https://review.openstack.org/#/c/161618/ to avoid the merge conflict?\n\nAlso, we should have a test in http://git.openstack.org/cgit/openstack/nova/tree/nova/tests/unit/api/openstack/compute/contrib/test_attach_interfaces.py to assert that when the compute_api raises PortNotUsable we get an HTTPBadRequest back.","commit_id":"1be23e36c2184cbea271a4fc4736e7453176512f"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"5cf5f23f38f95fc92f410951261f2a76a03261a5","unresolved":false,"context_lines":[{"line_number":127,"context_line":"                exception.NetworkDuplicated,"},{"line_number":128,"context_line":"                exception.NetworkAmbiguous,"},{"line_number":129,"context_line":"                exception.NetworkNotFound,"},{"line_number":130,"context_line":"                exception.PortNotUsable) as e:"},{"line_number":131,"context_line":"            raise exc.HTTPBadRequest(explanation\u003de.format_message())"},{"line_number":132,"context_line":"        except exception.InstanceIsLocked as e:"},{"line_number":133,"context_line":"            raise exc.HTTPConflict(explanation\u003de.format_message())"}],"source_content_type":"text/x-python","patch_set":18,"id":"9a80dd14_ecaee82e","line":130,"in_reply_to":"9a80dd14_d51b771a","updated":"2015-03-11 01:47:42.000000000","message":"Done","commit_id":"1be23e36c2184cbea271a4fc4736e7453176512f"}],"nova/api/openstack/compute/plugins/v3/attach_interfaces.py":[{"author":{"_account_id":6802,"name":"Joel Coffman","email":"jmc7tp@gmail.com","username":"joel-coffman"},"change_message_id":"d69c4746f790b5f1d5fd7fd712758e441e0627e3","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                                \u0027tenant\u0027: instance.project_id}"},{"line_number":124,"context_line":"                    msg \u003d _(\"Port: %(port)s is not allowed to attach \""},{"line_number":125,"context_line":"                            \"to instance: %(instance)s, since it doesn\u0027t \""},{"line_number":126,"context_line":"                            \"belong to tenant: %(tenant)s.\") % msg_dict"},{"line_number":127,"context_line":"                    raise exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":128,"context_line":"            except NotImplementedError:"},{"line_number":129,"context_line":"                # Pass when using nova-network."}],"source_content_type":"text/x-python","patch_set":6,"id":"fa81d914_0c0f932f","line":126,"updated":"2015-01-28 22:49:15.000000000","message":"ditto","commit_id":"eb8e2179bb8bda07cb98a7b71fcc506456c009ef"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"2c14134da8a5b805e270f040048fd737a147cace","unresolved":false,"context_lines":[{"line_number":123,"context_line":"                                \u0027tenant\u0027: instance.project_id}"},{"line_number":124,"context_line":"                    msg \u003d _(\"Port: %(port)s is not allowed to attach \""},{"line_number":125,"context_line":"                            \"to instance: %(instance)s, since it doesn\u0027t \""},{"line_number":126,"context_line":"                            \"belong to tenant: %(tenant)s.\") % msg_dict"},{"line_number":127,"context_line":"                    raise exc.HTTPBadRequest(explanation\u003dmsg)"},{"line_number":128,"context_line":"            except NotImplementedError:"},{"line_number":129,"context_line":"                # Pass when using nova-network."}],"source_content_type":"text/x-python","patch_set":6,"id":"fa81d914_4d1b421b","line":126,"in_reply_to":"fa81d914_0c0f932f","updated":"2015-01-29 01:24:52.000000000","message":"Done","commit_id":"eb8e2179bb8bda07cb98a7b71fcc506456c009ef"},{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"e4596ad8c2afb357f3f2b5bf45f0f8e252cfb00c","unresolved":false,"context_lines":[{"line_number":117,"context_line":"        if port_id:"},{"line_number":118,"context_line":"            try:"},{"line_number":119,"context_line":"                # Check if port belongs to the tenant for the instance."},{"line_number":120,"context_line":"                port_info \u003d self.network_api.show_port(context, port_id)"},{"line_number":121,"context_line":"                if port_info[\u0027port\u0027][\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":122,"context_line":"                    msg_dict \u003d {\u0027port\u0027: port_id, \u0027instance\u0027: server_id,"},{"line_number":123,"context_line":"                                \u0027tenant\u0027: instance.project_id}"}],"source_content_type":"text/x-python","patch_set":7,"id":"fa81d914_6fbab36f","line":120,"updated":"2015-01-29 06:59:21.000000000","message":"hi, I don\u0027t think we call show_port here, kinds of waste.\ncan you pelase check the code in \nallocate_for_instance in neutronv2 api?\nhttps://github.com/openstack/nova/blob/master/nova/network/neutronv2/api.py#L370\nthe api has a call of show_port, you can just check ifthe port_info \u0027s tenant_id match with the requested instance.","commit_id":"69f5a283f54c118821df3457a46c055ee5873854"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fe0785396acbb51094bdb0b9e629595fab23306f","unresolved":false,"context_lines":[{"line_number":118,"context_line":"            vif \u003d self.compute_api.attach_interface(context,"},{"line_number":119,"context_line":"                instance, network_id, port_id, req_ip)"},{"line_number":120,"context_line":"        except exception.PortNotUsable as e:"},{"line_number":121,"context_line":"            raise exc.HTTPForbidden(explanation\u003de.format_message())"},{"line_number":122,"context_line":"        except (exception.NetworkDuplicated,"},{"line_number":123,"context_line":"                exception.NetworkAmbiguous) as e:"},{"line_number":124,"context_line":"            raise exc.HTTPBadRequest(explanation\u003de.format_message())"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_c49526e5","line":121,"updated":"2015-02-10 15:46:43.000000000","message":"ditto about HTTPNotFound","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"234962114e133a5cdf76344127b4dbc7d1cea18a","unresolved":false,"context_lines":[{"line_number":118,"context_line":"            vif \u003d self.compute_api.attach_interface(context,"},{"line_number":119,"context_line":"                instance, network_id, port_id, req_ip)"},{"line_number":120,"context_line":"        except exception.PortNotUsable as e:"},{"line_number":121,"context_line":"            raise exc.HTTPForbidden(explanation\u003de.format_message())"},{"line_number":122,"context_line":"        except (exception.NetworkDuplicated,"},{"line_number":123,"context_line":"                exception.NetworkAmbiguous) as e:"},{"line_number":124,"context_line":"            raise exc.HTTPBadRequest(explanation\u003de.format_message())"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_85aa356f","line":121,"in_reply_to":"da86d52c_c49526e5","updated":"2015-02-11 01:13:04.000000000","message":"Done","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"}],"nova/network/neutronv2/api.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"fe0785396acbb51094bdb0b9e629595fab23306f","unresolved":false,"context_lines":[{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotUsable(port_id\u003drequest.port_id,"},{"line_number":377,"context_line":"                                                      instance\u003dinstance.uuid)"},{"line_number":378,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":379,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_04457e6f","line":376,"updated":"2015-02-10 15:46:43.000000000","message":"I think this should just raise PortNotFound, as that is more appropriate. There\u0027s nothing non-usable about the port itself. It\u0027s just that the user making the request does not have access to that particular port.","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"234962114e133a5cdf76344127b4dbc7d1cea18a","unresolved":false,"context_lines":[{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotUsable(port_id\u003drequest.port_id,"},{"line_number":377,"context_line":"                                                      instance\u003dinstance.uuid)"},{"line_number":378,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":379,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_65cc618a","line":376,"in_reply_to":"da86d52c_04457e6f","updated":"2015-02-11 01:13:04.000000000","message":"Done","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"},{"author":{"_account_id":6610,"name":"Zhenguo Niu","email":"Niu.ZGlinux@gmail.com","username":"niu-zglinux"},"change_message_id":"699a954ae8d3026146b3f1dbcdebcb28c18e1df4","unresolved":false,"context_lines":[{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotUsable(port_id\u003drequest.port_id,"},{"line_number":377,"context_line":"                                                      instance\u003dinstance.uuid)"},{"line_number":378,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":379,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"}],"source_content_type":"text/x-python","patch_set":12,"id":"da86d52c_581e640d","line":376,"in_reply_to":"da86d52c_65cc618a","updated":"2015-02-11 01:44:12.000000000","message":"I don\u0027t think PortNotFound is appropriate here, the issue is that the port and the instance don\u0027t belong to the same tenant, the port is non-usable for the instance, not because the user making the request does not have access to that particular port. in fact, even admin can not attach a port to the instance when they don\u0027t have the same project_id.","commit_id":"3174b502e162084a5ac79032f894e09a995be56d"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"e72563e099754ae02bc9863a1f84ad7cbb2ea556","unresolved":false,"context_lines":[{"line_number":372,"context_line":"                        port \u003d neutron.show_port(request.port_id)[\u0027port\u0027]"},{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":377,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":378,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"}],"source_content_type":"text/x-python","patch_set":14,"id":"da86d52c_7de29630","line":375,"updated":"2015-02-14 18:41:08.000000000","message":"why is an admin tenant unable to attach ain interface to a tenant VM?","commit_id":"9c0a5a94d03f7da9f35aead80cb44fd7fb47f2a4"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"0a7ab4084bf0ab645a3efba20ca2340898ddab70","unresolved":false,"context_lines":[{"line_number":372,"context_line":"                        port \u003d neutron.show_port(request.port_id)[\u0027port\u0027]"},{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":377,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":378,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"}],"source_content_type":"text/x-python","patch_set":14,"id":"ba7be1f8_57683387","line":375,"in_reply_to":"da86d52c_7de29630","updated":"2015-02-23 05:05:15.000000000","message":"It\u0027s restricted by method _build_network_info_model in line 1412, only ports with tenant\u003dinstance[\u0027project_id\u0027] will be built, and even if admin could attach an interface to a tenant vm successfully, the user in tenant do not have permission to get the port info, so i think it\u0027s the answer.","commit_id":"9c0a5a94d03f7da9f35aead80cb44fd7fb47f2a4"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"afb6b0c02f1b46f2d11f8ec7cce69f476c78b92c","unresolved":false,"context_lines":[{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":377,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":378,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"},{"line_number":379,"context_line":"                    if hypervisor_macs is not None:"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a80dd14_89c1d930","line":376,"updated":"2015-03-04 19:48:10.000000000","message":"I was thinking this should be a 403 but I guess http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html says that if you don\u0027t provide response info about why the request is forbidden you can use 404.  The 404 is a bit confusing though.  I\u0027d like to at least see a message in the logs if we\u0027re not going to return a 403, but it seems a 403 would be cleanest, we could use this:\n\nhttp://git.openstack.org/cgit/openstack/nova/tree/nova/exception.py#n176\n\nOr an exception type that extends that, something like:\n\nPortAttachForbidden","commit_id":"d6e077a09676edf1cf1c0daeb790d95d75533f70"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"84d9fedffcd082c113ceec80b256a4f6dc91fde0","unresolved":false,"context_lines":[{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":377,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":378,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"},{"line_number":379,"context_line":"                    if hypervisor_macs is not None:"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a80dd14_cc0affd1","line":376,"in_reply_to":"9a80dd14_89c1d930","updated":"2015-03-04 20:11:00.000000000","message":"Actually, a 400 with a decent message might be best here.","commit_id":"d6e077a09676edf1cf1c0daeb790d95d75533f70"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"beac83bfda712129944d9b47093a1c545ee4fc57","unresolved":false,"context_lines":[{"line_number":373,"context_line":"                    except neutron_client_exc.PortNotFoundClient:"},{"line_number":374,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":375,"context_line":"                    if port[\u0027tenant_id\u0027] !\u003d instance.project_id:"},{"line_number":376,"context_line":"                        raise exception.PortNotFound(port_id\u003drequest.port_id)"},{"line_number":377,"context_line":"                    if port.get(\u0027device_id\u0027):"},{"line_number":378,"context_line":"                        raise exception.PortInUse(port_id\u003drequest.port_id)"},{"line_number":379,"context_line":"                    if hypervisor_macs is not None:"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a80dd14_de60ce37","line":376,"in_reply_to":"9a80dd14_cc0affd1","updated":"2015-03-05 06:37:58.000000000","message":"Done","commit_id":"d6e077a09676edf1cf1c0daeb790d95d75533f70"}],"nova/tests/unit/api/openstack/compute/contrib/test_attach_interfaces.py":[{"author":{"_account_id":6167,"name":"Ken\u0027ichi Ohmichi","email":"ken1ohmichi@gmail.com","username":"oomichi"},"change_message_id":"8065f61feffb04de0285021118f03b6e44523f36","unresolved":false,"context_lines":[{"line_number":493,"context_line":"    controller_cls \u003d attach_interfaces_v2.InterfaceAttachmentController"},{"line_number":494,"context_line":"    validate_exc \u003d exc.HTTPBadRequest"},{"line_number":495,"context_line":"    in_use_exc \u003d exc.HTTPBadRequest"},{"line_number":496,"context_line":"    not_found_exc \u003d exc.HTTPNotFound"},{"line_number":497,"context_line":""},{"line_number":498,"context_line":"    def test_attach_interface_instance_with_non_uuid_net_id(self):"},{"line_number":499,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":13,"id":"da86d52c_5570b4a3","line":496,"updated":"2015-02-12 05:35:12.000000000","message":"We can just remove this line instead of changing because exc.HTTPNotFound is the same as the one of  InterfaceAttachTestsV21","commit_id":"366bbfcaadc7ae6b986dcbfd032800665d76fcad"},{"author":{"_account_id":9569,"name":"Sergey Nikitin","email":"nikitinserv@gmail.com","username":"snikitin"},"change_message_id":"caa2306f0db97f43e77c223af5fa86c741d892bd","unresolved":false,"context_lines":[{"line_number":493,"context_line":"    controller_cls \u003d attach_interfaces_v2.InterfaceAttachmentController"},{"line_number":494,"context_line":"    validate_exc \u003d exc.HTTPBadRequest"},{"line_number":495,"context_line":"    in_use_exc \u003d exc.HTTPBadRequest"},{"line_number":496,"context_line":"    not_found_exc \u003d exc.HTTPNotFound"},{"line_number":497,"context_line":""},{"line_number":498,"context_line":"    def test_attach_interface_instance_with_non_uuid_net_id(self):"},{"line_number":499,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":13,"id":"da86d52c_6fae859a","line":496,"in_reply_to":"da86d52c_5570b4a3","updated":"2015-02-13 09:33:38.000000000","message":"+1","commit_id":"366bbfcaadc7ae6b986dcbfd032800665d76fcad"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"b16ed49c10b12e83b8911fedae4cf8e0056a6dcc","unresolved":false,"context_lines":[{"line_number":493,"context_line":"    controller_cls \u003d attach_interfaces_v2.InterfaceAttachmentController"},{"line_number":494,"context_line":"    validate_exc \u003d exc.HTTPBadRequest"},{"line_number":495,"context_line":"    in_use_exc \u003d exc.HTTPBadRequest"},{"line_number":496,"context_line":"    not_found_exc \u003d exc.HTTPNotFound"},{"line_number":497,"context_line":""},{"line_number":498,"context_line":"    def test_attach_interface_instance_with_non_uuid_net_id(self):"},{"line_number":499,"context_line":"        pass"}],"source_content_type":"text/x-python","patch_set":13,"id":"da86d52c_142d30a8","line":496,"in_reply_to":"da86d52c_5570b4a3","updated":"2015-02-14 01:51:58.000000000","message":"Done","commit_id":"366bbfcaadc7ae6b986dcbfd032800665d76fcad"}],"nova/tests/unit/network/test_neutronv2.py":[{"author":{"_account_id":12175,"name":"Eli Qiao","email":"qiaoliyong@gmail.com","username":"Eli"},"change_message_id":"237e7a53eeab0334fc7c2010df4564d0281e98e8","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                     self.nets9, self.nets10]"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"        self.port_address \u003d \u002710.0.1.2\u0027"},{"line_number":259,"context_line":"        self.tenant_id \u003d \u00279d049e4b60b64716978ab415e6fbd5c0\u0027"},{"line_number":260,"context_line":"        self.port_data1 \u003d [{\u0027network_id\u0027: \u0027my_netid1\u0027,"},{"line_number":261,"context_line":"                           \u0027device_id\u0027: self.instance2[\u0027uuid\u0027],"},{"line_number":262,"context_line":"                           \u0027tenant_id\u0027: self.tenant_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"ba7be1f8_a5121256","line":259,"updated":"2015-03-01 03:36:46.000000000","message":"if you respin patch, can you update the project_id with self.tenant_id in 204 and 210 ?","commit_id":"d6e077a09676edf1cf1c0daeb790d95d75533f70"},{"author":{"_account_id":4428,"name":"Liyingjun","email":"yinjalee@163.com","username":"liyingjun"},"change_message_id":"beac83bfda712129944d9b47093a1c545ee4fc57","unresolved":false,"context_lines":[{"line_number":256,"context_line":"                     self.nets9, self.nets10]"},{"line_number":257,"context_line":""},{"line_number":258,"context_line":"        self.port_address \u003d \u002710.0.1.2\u0027"},{"line_number":259,"context_line":"        self.tenant_id \u003d \u00279d049e4b60b64716978ab415e6fbd5c0\u0027"},{"line_number":260,"context_line":"        self.port_data1 \u003d [{\u0027network_id\u0027: \u0027my_netid1\u0027,"},{"line_number":261,"context_line":"                           \u0027device_id\u0027: self.instance2[\u0027uuid\u0027],"},{"line_number":262,"context_line":"                           \u0027tenant_id\u0027: self.tenant_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a80dd14_5e5e9e46","line":259,"in_reply_to":"ba7be1f8_a5121256","updated":"2015-03-05 06:37:58.000000000","message":"Done","commit_id":"d6e077a09676edf1cf1c0daeb790d95d75533f70"}]}
