)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"f37488f3ed0b8e839697c17a9cd2416c7c75060d","unresolved":false,"context_lines":[{"line_number":11,"context_line":"then select the router with subnet\u0027s gateway_ip, if available,"},{"line_number":12,"context_line":"for managing floatingip."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"2) Otherwise go with default existing behavior i.e"},{"line_number":15,"context_line":"select first router in internal subnet, that also present on external network."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"For scenario 1), if the router with gateway ip not selected,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ba15a1d1_c947afba","line":14,"updated":"2015-09-16 17:37:46.000000000","message":"Would it be simpler to just change the default behavior to always consider the default route?  Shouldn\u0027t we always select the router with the gateway for a floating ip even when there aren\u0027t multiple?\n\nCouldn\u0027t this make the code less conditional and therefore simpler?","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"222858bbf20e47c62b5e036e591d6da10187f8de","unresolved":false,"context_lines":[{"line_number":11,"context_line":"then select the router with subnet\u0027s gateway_ip, if available,"},{"line_number":12,"context_line":"for managing floatingip."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"2) Otherwise go with default existing behavior i.e"},{"line_number":15,"context_line":"select first router in internal subnet, that also present on external network."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"For scenario 1), if the router with gateway ip not selected,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ba15a1d1_0e271113","line":14,"in_reply_to":"ba15a1d1_98e2a300","updated":"2015-09-22 17:36:38.000000000","message":"I see where you\u0027re coming from.  I just replied to the ML to get some more input.  Let\u0027s wait another day or two for more feedback to roll in.  Ping me then.","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"374b0a6aa8647544f5da4d7f9850f4310fab51e6","unresolved":false,"context_lines":[{"line_number":11,"context_line":"then select the router with subnet\u0027s gateway_ip, if available,"},{"line_number":12,"context_line":"for managing floatingip."},{"line_number":13,"context_line":""},{"line_number":14,"context_line":"2) Otherwise go with default existing behavior i.e"},{"line_number":15,"context_line":"select first router in internal subnet, that also present on external network."},{"line_number":16,"context_line":""},{"line_number":17,"context_line":"For scenario 1), if the router with gateway ip not selected,"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"ba15a1d1_98e2a300","line":14,"in_reply_to":"ba15a1d1_c947afba","updated":"2015-09-22 08:10:27.000000000","message":"Thanks Carl.\nI have posted on OpenStack-dev list for the opinion.\nhttp://lists.openstack.org/pipermail/openstack-dev/2015-September/075051.html\n\nI am not sure about the use cases of user using multiple routers on same subnet. But I think in this scenario user might be manually configuring the routes in vms and routers.\n \nHere, I am giving preference to router with subnet\u0027s default gateway(if this router is also connected to external network which router has requested for floatingip). \nIf no such router is available I don\u0027t want to break any existing functionality and any other use cases which I am not aware of.","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"}],"neutron/db/l3_db.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"662b98d2e0796baf9f1dcc9e40cc983a88e014a9","unresolved":false,"context_lines":[{"line_number":805,"context_line":"        try:"},{"line_number":806,"context_line":"            routerport \u003d routerport_qry.filter("},{"line_number":807,"context_line":"                models_v2.IPAllocation.ip_address \u003d\u003d subnet[\u0027gateway_ip\u0027]"},{"line_number":808,"context_line":"            ).one()"},{"line_number":809,"context_line":"            router_id \u003d routerport.router.id"},{"line_number":810,"context_line":"        except exc.NoResultFound:"},{"line_number":811,"context_line":"            router_id \u003d None"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_3c6da732","line":808,"updated":"2015-10-13 03:27:55.000000000","message":"query","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"f37488f3ed0b8e839697c17a9cd2416c7c75060d","unresolved":false,"context_lines":[{"line_number":808,"context_line":"            ).one()"},{"line_number":809,"context_line":"            router_id \u003d routerport.router.id"},{"line_number":810,"context_line":"        except exc.NoResultFound:"},{"line_number":811,"context_line":"            router_id \u003d None"},{"line_number":812,"context_line":""},{"line_number":813,"context_line":"        gw_ports_qry \u003d context.session.query(models_v2.Port)"},{"line_number":814,"context_line":"        gw_ports \u003d gw_ports_qry.filter_by("}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_c991eff2","line":811,"updated":"2015-09-16 17:37:46.000000000","message":"Couldn\u0027t we just stop here and simplify some of the rest of the code?  Any router we find after this is going to be the wrong one for a floating ip, right?","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"fc79db6738cf2ed7d55e681830efe10034fe923b","unresolved":false,"context_lines":[{"line_number":808,"context_line":"            ).one()"},{"line_number":809,"context_line":"            router_id \u003d routerport.router.id"},{"line_number":810,"context_line":"        except exc.NoResultFound:"},{"line_number":811,"context_line":"            router_id \u003d None"},{"line_number":812,"context_line":""},{"line_number":813,"context_line":"        gw_ports_qry \u003d context.session.query(models_v2.Port)"},{"line_number":814,"context_line":"        gw_ports \u003d gw_ports_qry.filter_by("}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_efd2c2ff","line":811,"updated":"2015-09-23 08:49:41.000000000","message":"I had similar issue before and then workaround by adding extra route to vm. So, even if it is a corner case, I think it is valuable. \n\nMy suggestion to this code would be:\n1) change the var name \"router_id\" here to something like \"router_with_gwip_id\". It confused me with the \"router_id\" at line 828, at my first glance.\n2) looks like you want to select router with default gateway ip, as well as keep the original logic no touched. So why not try this code structure:\n\n    \u003cfind the routers that connect internal net and the external net\u003e\n\n    if \u003cfrom there routers, find the router with subnet gatewayip\u003e\n        \u003creturn that router id\u003e\n    else \n        \u003creturn the first router\u0027s id, as old code do\u003e","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"662b98d2e0796baf9f1dcc9e40cc983a88e014a9","unresolved":false,"context_lines":[{"line_number":808,"context_line":"            ).one()"},{"line_number":809,"context_line":"            router_id \u003d routerport.router.id"},{"line_number":810,"context_line":"        except exc.NoResultFound:"},{"line_number":811,"context_line":"            router_id \u003d None"},{"line_number":812,"context_line":""},{"line_number":813,"context_line":"        gw_ports_qry \u003d context.session.query(models_v2.Port)"},{"line_number":814,"context_line":"        gw_ports \u003d gw_ports_qry.filter_by("}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_1c69cb8b","line":811,"in_reply_to":"9a1a9d01_376a3482","updated":"2015-10-13 03:27:55.000000000","message":"In general, I like Hong Hui\u0027s outline of how this algorithm should work.\n\nIf this were plain old sql, you could find this result with a single sql statement by aliasing the table twice and using different criteria on each alias:  Port AS ExternalPort, Port AS InternalPort WHERE ExternalPort.device_id \u003d InternalPort.device_id, etc.  My sqlalchemy is not strong enough to show you how this would work there, but I\u0027ve done stuff like this before.  If you get stuck, you could ping me on IRC and maybe we can figure it out or get someone online to help out.","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"374b0a6aa8647544f5da4d7f9850f4310fab51e6","unresolved":false,"context_lines":[{"line_number":808,"context_line":"            ).one()"},{"line_number":809,"context_line":"            router_id \u003d routerport.router.id"},{"line_number":810,"context_line":"        except exc.NoResultFound:"},{"line_number":811,"context_line":"            router_id \u003d None"},{"line_number":812,"context_line":""},{"line_number":813,"context_line":"        gw_ports_qry \u003d context.session.query(models_v2.Port)"},{"line_number":814,"context_line":"        gw_ports \u003d gw_ports_qry.filter_by("}],"source_content_type":"text/x-python","patch_set":2,"id":"ba15a1d1_d8dfbb38","line":811,"in_reply_to":"ba15a1d1_c991eff2","updated":"2015-09-22 08:10:27.000000000","message":"I will be happy to choose always the router with sunet\u0027s gateway ip in all cases. \n\n[carl]\nAny router we find after this is going to be the wrong one for a floating ip, right?\n[Anil]\nYes, agree with you, unless user has configured routes manually in vms and routers.\n\nIf the routers are connected to multiple external networks, user may request neutron to use external network, which is not connected to router with subnet\u0027s default  gateway.\n\nIn this case default behavior(L821-828) are required.","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"a17efb28106e89df515b953accdc0fbd47c62e75","unresolved":false,"context_lines":[{"line_number":808,"context_line":"            ).one()"},{"line_number":809,"context_line":"            router_id \u003d routerport.router.id"},{"line_number":810,"context_line":"        except exc.NoResultFound:"},{"line_number":811,"context_line":"            router_id \u003d None"},{"line_number":812,"context_line":""},{"line_number":813,"context_line":"        gw_ports_qry \u003d context.session.query(models_v2.Port)"},{"line_number":814,"context_line":"        gw_ports \u003d gw_ports_qry.filter_by("}],"source_content_type":"text/x-python","patch_set":2,"id":"9a1a9d01_376a3482","line":811,"in_reply_to":"ba15a1d1_efd2c2ff","updated":"2015-10-01 08:58:57.000000000","message":"Thanks Hong Hui\n\nIn your algorithm\n \u003cfind the routers that connect internal net and the external net\u003e \n\nI guess this can\u0027t be achieved through one context.session object of (join of related) tables because in the query network_id of port can\u0027t match with desired external and internal network at same time. So It needs 2 context.session objects, which the current code is using.\n\nSo I think both the existing code and my changes are fine  and no need to have any new algorithm.\n\nCan you kindly explain your previous use case where we had this issue?\n\nI will also look at changing router_id to router_with_gwip_id or similar name.","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"662b98d2e0796baf9f1dcc9e40cc983a88e014a9","unresolved":false,"context_lines":[{"line_number":818,"context_line":"        # if router with subnet\u0027s gateway-ip exits on requested external"},{"line_number":819,"context_line":"        # netowrk return that, otherwise return first router from internal"},{"line_number":820,"context_line":"        # network which is also present on external network"},{"line_number":821,"context_line":"        if gw_ports.count():"},{"line_number":822,"context_line":"            if router_id and gw_ports.filter_by(device_id\u003drouter_id).count():"},{"line_number":823,"context_line":"                return router_id"},{"line_number":824,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_3c260717","line":821,"updated":"2015-10-13 03:27:55.000000000","message":"query","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"662b98d2e0796baf9f1dcc9e40cc983a88e014a9","unresolved":false,"context_lines":[{"line_number":819,"context_line":"        # netowrk return that, otherwise return first router from internal"},{"line_number":820,"context_line":"        # network which is also present on external network"},{"line_number":821,"context_line":"        if gw_ports.count():"},{"line_number":822,"context_line":"            if router_id and gw_ports.filter_by(device_id\u003drouter_id).count():"},{"line_number":823,"context_line":"                return router_id"},{"line_number":824,"context_line":""},{"line_number":825,"context_line":"            for router_port in routerport_qry:"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_1c1d4bbd","line":822,"updated":"2015-10-13 03:27:55.000000000","message":"query","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"662b98d2e0796baf9f1dcc9e40cc983a88e014a9","unresolved":false,"context_lines":[{"line_number":822,"context_line":"            if router_id and gw_ports.filter_by(device_id\u003drouter_id).count():"},{"line_number":823,"context_line":"                return router_id"},{"line_number":824,"context_line":""},{"line_number":825,"context_line":"            for router_port in routerport_qry:"},{"line_number":826,"context_line":"                router_id \u003d router_port.router.id"},{"line_number":827,"context_line":"                if gw_ports.filter_by(device_id\u003drouter_id).count():"},{"line_number":828,"context_line":"                    return router_id"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_9c395b44","line":825,"updated":"2015-10-13 03:27:55.000000000","message":"query\n\nWhat does this do given that we already called .one() on the query on L808?","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"662b98d2e0796baf9f1dcc9e40cc983a88e014a9","unresolved":false,"context_lines":[{"line_number":824,"context_line":""},{"line_number":825,"context_line":"            for router_port in routerport_qry:"},{"line_number":826,"context_line":"                router_id \u003d router_port.router.id"},{"line_number":827,"context_line":"                if gw_ports.filter_by(device_id\u003drouter_id).count():"},{"line_number":828,"context_line":"                    return router_id"},{"line_number":829,"context_line":""},{"line_number":830,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_dc7d93e8","line":827,"updated":"2015-10-13 03:27:55.000000000","message":"query","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"7308bf8a901fbf01055c8e2affd0a704a2c957a8","unresolved":false,"context_lines":[{"line_number":825,"context_line":"            for router_port in routerport_qry:"},{"line_number":826,"context_line":"                router_id \u003d router_port.router.id"},{"line_number":827,"context_line":"                if gw_ports.filter_by(device_id\u003drouter_id).count():"},{"line_number":828,"context_line":"                    return router_id"},{"line_number":829,"context_line":""},{"line_number":830,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":831,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_d65cb9ef","line":828,"updated":"2015-10-05 18:00:39.000000000","message":"Carl, Can I add a warning here(between L827-L828) saying \"router with subnet\u0027s gateway-ip not choosen for floating ip\"?","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"662b98d2e0796baf9f1dcc9e40cc983a88e014a9","unresolved":false,"context_lines":[{"line_number":825,"context_line":"            for router_port in routerport_qry:"},{"line_number":826,"context_line":"                router_id \u003d router_port.router.id"},{"line_number":827,"context_line":"                if gw_ports.filter_by(device_id\u003drouter_id).count():"},{"line_number":828,"context_line":"                    return router_id"},{"line_number":829,"context_line":""},{"line_number":830,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":831,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":2,"id":"7a2fa921_4b2a1e2e","line":828,"in_reply_to":"7a2fa921_d65cb9ef","updated":"2015-10-13 03:27:55.000000000","message":"No, if it goes to the log file, the user won\u0027t see it and the operator is not likely to care.","commit_id":"d4fed8f0eef4fb992bbef08945931ad85dc6032e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"4315d331ba2d3289aaf475009a867bdb4133ee95","unresolved":false,"context_lines":[{"line_number":812,"context_line":"        try:"},{"line_number":813,"context_line":"            routerport \u003d routerport_qry.filter("},{"line_number":814,"context_line":"                models_v2.IPAllocation.ip_address \u003d\u003d subnet[\u0027gateway_ip\u0027]"},{"line_number":815,"context_line":"            ).one()"},{"line_number":816,"context_line":"        except exc.NoResultFound:"},{"line_number":817,"context_line":"            routerport \u003d routerport_qry.first()"},{"line_number":818,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_16762b06","line":815,"updated":"2015-12-07 19:09:59.000000000","message":"I think this is still two round trips to the database in the case where this first query fails.  I wonder if it would be better to just grab all the results without this particular filter with one round trip to the db and then look through the results in memory for the one that has the gateway.","commit_id":"1b1ed84e7d373afc3af666cea61ed36090b2c052"},{"author":{"_account_id":11682,"name":"Ryan Moats","email":"rmoats@us.ibm.com","username":"regXboi"},"change_message_id":"9f7afb9ee3dbfbf72a59d20b98102f6bddec69ed","unresolved":false,"context_lines":[{"line_number":812,"context_line":"        try:"},{"line_number":813,"context_line":"            routerport \u003d routerport_qry.filter("},{"line_number":814,"context_line":"                models_v2.IPAllocation.ip_address \u003d\u003d subnet[\u0027gateway_ip\u0027]"},{"line_number":815,"context_line":"            ).one()"},{"line_number":816,"context_line":"        except exc.NoResultFound:"},{"line_number":817,"context_line":"            routerport \u003d routerport_qry.first()"},{"line_number":818,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"7a740942_c9d5641c","line":815,"in_reply_to":"7a740942_16762b06","updated":"2015-12-07 19:19:33.000000000","message":"I read the code the same way ...","commit_id":"1b1ed84e7d373afc3af666cea61ed36090b2c052"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"d299e964efa40a8eabea27b77a8e114ed89c53af","unresolved":false,"context_lines":[{"line_number":797,"context_line":"                     \u0027which has no gateway_ip\u0027) % internal_subnet_id)"},{"line_number":798,"context_line":"            raise n_exc.BadRequest(resource\u003d\u0027floatingip\u0027, msg\u003dmsg)"},{"line_number":799,"context_line":""},{"line_number":800,"context_line":"        # Find routers( with router_id and interface address) that"},{"line_number":801,"context_line":"        # connect given internal subnet and the external network."},{"line_number":802,"context_line":"        # Among them, if the router\u0027s interface address matches"},{"line_number":803,"context_line":"        # with subnet\u0027s gateway-ip, return that router."}],"source_content_type":"text/x-python","patch_set":4,"id":"7a740942_cb0ae625","line":800,"updated":"2015-12-09 03:54:50.000000000","message":"Extra space here \"routers( with\"","commit_id":"f7e978fc339759696f082877b095e218f1bab220"}],"neutron/tests/unit/extensions/test_l3.py":[{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"d299e964efa40a8eabea27b77a8e114ed89c53af","unresolved":false,"context_lines":[{"line_number":2350,"context_line":"                                     r2[\u0027router\u0027][\u0027id\u0027])"},{"line_number":2351,"context_line":""},{"line_number":2352,"context_line":"    def test_floatingip_same_external_and_internal(self):"},{"line_number":2353,"context_line":"        # select router with subnet\u0027s gateway_ip for floatingip when"},{"line_number":2354,"context_line":"        # routers connected to same subnet and external network."},{"line_number":2355,"context_line":"        with self.subnet(cidr\u003d\"10.0.0.0/24\") as exs,\\"},{"line_number":2356,"context_line":"                self.subnet(cidr\u003d\"12.0.0.0/24\", gateway_ip\u003d\"12.0.0.50\") as ins:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a740942_0bb8ee73","line":2353,"updated":"2015-12-09 03:54:50.000000000","message":"capitalize the first letter","commit_id":"f7e978fc339759696f082877b095e218f1bab220"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"d299e964efa40a8eabea27b77a8e114ed89c53af","unresolved":false,"context_lines":[{"line_number":2382,"context_line":"                    fp \u003d self._make_floatingip(self.fmt, network_ex_id,"},{"line_number":2383,"context_line":"                                            private_port[\u0027port\u0027][\u0027id\u0027],"},{"line_number":2384,"context_line":"                                            floating_ip\u003d\u002710.0.0.8\u0027)"},{"line_number":2385,"context_line":"                    self.assertEqual(fp[\u0027floatingip\u0027][\u0027router_id\u0027],"},{"line_number":2386,"context_line":"                                     r1[\u0027router\u0027][\u0027id\u0027])"},{"line_number":2387,"context_line":""},{"line_number":2388,"context_line":"    def test_floatingip_delete_router_intf_with_subnet_id_returns_409(self):"}],"source_content_type":"text/x-python","patch_set":4,"id":"7a740942_0b6f8efc","line":2385,"updated":"2015-12-09 03:54:50.000000000","message":"The pattern here should be self.assertEqual(expected, observed)","commit_id":"f7e978fc339759696f082877b095e218f1bab220"}]}
