)]}'
{"neutron/api/v2/attributes.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"48c911d8c541873822d2b35631c08cdec625c518","unresolved":false,"context_lines":[{"line_number":500,"context_line":""},{"line_number":501,"context_line":"def _validate_device_owner(data, valid_values\u003dNone):"},{"line_number":502,"context_line":"    msg \u003d _validate_string(data, max_len\u003dDEVICE_OWNER_MAX_LEN)"},{"line_number":503,"context_line":"    if not msg and data \u003d\u003d lib_consts.DEVICE_OWNER_ROUTER_GW:"},{"line_number":504,"context_line":"        msg \u003d _(\"\u0027%s\u0027 can be used only internally\") % data"},{"line_number":505,"context_line":"        LOG.debug(msg)"},{"line_number":506,"context_line":"    return msg"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a122d0e_ec829851","line":503,"range":{"start_line":503,"start_character":7,"end_line":503,"end_character":18},"updated":"2016-04-18 16:05:47.000000000","message":"Just take this out.  I think the router gw message should take precedent over the max length message.  They won\u0027t coincide anyway.","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"147ff9c4c20da9f961c1158763a04bab4d32b8b8","unresolved":false,"context_lines":[{"line_number":501,"context_line":"def _validate_device_owner(data, valid_values\u003dNone):"},{"line_number":502,"context_line":"    msg \u003d _validate_string(data, max_len\u003dDEVICE_OWNER_MAX_LEN)"},{"line_number":503,"context_line":"    if not msg and data \u003d\u003d lib_consts.DEVICE_OWNER_ROUTER_GW:"},{"line_number":504,"context_line":"        msg \u003d _(\"\u0027%s\u0027 can be used only internally\") % data"},{"line_number":505,"context_line":"        LOG.debug(msg)"},{"line_number":506,"context_line":"    return msg"},{"line_number":507,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"9a061dce_1dc965ac","line":504,"updated":"2016-04-07 21:23:37.000000000","message":"I\u0027d just report that ports of type DEVICE_OWNER_ROUTER_GW cannot be created via the API.\n\nThe current message might leave some user wondering what \"internally\" means.\n\nThis is probably a minor point as this stuff is going to be documented anyway","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"48c911d8c541873822d2b35631c08cdec625c518","unresolved":false,"context_lines":[{"line_number":501,"context_line":"def _validate_device_owner(data, valid_values\u003dNone):"},{"line_number":502,"context_line":"    msg \u003d _validate_string(data, max_len\u003dDEVICE_OWNER_MAX_LEN)"},{"line_number":503,"context_line":"    if not msg and data \u003d\u003d lib_consts.DEVICE_OWNER_ROUTER_GW:"},{"line_number":504,"context_line":"        msg \u003d _(\"\u0027%s\u0027 can be used only internally\") % data"},{"line_number":505,"context_line":"        LOG.debug(msg)"},{"line_number":506,"context_line":"    return msg"},{"line_number":507,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"1a122d0e_19459416","line":504,"in_reply_to":"9a061dce_1dc965ac","updated":"2016-04-18 16:05:47.000000000","message":"I\u0027ll second this.  The internal distinction seems to just complicate things.  is there ever a valid use case to create a router gw port through this API?  If not, then we just need to create a simple validator for device owner that prohibits it.  It wouldn\u0027t need to check internal or any of that.","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"147ff9c4c20da9f961c1158763a04bab4d32b8b8","unresolved":false,"context_lines":[{"line_number":746,"context_line":"                      \u0027default\u0027: \u0027\u0027,"},{"line_number":747,"context_line":"                      \u0027is_visible\u0027: True},"},{"line_number":748,"context_line":"        \u0027device_owner\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: True,"},{"line_number":749,"context_line":"                         \u0027validate\u0027: {\u0027type:device_owner\u0027: None},"},{"line_number":750,"context_line":"                         \u0027validate_internal\u0027: {"},{"line_number":751,"context_line":"                             \u0027type:string\u0027: DEVICE_OWNER_MAX_LEN},"},{"line_number":752,"context_line":"                         \u0027default\u0027: \u0027\u0027, \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a061dce_bd6319b0","line":749,"updated":"2016-04-07 21:23:37.000000000","message":"It\u0027s a bit weird that you created a validator whose only purpose is to block usage of the attribute.\n\nHave you tried just setting allow_post: False and allow_put: False? afaik this should be enough to prevent API usage of the attribute but not block internal usage.","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"48c911d8c541873822d2b35631c08cdec625c518","unresolved":false,"context_lines":[{"line_number":746,"context_line":"                      \u0027default\u0027: \u0027\u0027,"},{"line_number":747,"context_line":"                      \u0027is_visible\u0027: True},"},{"line_number":748,"context_line":"        \u0027device_owner\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: True,"},{"line_number":749,"context_line":"                         \u0027validate\u0027: {\u0027type:device_owner\u0027: None},"},{"line_number":750,"context_line":"                         \u0027validate_internal\u0027: {"},{"line_number":751,"context_line":"                             \u0027type:string\u0027: DEVICE_OWNER_MAX_LEN},"},{"line_number":752,"context_line":"                         \u0027default\u0027: \u0027\u0027, \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a122d0e_59feec38","line":749,"in_reply_to":"9a061dce_1d0b257e","updated":"2016-04-18 16:05:47.000000000","message":"I agree with @Cedric and I like the custom validator because I think it fits what you\u0027re trying to do, prevent the use of a particular value on POST and PUT (as @Salv pointed out on L504).  But, I think we may need to iterate on how you accomplish it.","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"6c58e31b7ad890a2a704552e4c81c8f04b521f81","unresolved":false,"context_lines":[{"line_number":746,"context_line":"                      \u0027default\u0027: \u0027\u0027,"},{"line_number":747,"context_line":"                      \u0027is_visible\u0027: True},"},{"line_number":748,"context_line":"        \u0027device_owner\u0027: {\u0027allow_post\u0027: True, \u0027allow_put\u0027: True,"},{"line_number":749,"context_line":"                         \u0027validate\u0027: {\u0027type:device_owner\u0027: None},"},{"line_number":750,"context_line":"                         \u0027validate_internal\u0027: {"},{"line_number":751,"context_line":"                             \u0027type:string\u0027: DEVICE_OWNER_MAX_LEN},"},{"line_number":752,"context_line":"                         \u0027default\u0027: \u0027\u0027, \u0027enforce_policy\u0027: True,"}],"source_content_type":"text/x-python","patch_set":16,"id":"9a061dce_1d0b257e","line":749,"in_reply_to":"9a061dce_bd6319b0","updated":"2016-04-07 21:31:05.000000000","message":"allow_post/put \u003d\u003d False has a larger effect: it disallows to provide device_owner (typically it breaks how nova uses neutron APIs) when we want to disallow a specific device_owner","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"48c911d8c541873822d2b35631c08cdec625c518","unresolved":false,"context_lines":[{"line_number":960,"context_line":"                raise exc_cls(msg)"},{"line_number":961,"context_line":""},{"line_number":962,"context_line":""},{"line_number":963,"context_line":"def convert_value(attr_info, res_dict, exc_cls\u003dValueError, internal\u003dFalse):"},{"line_number":964,"context_line":"    for attr, attr_vals in six.iteritems(attr_info):"},{"line_number":965,"context_line":"        if (attr not in res_dict or"},{"line_number":966,"context_line":"            res_dict[attr] is ATTR_NOT_SPECIFIED):"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a122d0e_f9609837","line":963,"range":{"start_line":963,"start_character":4,"end_line":963,"end_character":17},"updated":"2016-04-18 16:05:47.000000000","message":"I don\u0027t get why this method needs to change at all.  This method just got a more complicated and difficult to understand just to handle a one-off.","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"48c911d8c541873822d2b35631c08cdec625c518","unresolved":false,"context_lines":[{"line_number":968,"context_line":"        # Convert values if necessary"},{"line_number":969,"context_line":"        if \u0027convert_to\u0027 in attr_vals:"},{"line_number":970,"context_line":"            res_dict[attr] \u003d attr_vals[\u0027convert_to\u0027](res_dict[attr])"},{"line_number":971,"context_line":""},{"line_number":972,"context_line":"        # Check that configured values are correct"},{"line_number":973,"context_line":"        validator \u003d attr_vals.get(\u0027validate\u0027)"},{"line_number":974,"context_line":"        if internal and \u0027validate_internal\u0027 in attr_vals:"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a122d0e_d6b92bcd","line":971,"updated":"2016-04-18 16:05:47.000000000","message":"nit:  Don\u0027t change whitespace unnecessarily.","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"}],"neutron/common/exceptions.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a11012138186576316d040d92168c2122bf14210","unresolved":false,"context_lines":[{"line_number":204,"context_line":""},{"line_number":205,"context_line":"class RouterGatewayPortCreationProhibited(e.BadRequest):"},{"line_number":206,"context_line":"    message \u003d _(\"Port on router cannot be set as gateway. \""},{"line_number":207,"context_line":"                \"Router gateway has to be set by updating \""},{"line_number":208,"context_line":"                \"\u0027external_gateway_info\u0027.\")"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_4ff878c3","line":207,"range":{"start_line":207,"start_character":32,"end_line":207,"end_character":38},"updated":"2016-03-23 23:21:46.000000000","message":"nit:  \"must\"\n\nMight be a little clearer.","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"a7b25bbdbe3a36167568033e0c20eeffb71433ac","unresolved":false,"context_lines":[{"line_number":204,"context_line":""},{"line_number":205,"context_line":"class RouterGatewayPortCreationProhibited(e.BadRequest):"},{"line_number":206,"context_line":"    message \u003d _(\"Port on router cannot be set as gateway. \""},{"line_number":207,"context_line":"                \"Router gateway has to be set by updating \""},{"line_number":208,"context_line":"                \"\u0027external_gateway_info\u0027.\")"},{"line_number":209,"context_line":""},{"line_number":210,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_e3f17c96","line":207,"range":{"start_line":207,"start_character":32,"end_line":207,"end_character":38},"in_reply_to":"fa0719c6_4ff878c3","updated":"2016-03-24 16:11:16.000000000","message":"Done","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"}],"neutron/db/db_base_plugin_v2.py":[{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"17ef89e1c571f9543b2812db43ac6d16853995ca","unresolved":false,"context_lines":[{"line_number":1380,"context_line":"                if tenant_id !\u003d router[\u0027tenant_id\u0027]:"},{"line_number":1381,"context_line":"                    raise n_exc.DeviceIDNotOwnedByTenant(device_id\u003ddevice_id)"},{"line_number":1382,"context_line":""},{"line_number":1383,"context_line":"    def _enforce_single_nw_gw_on_router_device_id(self, context,"},{"line_number":1384,"context_line":"                                                  device_owner,"},{"line_number":1385,"context_line":"                                                  device_id,"},{"line_number":1386,"context_line":"                                                  network_id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a5de9d1_6f744c35","line":1383,"range":{"start_line":1383,"start_character":8,"end_line":1383,"end_character":49},"updated":"2016-01-31 21:14:42.000000000","message":"I doubt this method handles correctly races if 2 concurrent create-ports try to define router gateway port","commit_id":"c9b16a3bf75816f636ac646b958b4ad679a5f2c0"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"23879ce3fa00ffab26ded7193af95fdb00619d71","unresolved":false,"context_lines":[{"line_number":1380,"context_line":"                if tenant_id !\u003d router[\u0027tenant_id\u0027]:"},{"line_number":1381,"context_line":"                    raise n_exc.DeviceIDNotOwnedByTenant(device_id\u003ddevice_id)"},{"line_number":1382,"context_line":""},{"line_number":1383,"context_line":"    def _enforce_single_nw_gw_on_router_device_id(self, context,"},{"line_number":1384,"context_line":"                                                  device_owner,"},{"line_number":1385,"context_line":"                                                  device_id,"},{"line_number":1386,"context_line":"                                                  network_id):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a5de9d1_a33be237","line":1383,"range":{"start_line":1383,"start_character":8,"end_line":1383,"end_character":49},"in_reply_to":"7a5de9d1_6f744c35","updated":"2016-02-02 15:06:40.000000000","message":"Done, this is true. I\u0027ve disallowed creation of ports this way. So this method and enumeration is no longer needed.","commit_id":"c9b16a3bf75816f636ac646b958b4ad679a5f2c0"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"4bd797897759c2f32cb8f8783933500d9b4167ec","unresolved":false,"context_lines":[{"line_number":1398,"context_line":"        query \u003d query.filter("},{"line_number":1399,"context_line":"                    models_v2.Port.device_owner \u003d\u003d"},{"line_number":1400,"context_line":"                    constants.DEVICE_OWNER_ROUTER_GW)"},{"line_number":1401,"context_line":"        port_ids \u003d [p[0] for p in query]"},{"line_number":1402,"context_line":"        if port_ids:"},{"line_number":1403,"context_line":"            raise n_exc.RouterAlreadyHasGatewayToNetwork("},{"line_number":1404,"context_line":"                device_id\u003ddevice_id, network_id\u003dnetwork_id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a5de9d1_6b968740","line":1401,"updated":"2016-01-31 06:24:13.000000000","message":"Is this necessary? how about:\n  if query.first() is None:\n      raise ..","commit_id":"c9b16a3bf75816f636ac646b958b4ad679a5f2c0"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"23879ce3fa00ffab26ded7193af95fdb00619d71","unresolved":false,"context_lines":[{"line_number":1398,"context_line":"        query \u003d query.filter("},{"line_number":1399,"context_line":"                    models_v2.Port.device_owner \u003d\u003d"},{"line_number":1400,"context_line":"                    constants.DEVICE_OWNER_ROUTER_GW)"},{"line_number":1401,"context_line":"        port_ids \u003d [p[0] for p in query]"},{"line_number":1402,"context_line":"        if port_ids:"},{"line_number":1403,"context_line":"            raise n_exc.RouterAlreadyHasGatewayToNetwork("},{"line_number":1404,"context_line":"                device_id\u003ddevice_id, network_id\u003dnetwork_id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a5de9d1_23cb7220","line":1401,"in_reply_to":"7a5de9d1_6b968740","updated":"2016-02-02 15:06:40.000000000","message":"This method is removed as the patch now resolves the issue by disallowing creation/update of ports as gw.","commit_id":"c9b16a3bf75816f636ac646b958b4ad679a5f2c0"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"17ef89e1c571f9543b2812db43ac6d16853995ca","unresolved":false,"context_lines":[{"line_number":1398,"context_line":"        query \u003d query.filter("},{"line_number":1399,"context_line":"                    models_v2.Port.device_owner \u003d\u003d"},{"line_number":1400,"context_line":"                    constants.DEVICE_OWNER_ROUTER_GW)"},{"line_number":1401,"context_line":"        port_ids \u003d [p[0] for p in query]"},{"line_number":1402,"context_line":"        if port_ids:"},{"line_number":1403,"context_line":"            raise n_exc.RouterAlreadyHasGatewayToNetwork("},{"line_number":1404,"context_line":"                device_id\u003ddevice_id, network_id\u003dnetwork_id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a5de9d1_ef7fdc14","line":1401,"in_reply_to":"7a5de9d1_6b968740","updated":"2016-01-31 21:14:42.000000000","message":"it\u0027s better to do:\n\n if query.count():","commit_id":"c9b16a3bf75816f636ac646b958b4ad679a5f2c0"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"23879ce3fa00ffab26ded7193af95fdb00619d71","unresolved":false,"context_lines":[{"line_number":1398,"context_line":"        query \u003d query.filter("},{"line_number":1399,"context_line":"                    models_v2.Port.device_owner \u003d\u003d"},{"line_number":1400,"context_line":"                    constants.DEVICE_OWNER_ROUTER_GW)"},{"line_number":1401,"context_line":"        port_ids \u003d [p[0] for p in query]"},{"line_number":1402,"context_line":"        if port_ids:"},{"line_number":1403,"context_line":"            raise n_exc.RouterAlreadyHasGatewayToNetwork("},{"line_number":1404,"context_line":"                device_id\u003ddevice_id, network_id\u003dnetwork_id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a5de9d1_63e16a9a","line":1401,"in_reply_to":"7a5de9d1_ef7fdc14","updated":"2016-02-02 15:06:40.000000000","message":"Same as above.","commit_id":"c9b16a3bf75816f636ac646b958b4ad679a5f2c0"},{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"d441404873cd5c8568104de87ea50ec5bf7fb6ee","unresolved":false,"context_lines":[{"line_number":1229,"context_line":"            \"\"\""},{"line_number":1230,"context_line":"            if (current_owner \u003d\u003d constants.DEVICE_OWNER_ROUTER_GW and"},{"line_number":1231,"context_line":"                str(tenant_id) is not \u0027\u0027):"},{"line_number":1232,"context_line":"                raise n_exc.RouterGatewayPortCreationProhibited()"},{"line_number":1233,"context_line":"            self._enforce_device_owner_not_router_intf_or_device_id("},{"line_number":1234,"context_line":"                context, current_owner, current_device_id,"},{"line_number":1235,"context_line":"                db_port[\u0027tenant_id\u0027])"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_7ff58f81","line":1232,"updated":"2016-02-03 03:09:30.000000000","message":"Why not update _enforce_device_owner_not_router_intf_or_device_id with adding this checking ? It could be more common to have a method like _validate_device_owner_and_device_id.","commit_id":"fb07dbec4d85b1027e6ac3ac45d38f674e7d0d40"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"ab0709729bd93c5be7983abe64531da72ea548c3","unresolved":false,"context_lines":[{"line_number":1229,"context_line":"            \"\"\""},{"line_number":1230,"context_line":"            if (current_owner \u003d\u003d constants.DEVICE_OWNER_ROUTER_GW and"},{"line_number":1231,"context_line":"                str(tenant_id) is not \u0027\u0027):"},{"line_number":1232,"context_line":"                raise n_exc.RouterGatewayPortCreationProhibited()"},{"line_number":1233,"context_line":"            self._enforce_device_owner_not_router_intf_or_device_id("},{"line_number":1234,"context_line":"                context, current_owner, current_device_id,"},{"line_number":1235,"context_line":"                db_port[\u0027tenant_id\u0027])"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_1ac0d6df","line":1232,"in_reply_to":"5a5ae5dd_7ff58f81","updated":"2016-02-04 11:57:19.000000000","message":"Done. That is much more elegant.","commit_id":"fb07dbec4d85b1027e6ac3ac45d38f674e7d0d40"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"35d21d5ebaddc9e5d37ef430efde30120eef5dd8","unresolved":false,"context_lines":[{"line_number":1362,"context_line":"    def get_ports_count(self, context, filters\u003dNone):"},{"line_number":1363,"context_line":"        return self._get_ports_query(context, filters).count()"},{"line_number":1364,"context_line":""},{"line_number":1365,"context_line":"    def _validate_device_owner_and_device_id(self, context,"},{"line_number":1366,"context_line":"                                             device_owner,"},{"line_number":1367,"context_line":"                                             device_id,"},{"line_number":1368,"context_line":"                                             tenant_id):"}],"source_content_type":"text/x-python","patch_set":11,"id":"7af24918_be8bee1d","line":1365,"range":{"start_line":1365,"start_character":8,"end_line":1365,"end_character":44},"updated":"2016-03-04 20:50:20.000000000","message":"Do you really need to change this method name and do all of the refactoring above to make this change?  It seems L1377 - L1379 is all you need.  Please revert the gratuitous refactoring [1].\n\n [1] http://docs.openstack.org/developer/neutron/devref/effective_neutron.html#scoping-your-patch-appropriately","commit_id":"97bf5cf0c2513cc984566ef2b6ffebee4ad1e6f3"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"990b8bbea5f607219ebd88124f37e217073b8241","unresolved":false,"context_lines":[{"line_number":1362,"context_line":"    def get_ports_count(self, context, filters\u003dNone):"},{"line_number":1363,"context_line":"        return self._get_ports_query(context, filters).count()"},{"line_number":1364,"context_line":""},{"line_number":1365,"context_line":"    def _validate_device_owner_and_device_id(self, context,"},{"line_number":1366,"context_line":"                                             device_owner,"},{"line_number":1367,"context_line":"                                             device_id,"},{"line_number":1368,"context_line":"                                             tenant_id):"}],"source_content_type":"text/x-python","patch_set":11,"id":"5aef4532_d5a4a4ba","line":1365,"range":{"start_line":1365,"start_character":8,"end_line":1365,"end_character":44},"in_reply_to":"7af24918_be8bee1d","updated":"2016-03-08 06:47:15.000000000","message":"Done. Removed all unwanted changes...","commit_id":"97bf5cf0c2513cc984566ef2b6ffebee4ad1e6f3"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a11012138186576316d040d92168c2122bf14210","unresolved":false,"context_lines":[{"line_number":1404,"context_line":"        \"\"\"Prevent ports with \u0027device-owner \u003d network:router_gateway\u0027."},{"line_number":1405,"context_line":"        Router gw has to be set by updating external_gateway_info."},{"line_number":1406,"context_line":"        Allowed only when port is created as part of router creation"},{"line_number":1407,"context_line":"        where tenant_id is \u0027\u0027."},{"line_number":1408,"context_line":""},{"line_number":1409,"context_line":"        Prevent tenants from replacing the device id of router"},{"line_number":1410,"context_line":"        ports with a router uuid belonging to another tenant."}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_cfa768bb","line":1407,"range":{"start_line":1407,"start_character":27,"end_line":1407,"end_character":29},"updated":"2016-03-23 23:21:46.000000000","message":"I don\u0027t like this.  An empty string is as much a \"magic constant\" as anything else.  Its meaning is unexplained except maybe where it is first produced [1] but it is difficult to tie this back to that.\n\nI know this patch didn\u0027t introduce this ugliness.  But, it\u0027s making the problem worse by keying off this magic value.  Make sense?\n\nWould you mind preceding this patch with a patch to refactor this constant into a constant called something like \"ROUTER_GW_TENANT_ID\"?  We can use that patch to be sure that we understand all the places where this value is already being used or depended on.\n\n [1] https://github.com/openstack/neutron/blob/92b4fcb440/neutron/db/l3_db.py#L305","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"a7b25bbdbe3a36167568033e0c20eeffb71433ac","unresolved":false,"context_lines":[{"line_number":1404,"context_line":"        \"\"\"Prevent ports with \u0027device-owner \u003d network:router_gateway\u0027."},{"line_number":1405,"context_line":"        Router gw has to be set by updating external_gateway_info."},{"line_number":1406,"context_line":"        Allowed only when port is created as part of router creation"},{"line_number":1407,"context_line":"        where tenant_id is \u0027\u0027."},{"line_number":1408,"context_line":""},{"line_number":1409,"context_line":"        Prevent tenants from replacing the device id of router"},{"line_number":1410,"context_line":"        ports with a router uuid belonging to another tenant."}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_a32944e8","line":1407,"range":{"start_line":1407,"start_character":27,"end_line":1407,"end_character":29},"in_reply_to":"fa0719c6_cfa768bb","updated":"2016-03-24 16:11:16.000000000","message":"Done. I\u0027ve made another patch https://review.openstack.org/#/c/297197/ and made this patch dependent on it. I don\u0027t think it\u0027ll affect any other area, also it makes the check better with the new constant added as you suggested.","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a11012138186576316d040d92168c2122bf14210","unresolved":false,"context_lines":[{"line_number":1410,"context_line":"        ports with a router uuid belonging to another tenant."},{"line_number":1411,"context_line":"        \"\"\""},{"line_number":1412,"context_line":"        if (device_owner \u003d\u003d constants.DEVICE_OWNER_ROUTER_GW and"},{"line_number":1413,"context_line":"            str(tenant_id) is not \u0027\u0027):"},{"line_number":1414,"context_line":"            raise n_exc.RouterGatewayPortCreationProhibited()"},{"line_number":1415,"context_line":""},{"line_number":1416,"context_line":"        if device_owner not in constants.ROUTER_INTERFACE_OWNERS:"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_2a6c12cf","line":1413,"range":{"start_line":1413,"start_character":12,"end_line":1413,"end_character":16},"updated":"2016-03-23 23:21:46.000000000","message":"The way this is written makes readers wonder why you have to coerce tenant_id to a string.  It also makes readers wonder if python strings with the same value are, in fact, the same object (they are due to string interning).  I\u0027m sure you\u0027re using str to avoid this kind of pitfall:\n\n  \u003e\u003e\u003e u\u0027\u0027 is \u0027\u0027\n  False\n  \u003e\u003e\u003e u\u0027\u0027 \u003d\u003d \u0027\u0027\n  True\n\nWhy not just use a simple comparison and avoid all this subtlety?  It certainly would reduce the cognitive load on the brain of many code readers.  :)\n\n  tenant_id !\u003d \u0027\u0027","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"a7b25bbdbe3a36167568033e0c20eeffb71433ac","unresolved":false,"context_lines":[{"line_number":1410,"context_line":"        ports with a router uuid belonging to another tenant."},{"line_number":1411,"context_line":"        \"\"\""},{"line_number":1412,"context_line":"        if (device_owner \u003d\u003d constants.DEVICE_OWNER_ROUTER_GW and"},{"line_number":1413,"context_line":"            str(tenant_id) is not \u0027\u0027):"},{"line_number":1414,"context_line":"            raise n_exc.RouterGatewayPortCreationProhibited()"},{"line_number":1415,"context_line":""},{"line_number":1416,"context_line":"        if device_owner not in constants.ROUTER_INTERFACE_OWNERS:"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_23bff461","line":1413,"range":{"start_line":1413,"start_character":12,"end_line":1413,"end_character":16},"in_reply_to":"fa0719c6_2a6c12cf","updated":"2016-03-24 16:11:16.000000000","message":"Sure, Done.","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"}],"neutron/plugins/common/utils.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"48c911d8c541873822d2b35631c08cdec625c518","unresolved":false,"context_lines":[{"line_number":127,"context_line":"                      p_const.PENDING_DELETE)"},{"line_number":128,"context_line":""},{"line_number":129,"context_line":""},{"line_number":130,"context_line":"def _fixup_res_dict(context, attr_name, res_dict, check_allow_post\u003dTrue):"},{"line_number":131,"context_line":"    attr_info \u003d attributes.RESOURCE_ATTRIBUTE_MAP[attr_name]"},{"line_number":132,"context_line":"    try:"},{"line_number":133,"context_line":"        attributes.populate_tenant_id(context, res_dict, attr_info, True)"}],"source_content_type":"text/x-python","patch_set":16,"id":"1a122d0e_b930e002","line":130,"range":{"start_line":130,"start_character":4,"end_line":130,"end_character":19},"updated":"2016-04-18 16:05:47.000000000","message":"I don\u0027t think this method should need to change either.  What is the code path that leads to this?  Is there a way to accomplish this in a less generic way?  I don\u0027t like complicating generic code with special one-off cases.","commit_id":"d3b70d259d0caa850a8966c39aca2bade8f8c8f8"}],"neutron/tests/unit/db/test_db_base_plugin_v2.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a11012138186576316d040d92168c2122bf14210","unresolved":false,"context_lines":[{"line_number":378,"context_line":"    def _create_port(self, fmt, net_id, expected_res_status\u003dNone,"},{"line_number":379,"context_line":"                     arg_list\u003dNone, set_context\u003dFalse, tenant_id\u003dNone,"},{"line_number":380,"context_line":"                     **kwargs):"},{"line_number":381,"context_line":"        if (\u0027device_owner\u0027 in kwargs and"},{"line_number":382,"context_line":"            kwargs[\u0027device_owner\u0027] \u003d\u003d constants.DEVICE_OWNER_ROUTER_GW):"},{"line_number":383,"context_line":"            _tenant_id \u003d \u0027\u0027"},{"line_number":384,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_4f7b5828","line":381,"updated":"2016-03-23 23:21:46.000000000","message":"This is a bit cleaner:\n\n  if kwargs.get(\u0027device_owner\u0027) \u003d\u003d constants.DEVICE_OWNER_ROUTER_GW:","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"a7b25bbdbe3a36167568033e0c20eeffb71433ac","unresolved":false,"context_lines":[{"line_number":378,"context_line":"    def _create_port(self, fmt, net_id, expected_res_status\u003dNone,"},{"line_number":379,"context_line":"                     arg_list\u003dNone, set_context\u003dFalse, tenant_id\u003dNone,"},{"line_number":380,"context_line":"                     **kwargs):"},{"line_number":381,"context_line":"        if (\u0027device_owner\u0027 in kwargs and"},{"line_number":382,"context_line":"            kwargs[\u0027device_owner\u0027] \u003d\u003d constants.DEVICE_OWNER_ROUTER_GW):"},{"line_number":383,"context_line":"            _tenant_id \u003d \u0027\u0027"},{"line_number":384,"context_line":"        else:"}],"source_content_type":"text/x-python","patch_set":13,"id":"fa0719c6_636c4c08","line":381,"in_reply_to":"fa0719c6_4f7b5828","updated":"2016-03-24 16:11:16.000000000","message":"Done","commit_id":"a28756fd114a2b81f494f3ab86ea4935dcc8a675"}],"neutron/tests/unit/extensions/test_l3.py":[{"author":{"_account_id":13667,"name":"ZongKai LI","email":"onionpiece@163.com","username":"lzklibj"},"change_message_id":"d441404873cd5c8568104de87ea50ec5bf7fb6ee","unresolved":false,"context_lines":[{"line_number":2709,"context_line":"                    kwargs \u003d {"},{"line_number":2710,"context_line":"                        \u0027device_owner\u0027: l3_constants.DEVICE_OWNER_ROUTER_GW,"},{"line_number":2711,"context_line":"                        \u0027device_id\u0027: \u0027fake_device\u0027,"},{"line_number":2712,"context_line":"                        \u0027tenant_id\u0027: \u0027\u0027}"},{"line_number":2713,"context_line":"                    with self.port(subnet\u003dsubnet, **kwargs):"},{"line_number":2714,"context_line":"                        data \u003d {\u0027subnet\u0027: {\u0027gateway_ip\u0027: \u0027120.0.0.2\u0027}}"},{"line_number":2715,"context_line":"                        req \u003d self.new_update_request(\u0027subnets\u0027, data,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_da81314f","line":2712,"updated":"2016-02-03 03:09:30.000000000","message":"I don\u0027t think it\u0027s a good solution to set \u0027tenant_id\u0027 as \u0027\u0027 in every where NeutronDbPluginV2TestCase.port is called.\nWhy not adding a checking for device_owner in NeutronDbPluginV2TestCase.port to override tenent_id.","commit_id":"fb07dbec4d85b1027e6ac3ac45d38f674e7d0d40"},{"author":{"_account_id":18289,"name":"Sreekumar S","email":"sreesiv@gmail.com","username":"sreesiv"},"change_message_id":"ab0709729bd93c5be7983abe64531da72ea548c3","unresolved":false,"context_lines":[{"line_number":2709,"context_line":"                    kwargs \u003d {"},{"line_number":2710,"context_line":"                        \u0027device_owner\u0027: l3_constants.DEVICE_OWNER_ROUTER_GW,"},{"line_number":2711,"context_line":"                        \u0027device_id\u0027: \u0027fake_device\u0027,"},{"line_number":2712,"context_line":"                        \u0027tenant_id\u0027: \u0027\u0027}"},{"line_number":2713,"context_line":"                    with self.port(subnet\u003dsubnet, **kwargs):"},{"line_number":2714,"context_line":"                        data \u003d {\u0027subnet\u0027: {\u0027gateway_ip\u0027: \u0027120.0.0.2\u0027}}"},{"line_number":2715,"context_line":"                        req \u003d self.new_update_request(\u0027subnets\u0027, data,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5a5ae5dd_3a59125b","line":2712,"in_reply_to":"5a5ae5dd_da81314f","updated":"2016-02-04 11:57:19.000000000","message":"Done","commit_id":"fb07dbec4d85b1027e6ac3ac45d38f674e7d0d40"}]}
