)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"243cca6d48ac0fe9657760475fff0bde01eac602","unresolved":false,"context_lines":[{"line_number":14,"context_line":"Having duplicates is odd and leads to problems during sync_routers."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Change-Id: I7ac2283752deaa3d9601b83859a46b9e89940269"},{"line_number":17,"context_line":"Partial-bug: #1499647"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"3a7e1126_5388ef70","line":17,"range":{"start_line":17,"start_character":14,"end_line":17,"end_character":21},"updated":"2015-12-22 04:02:54.000000000","message":"As I describe in bug #1523780, this patch you made may help to fix that too. And Partial-bug #1523780.","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"}],"neutron/db/migration/alembic_migrations/versions/mitaka/expand/1df244e556f5_add_unique_ha_router_agent_port_bindings.py":[{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"a888e05a64b8e991a40db2ddfcc226dca04a13f5","unresolved":false,"context_lines":[{"line_number":13,"context_line":"#    under the License."},{"line_number":14,"context_line":"#"},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"\"\"\"add_unique_ha_router_agent_port_bindings"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Revision ID: 1df244e556f5"},{"line_number":19,"context_line":"Revises: 34af2b5c5a59"}],"source_content_type":"text/x-python","patch_set":2,"id":"1a26ad4f_bbce2b2b","line":16,"updated":"2015-11-02 15:43:24.000000000","message":"Nit: this could be a normal sentence.","commit_id":"e277978962cb72603af159acbef795dd96893ec6"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"a888e05a64b8e991a40db2ddfcc226dca04a13f5","unresolved":false,"context_lines":[{"line_number":16,"context_line":"\"\"\"add_unique_ha_router_agent_port_bindings"},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"Revision ID: 1df244e556f5"},{"line_number":19,"context_line":"Revises: 34af2b5c5a59"},{"line_number":20,"context_line":"Create Date: 2015-10-02 18:06:01.696742"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"\"\"\""}],"source_content_type":"text/x-python","patch_set":2,"id":"1a26ad4f_bb9ceb0e","line":19,"updated":"2015-11-02 15:43:24.000000000","message":"Nit: should be 59cb5b6cf4d","commit_id":"e277978962cb72603af159acbef795dd96893ec6"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ce1227a03d20c132212bf28217b8e210eb5a09e8","unresolved":false,"context_lines":[{"line_number":41,"context_line":""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"class DuplicateL3HARouterAgentPortBinding(exceptions.Conflict):"},{"line_number":44,"context_line":"    message \u003d _(\"Duplicate L3HARouterAgentPortBinding is created for router(s)\""},{"line_number":45,"context_line":"                \" %(router)s. Database cannot be upgraded. Please, remove all \""},{"line_number":46,"context_line":"                \"duplicates before upgrading the database.\")"},{"line_number":47,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"ba8a016a_02118cac","line":44,"updated":"2015-11-16 14:31:48.000000000","message":"sorry for being pedantic here but please have spaces at the end or begining of lines (I prefer at the end)","commit_id":"9653b7d7694f01ce9da11ddf951d2745ce7831fc"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"b5511e624b7cf7d0a35f6c097601c4c64e1ce624","unresolved":false,"context_lines":[{"line_number":41,"context_line":""},{"line_number":42,"context_line":""},{"line_number":43,"context_line":"class DuplicateL3HARouterAgentPortBinding(exceptions.Conflict):"},{"line_number":44,"context_line":"    message \u003d _(\"Duplicate L3HARouterAgentPortBinding is created for router(s)\""},{"line_number":45,"context_line":"                \" %(router)s. Database cannot be upgraded. Please, remove all \""},{"line_number":46,"context_line":"                \"duplicates before upgrading the database.\")"},{"line_number":47,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"ba8a016a_0573d6b2","line":44,"in_reply_to":"ba8a016a_02118cac","updated":"2015-11-16 14:36:55.000000000","message":"very pedantic :)\nDone","commit_id":"9653b7d7694f01ce9da11ddf951d2745ce7831fc"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"7e34a874f99c7996c430f218eba44b933d77d816","unresolved":false,"context_lines":[{"line_number":52,"context_line":""},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"def check_sanity(connection):"},{"line_number":55,"context_line":"    res \u003d get_duplicate_l3_ha_port_bindings(connection)"},{"line_number":56,"context_line":"    if res:"},{"line_number":57,"context_line":"        raise DuplicateL3HARouterAgentPortBinding(router\u003d\", \".join(res))"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"fa69d971_c7e95f80","line":55,"updated":"2016-01-07 08:31:12.000000000","message":"would it be better to just delete the duplicate? or is it possible that each one has a different port_id somehow?","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"0df55d5414814c472106496b80f5d9266902c68f","unresolved":false,"context_lines":[{"line_number":52,"context_line":""},{"line_number":53,"context_line":""},{"line_number":54,"context_line":"def check_sanity(connection):"},{"line_number":55,"context_line":"    res \u003d get_duplicate_l3_ha_port_bindings(connection)"},{"line_number":56,"context_line":"    if res:"},{"line_number":57,"context_line":"        raise DuplicateL3HARouterAgentPortBinding(router\u003d\", \".join(res))"},{"line_number":58,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"fa69d971_ef40ae09","line":55,"in_reply_to":"fa69d971_c7e95f80","updated":"2016-01-08 07:52:19.000000000","message":"The tricky thing that yes, I\u0027ve got the following situation - http://paste.openstack.org/show/483302/ This is described in bug description.","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"}],"neutron/scheduler/l3_agent_scheduler.py":[{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"d54b143acb2ac8d2f34587a729df254d02d13a34","unresolved":false,"context_lines":[{"line_number":292,"context_line":"                                tenant_id, agent):"},{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"da85f559_c8c0cf52","line":295,"updated":"2015-11-11 23:09:18.000000000","message":"What do you think about adding this try/except in l3_hamode_db._create_ha_port_binding? It\u0027s the only place we commit a new a L3HARouterAgentPortBinding. Is it correct to always ignore DBDuplicateEntry, in all cases? If so it\u0027s simpler.","commit_id":"52cce4f310431747e30324bb4103e2bfc1b9891c"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"48e89290ba2dea3f19b00a49a058789525652e03","unresolved":false,"context_lines":[{"line_number":292,"context_line":"                                tenant_id, agent):"},{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"ba8a016a_ea2a2be7","line":295,"in_reply_to":"da85f559_25afdd7e","updated":"2015-11-16 11:07:46.000000000","message":"Done","commit_id":"52cce4f310431747e30324bb4103e2bfc1b9891c"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"d77f1d79a14ae0daa280dd5a48f615a6764a96cf","unresolved":false,"context_lines":[{"line_number":292,"context_line":"                                tenant_id, agent):"},{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"da85f559_25afdd7e","line":295,"in_reply_to":"da85f559_5cb9f3ca","updated":"2015-11-13 14:59:54.000000000","message":"\u003e but I can add try/except there too.\n\nI think that would be desirable.","commit_id":"52cce4f310431747e30324bb4103e2bfc1b9891c"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"f0523347232ed118ed46cbc6e38f42b36da476e8","unresolved":false,"context_lines":[{"line_number":292,"context_line":"                                tenant_id, agent):"},{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"}],"source_content_type":"text/x-python","patch_set":4,"id":"da85f559_5cb9f3ca","line":295,"in_reply_to":"da85f559_c8c0cf52","updated":"2015-11-12 08:26:22.000000000","message":"In _create_ha_port_binding L3HARouterAgentPortBinding is created with l3_agent_id\u003dNone and agent id is added here, so exception will be thrown here. Did I miss something?\n\nagent_id is also added in _bind_ha_router_to_agents, but during testing I saw exception has been thrown only in create_ha_port_and_bind, but I can add try/except there too.","commit_id":"52cce4f310431747e30324bb4103e2bfc1b9891c"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ce1227a03d20c132212bf28217b8e210eb5a09e8","unresolved":false,"context_lines":[{"line_number":299,"context_line":"                    tenant_id)"},{"line_number":300,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":301,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":302,"context_line":"            LOG.debug(_(\"Router %(router)s already scheduled for agent \""},{"line_number":303,"context_line":"                        \"%(agent)s\"), {\u0027router\u0027: router_id,"},{"line_number":304,"context_line":"                                       \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":305,"context_line":"        self.bind_router(context, router_id, agent)"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba8a016a_0288ace6","line":302,"updated":"2015-11-16 14:31:48.000000000","message":"debug messaage does not require a translation","commit_id":"9653b7d7694f01ce9da11ddf951d2745ce7831fc"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"b5511e624b7cf7d0a35f6c097601c4c64e1ce624","unresolved":false,"context_lines":[{"line_number":299,"context_line":"                    tenant_id)"},{"line_number":300,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":301,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":302,"context_line":"            LOG.debug(_(\"Router %(router)s already scheduled for agent \""},{"line_number":303,"context_line":"                        \"%(agent)s\"), {\u0027router\u0027: router_id,"},{"line_number":304,"context_line":"                                       \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":305,"context_line":"        self.bind_router(context, router_id, agent)"}],"source_content_type":"text/x-python","patch_set":5,"id":"ba8a016a_c565cee1","line":302,"in_reply_to":"ba8a016a_0288ace6","updated":"2015-11-16 14:36:55.000000000","message":"Done","commit_id":"9653b7d7694f01ce9da11ddf951d2745ce7831fc"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"ce1227a03d20c132212bf28217b8e210eb5a09e8","unresolved":false,"context_lines":[{"line_number":339,"context_line":"                    port_binding.l3_agent_id \u003d agent.id"},{"line_number":340,"context_line":"                    self.bind_router(context, router_id, agent)"},{"line_number":341,"context_line":"            except db_exc.DBDuplicateEntry:"},{"line_number":342,"context_line":"                LOG.debug(_(\"Router %(router)s already scheduled for agent \""},{"line_number":343,"context_line":"                            \"%(agent)s\"), {\u0027router\u0027: router_id,"},{"line_number":344,"context_line":"                                           \u0027agent\u0027: agent.id})"},{"line_number":345,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"ba8a016a_c26aa41a","line":342,"updated":"2015-11-16 14:31:48.000000000","message":"ditto","commit_id":"9653b7d7694f01ce9da11ddf951d2745ce7831fc"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"b5511e624b7cf7d0a35f6c097601c4c64e1ce624","unresolved":false,"context_lines":[{"line_number":339,"context_line":"                    port_binding.l3_agent_id \u003d agent.id"},{"line_number":340,"context_line":"                    self.bind_router(context, router_id, agent)"},{"line_number":341,"context_line":"            except db_exc.DBDuplicateEntry:"},{"line_number":342,"context_line":"                LOG.debug(_(\"Router %(router)s already scheduled for agent \""},{"line_number":343,"context_line":"                            \"%(agent)s\"), {\u0027router\u0027: router_id,"},{"line_number":344,"context_line":"                                           \u0027agent\u0027: agent.id})"},{"line_number":345,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"ba8a016a_6562e2da","line":342,"in_reply_to":"ba8a016a_c26aa41a","updated":"2015-11-16 14:36:55.000000000","message":"Done","commit_id":"9653b7d7694f01ce9da11ddf951d2745ce7831fc"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"af48edc55d8c0c5318c5274c0cf907b0245deb15","unresolved":false,"context_lines":[{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"},{"line_number":299,"context_line":"                    tenant_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a7e1126_5dc907ab","line":296,"range":{"start_line":296,"start_character":39,"end_line":296,"end_character":54},"updated":"2015-12-21 10:17:55.000000000","message":"Here must catch the DBReferenceError: (IntegrityError). At same time this session begin can be removed, (or do revert the patch \"Add UniqueConstraint in L3HARouterAgentPortBinding\").","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"27aa4ece0da9d6a0b125c0295577412ab0fd886e","unresolved":false,"context_lines":[{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"},{"line_number":299,"context_line":"                    tenant_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a7e1126_a81b0b80","line":296,"range":{"start_line":296,"start_character":39,"end_line":296,"end_character":54},"in_reply_to":"3a7e1126_5dc907ab","updated":"2015-12-21 10:49:57.000000000","message":"Have you tested this? Because during my testing this vesrion works ok. What do mean by \"do revert the patch \"Add UniqueConstraint in L3HARouterAgentPortBinding\"\"","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"46ac1c9870010fe9c1479319bd368a1fa17698e6","unresolved":false,"context_lines":[{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"},{"line_number":299,"context_line":"                    tenant_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a7e1126_c2388fd5","line":296,"range":{"start_line":296,"start_character":39,"end_line":296,"end_character":54},"in_reply_to":"3a7e1126_a81b0b80","updated":"2015-12-22 01:49:19.000000000","message":"Yes, I\u0027ve test this, but only this patch, without it\u0027s parent patch #230481. As I commented above, do some works here  (and line #342): 1.catch DBReferenceError  2. remove the session begin (something like you\u0027ve done in _set_vr_id in patch #230481), then everything works fine. I considered that race between HA router create and HA router delete was still there (bug #1523780). And my mistake, it was do revert \"Add transaction for setting agent_id in L3HARouterAgentPortBinding\".","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"2d8919adc67476c0db7728fc516a232842a2d795","unresolved":false,"context_lines":[{"line_number":293,"context_line":"        \"\"\"Creates and binds a new HA port for this agent.\"\"\""},{"line_number":294,"context_line":"        ha_network \u003d plugin.get_ha_network(context, tenant_id)"},{"line_number":295,"context_line":"        try:"},{"line_number":296,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":297,"context_line":"                port_binding \u003d plugin.add_ha_port("},{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"},{"line_number":299,"context_line":"                    tenant_id)"}],"source_content_type":"text/x-python","patch_set":11,"id":"3a7e1126_89df0ad5","line":296,"range":{"start_line":296,"start_character":39,"end_line":296,"end_character":54},"in_reply_to":"3a7e1126_c2388fd5","updated":"2015-12-22 06:29:25.000000000","message":"Please, test both patches. And removing session for _set_vr_id is big difference with current one. This is not a solution for all cases.","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"68d7cf529b21b3996eb22926bb66df273a86692e","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"},{"line_number":299,"context_line":"                    tenant_id)"},{"line_number":300,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":301,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":302,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":303,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":304,"context_line":"        self.bind_router(context, router_id, agent)"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a7b0d38_559ae515","line":301,"updated":"2015-12-23 06:11:45.000000000","message":"Will it be more appropriate to add this exception handler to [1], where the exception may start. \n\n[1] https://github.com/openstack/neutron/blob/0bb97acca26f0c139788bf0a33a4b27d4864bcbb/neutron/db/l3_hamode_db.py#L312","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"8adf08045dfc9d6a8528be2ebfde3486458eb009","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"},{"line_number":299,"context_line":"                    tenant_id)"},{"line_number":300,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":301,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":302,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":303,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":304,"context_line":"        self.bind_router(context, router_id, agent)"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a7b0d38_d0a02393","line":301,"in_reply_to":"1a7b0d38_559ae515","updated":"2015-12-23 06:38:35.000000000","message":"Please, see discussion on the 4th patch set, I think you will find answer for both your questions :) I will update commit message to make this clear.","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"5fe92427e491b971d8c1edea437a0d0f9ee92867","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                    context.elevated(), router_id, ha_network.network.id,"},{"line_number":299,"context_line":"                    tenant_id)"},{"line_number":300,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":301,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":302,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":303,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":304,"context_line":"        self.bind_router(context, router_id, agent)"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a7b0d38_90d85b1f","line":301,"in_reply_to":"1a7b0d38_d0a02393","updated":"2015-12-23 06:45:42.000000000","message":"Thanks for the explanation, now I understand. It makes sense to add it here.","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"68d7cf529b21b3996eb22926bb66df273a86692e","unresolved":false,"context_lines":[{"line_number":342,"context_line":"                with context.session.begin(subtransactions\u003dTrue):"},{"line_number":343,"context_line":"                    port_binding.l3_agent_id \u003d agent.id"},{"line_number":344,"context_line":"                    self.bind_router(context, router_id, agent)"},{"line_number":345,"context_line":"            except db_exc.DBDuplicateEntry:"},{"line_number":346,"context_line":"                LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":347,"context_line":"                          \"%(agent)s\", {\u0027router\u0027: router_id,"},{"line_number":348,"context_line":"                                        \u0027agent\u0027: agent.id})"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a7b0d38_95efedaf","line":345,"range":{"start_line":345,"start_character":26,"end_line":345,"end_character":42},"updated":"2015-12-23 06:11:45.000000000","message":"I don\u0027t think you need catch DBDuplicateEntry here, because it is already caught at line 218, and in \"bind_router\", it is RouterL3AgentBinding, not \"L3HARouterAgentPortBinding\" being added.","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":11159,"name":"Hong Hui Xiao","email":"honghui_xiao@yeah.net","username":"HongHuiXiao"},"change_message_id":"5fe92427e491b971d8c1edea437a0d0f9ee92867","unresolved":false,"context_lines":[{"line_number":342,"context_line":"                with context.session.begin(subtransactions\u003dTrue):"},{"line_number":343,"context_line":"                    port_binding.l3_agent_id \u003d agent.id"},{"line_number":344,"context_line":"                    self.bind_router(context, router_id, agent)"},{"line_number":345,"context_line":"            except db_exc.DBDuplicateEntry:"},{"line_number":346,"context_line":"                LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":347,"context_line":"                          \"%(agent)s\", {\u0027router\u0027: router_id,"},{"line_number":348,"context_line":"                                        \u0027agent\u0027: agent.id})"}],"source_content_type":"text/x-python","patch_set":11,"id":"1a7b0d38_f0343f4b","line":345,"range":{"start_line":345,"start_character":26,"end_line":345,"end_character":42},"in_reply_to":"1a7b0d38_95efedaf","updated":"2015-12-23 06:45:42.000000000","message":"I understand it now, thanks.","commit_id":"8c0651e915e1c42cbec6011e119f03ec4828fa5a"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"90b9d3974e5af4fbe8191d9c4c46ff103b591f44","unresolved":false,"context_lines":[{"line_number":298,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":299,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":300,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":301,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":302,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":303,"context_line":"        self.bind_router(context, router_id, agent)"},{"line_number":304,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_5a74fdcd","line":301,"range":{"start_line":301,"start_character":30,"end_line":301,"end_character":31},"updated":"2016-01-21 22:59:31.000000000","message":"if a DBDuplicateEntry is raised then the whole transaction is broken and next db query/commit will crash? It seems it should use a nested transaction","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"f18ea1befcd0e6b51db68ebfea7198e3e824b6d7","unresolved":false,"context_lines":[{"line_number":298,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":299,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":300,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":301,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":302,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":303,"context_line":"        self.bind_router(context, router_id, agent)"},{"line_number":304,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_a9c9267a","line":301,"range":{"start_line":301,"start_character":30,"end_line":301,"end_character":31},"in_reply_to":"9a68dd71_5a74fdcd","updated":"2016-01-22 09:32:04.000000000","message":"Sharp point, I had to ask and look at the sqlalchemy docs:\n\nhttp://docs.sqlalchemy.org/en/latest/orm/session_api.html#sqlalchemy.orm.session.Session.begin\n\nhttp://docs.sqlalchemy.org/en/latest/orm/session_transaction.html#session-begin-nested","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"3919a9d37d186a559912dacdbed2e8fc25a54ed8","unresolved":false,"context_lines":[{"line_number":298,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":299,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":300,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":301,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":302,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":303,"context_line":"        self.bind_router(context, router_id, agent)"},{"line_number":304,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_df5f683f","line":301,"range":{"start_line":301,"start_character":30,"end_line":301,"end_character":31},"in_reply_to":"9a68dd71_69900e44","updated":"2016-01-22 10:22:06.000000000","message":"create_ha_port_and_bind is never called from the other transaction because it contains call of method add_ha_port - see Kevin Benton merged change - https://review.openstack.org/#/c/261238/, so why we need nested here? It make sense to use only if we have another external transaction.","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"6c9996670acb348502e19e6aa6de0f6f2c09a10b","unresolved":false,"context_lines":[{"line_number":298,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":299,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":300,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":301,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":302,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":303,"context_line":"        self.bind_router(context, router_id, agent)"},{"line_number":304,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_17903794","line":301,"range":{"start_line":301,"start_character":30,"end_line":301,"end_character":31},"in_reply_to":"9a68dd71_9c3a0ce6","updated":"2016-01-25 08:50:57.000000000","message":"We do use it:\n\ndb_api.autonested_transaction(context.session) seems to provide the logic to try nested, and otherwise fallback to subtransaction.","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"35838516a818459b03506b84efce0defdaf29d29","unresolved":false,"context_lines":[{"line_number":298,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":299,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":300,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":301,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":302,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":303,"context_line":"        self.bind_router(context, router_id, agent)"},{"line_number":304,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_69900e44","line":301,"range":{"start_line":301,"start_character":30,"end_line":301,"end_character":31},"in_reply_to":"9a68dd71_a9c9267a","updated":"2016-01-22 09:33:03.000000000","message":"question, will in this case require a manual rollback when the exception is captured?","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":8788,"name":"Miguel Angel Ajo","email":"mangelajo@redhat.com","username":"mangelajo"},"change_message_id":"a893eade2ed27f74a0cea87e7e0410e31d84eba7","unresolved":false,"context_lines":[{"line_number":298,"context_line":"            with context.session.begin(subtransactions\u003dTrue):"},{"line_number":299,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":300,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":301,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":302,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":303,"context_line":"        self.bind_router(context, router_id, agent)"},{"line_number":304,"context_line":""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_9c3a0ce6","line":301,"range":{"start_line":301,"start_character":30,"end_line":301,"end_character":31},"in_reply_to":"9a68dd71_df5f683f","updated":"2016-01-25 08:47:11.000000000","message":"yeah, but, if we add nested here, we would be safe if the code up in the stack changed to have a nested transaction somehow.\n\nOtherwise those bugs are found later in time.\n\nIf we\u0027re capturing exceptions I guess we may be aware of those cases and write future proof code if that can be done and it\u0027s not expensive?.\n\nThoughts?\n\n(Sorry to not fully answering your question).\n\nPlease note: the nested mechanism  (as far as I heard) does not work well with postgresql, not sure if we already use it somewhere in the code.","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"90b9d3974e5af4fbe8191d9c4c46ff103b591f44","unresolved":false,"context_lines":[{"line_number":339,"context_line":"        for port_binding, agent in zip(port_bindings, chosen_agents):"},{"line_number":340,"context_line":"            try:"},{"line_number":341,"context_line":"                with context.session.begin(subtransactions\u003dTrue):"},{"line_number":342,"context_line":"                    port_binding.l3_agent_id \u003d agent.id"},{"line_number":343,"context_line":"                    self.bind_router(context, router_id, agent)"},{"line_number":344,"context_line":"            except db_exc.DBDuplicateEntry:"},{"line_number":345,"context_line":"                LOG.debug(\"Router %(router)s already scheduled for agent \""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_fa59315b","line":342,"range":{"start_line":342,"start_character":20,"end_line":342,"end_character":32},"updated":"2016-01-21 22:59:31.000000000","message":"itto","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"3919a9d37d186a559912dacdbed2e8fc25a54ed8","unresolved":false,"context_lines":[{"line_number":339,"context_line":"        for port_binding, agent in zip(port_bindings, chosen_agents):"},{"line_number":340,"context_line":"            try:"},{"line_number":341,"context_line":"                with context.session.begin(subtransactions\u003dTrue):"},{"line_number":342,"context_line":"                    port_binding.l3_agent_id \u003d agent.id"},{"line_number":343,"context_line":"                    self.bind_router(context, router_id, agent)"},{"line_number":344,"context_line":"            except db_exc.DBDuplicateEntry:"},{"line_number":345,"context_line":"                LOG.debug(\"Router %(router)s already scheduled for agent \""}],"source_content_type":"text/x-python","patch_set":13,"id":"9a68dd71_1af42ef0","line":342,"range":{"start_line":342,"start_character":20,"end_line":342,"end_character":32},"in_reply_to":"9a68dd71_fa59315b","updated":"2016-01-22 10:22:06.000000000","message":"the same","commit_id":"ddb80ceb7ec32381a6bec21a43a6f9ac86506ef7"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"2ff0c2c1c628e8699f03191c8bcbd511ed1b6a48","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                                          ha_network.network.id, tenant_id)"},{"line_number":299,"context_line":"            with db_api.autonested_transaction(context.session):"},{"line_number":300,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":301,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":302,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":303,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":304,"context_line":"        self.bind_router(context, router_id, agent)"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a68dd71_b86c6e37","line":301,"updated":"2016-01-26 15:04:49.000000000","message":"(If you need to respin): We\u0027re missing coverage for the exceptional cases here and in line 346. From http://docs.openstack.org/developer/neutron/devref/effective_neutron.html#mocking-and-testing, \"Test the failure cases. Use a mock side effect to throw the necessary exceptions to test your ‘except’ clauses.\"","commit_id":"f763592a792a212dc19695265ba3705b0702d8b7"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"01a6177f8b4bd274d30c841359f0c3b01014e37f","unresolved":false,"context_lines":[{"line_number":298,"context_line":"                                          ha_network.network.id, tenant_id)"},{"line_number":299,"context_line":"            with db_api.autonested_transaction(context.session):"},{"line_number":300,"context_line":"                port_binding.l3_agent_id \u003d agent[\u0027id\u0027]"},{"line_number":301,"context_line":"        except db_exc.DBDuplicateEntry:"},{"line_number":302,"context_line":"            LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":303,"context_line":"                      \"%(agent)s\", {\u0027router\u0027: router_id, \u0027agent\u0027: agent[\u0027id\u0027]})"},{"line_number":304,"context_line":"        self.bind_router(context, router_id, agent)"}],"source_content_type":"text/x-python","patch_set":14,"id":"7a5de9d1_64513b0e","line":301,"in_reply_to":"9a68dd71_b86c6e37","updated":"2016-01-29 16:49:48.000000000","message":"Done","commit_id":"f763592a792a212dc19695265ba3705b0702d8b7"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"2ff0c2c1c628e8699f03191c8bcbd511ed1b6a48","unresolved":false,"context_lines":[{"line_number":341,"context_line":"            try:"},{"line_number":342,"context_line":"                with db_api.autonested_transaction(context.session):"},{"line_number":343,"context_line":"                    port_binding.l3_agent_id \u003d agent.id"},{"line_number":344,"context_line":"                    self.bind_router(context, router_id, agent)"},{"line_number":345,"context_line":"            except db_exc.DBDuplicateEntry:"},{"line_number":346,"context_line":"                LOG.debug(\"Router %(router)s already scheduled for agent \""},{"line_number":347,"context_line":"                          \"%(agent)s\", {\u0027router\u0027: router_id,"}],"source_content_type":"text/x-python","patch_set":14,"id":"9a68dd71_b83eae27","line":344,"updated":"2016-01-26 15:04:49.000000000","message":"The fact that this line is in the try block is misleading, because it doesn\u0027t need to be. It just needs to be in the transaction block. I couldn\u0027t think of a way to solve this little problem though.","commit_id":"f763592a792a212dc19695265ba3705b0702d8b7"}]}
