)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3d23b74fda779d042c332df7bedf0c5a1703e3f0","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Introduce get_reader_session() and get_writer_session()"},{"line_number":10,"context_line":"and replace get_session() with them."},{"line_number":11,"context_line":"Mark get_session as depricated."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Stop using get_engine from legacy facade. Use writer engine for"},{"line_number":14,"context_line":"places where it is required."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":11,"id":"7a3c09a3_b79df567","line":11,"range":{"start_line":11,"start_character":20,"end_line":11,"end_character":30},"updated":"2017-01-17 17:48:55.000000000","message":"nit: deprecated.","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"18fa4883df440ca03e6f4c4e5d81851c2d1aa26a","unresolved":false,"context_lines":[{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Introduce get_reader_session() and get_writer_session()"},{"line_number":10,"context_line":"and replace get_session() with them."},{"line_number":11,"context_line":"Mark get_session as depricated."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Stop using get_engine from legacy facade. Use writer engine for"},{"line_number":14,"context_line":"places where it is required."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":12,"id":"7a3c09a3_e3fdd4b1","line":11,"range":{"start_line":11,"start_character":20,"end_line":11,"end_character":30},"updated":"2017-01-18 12:47:47.000000000","message":"-\u003e deprecated","commit_id":"00c12b6843649374c107cdc4ca43cb7dbd460e7c"}],"neutron/plugins/ml2/drivers/l2pop/mech_driver.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"2a21b6cbc04a78a3b7535586cae69655597ca7a7","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        fdb_entries \u003d self._get_agent_fdb("},{"line_number":75,"context_line":"            context, context.bottom_bound_segment, port, agent_host)"},{"line_number":76,"context_line":"        if port[\u0027device_owner\u0027] in l2pop_db.HA_ROUTER_PORTS and fdb_entries:"},{"line_number":77,"context_line":"            session \u003d db_api.get_writer_session()"},{"line_number":78,"context_line":"            network_id \u003d port[\u0027network_id\u0027]"},{"line_number":79,"context_line":"            other_fdb_ports \u003d self._get_ha_port_agents_fdb("},{"line_number":80,"context_line":"                session, network_id, port[\u0027device_id\u0027])"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_9f7ae0ef","line":77,"updated":"2017-01-17 14:38:39.000000000","message":"why is it writer? I don\u0027t see the session used to write anywhere.","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"e33acec72c2de14471199d14e2ef25aee8991b36","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        fdb_entries \u003d self._get_agent_fdb("},{"line_number":75,"context_line":"            context, context.bottom_bound_segment, port, agent_host)"},{"line_number":76,"context_line":"        if port[\u0027device_owner\u0027] in l2pop_db.HA_ROUTER_PORTS and fdb_entries:"},{"line_number":77,"context_line":"            session \u003d db_api.get_writer_session()"},{"line_number":78,"context_line":"            network_id \u003d port[\u0027network_id\u0027]"},{"line_number":79,"context_line":"            other_fdb_ports \u003d self._get_ha_port_agents_fdb("},{"line_number":80,"context_line":"                session, network_id, port[\u0027device_id\u0027])"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_0ee77240","line":77,"in_reply_to":"7a3c09a3_9adca074","updated":"2017-01-18 08:24:21.000000000","message":"Done","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3d23b74fda779d042c332df7bedf0c5a1703e3f0","unresolved":false,"context_lines":[{"line_number":74,"context_line":"        fdb_entries \u003d self._get_agent_fdb("},{"line_number":75,"context_line":"            context, context.bottom_bound_segment, port, agent_host)"},{"line_number":76,"context_line":"        if port[\u0027device_owner\u0027] in l2pop_db.HA_ROUTER_PORTS and fdb_entries:"},{"line_number":77,"context_line":"            session \u003d db_api.get_writer_session()"},{"line_number":78,"context_line":"            network_id \u003d port[\u0027network_id\u0027]"},{"line_number":79,"context_line":"            other_fdb_ports \u003d self._get_ha_port_agents_fdb("},{"line_number":80,"context_line":"                session, network_id, port[\u0027device_id\u0027])"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_9adca074","line":77,"in_reply_to":"7a3c09a3_9f7ae0ef","updated":"2017-01-17 17:48:55.000000000","message":"+1","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"2a21b6cbc04a78a3b7535586cae69655597ca7a7","unresolved":false,"context_lines":[{"line_number":255,"context_line":"    def update_port_up(self, context):"},{"line_number":256,"context_line":"        port \u003d context.current"},{"line_number":257,"context_line":"        agent_host \u003d context.host"},{"line_number":258,"context_line":"        session \u003d db_api.get_writer_session()"},{"line_number":259,"context_line":"        agent \u003d l2pop_db.get_agent_by_host(session, agent_host)"},{"line_number":260,"context_line":"        if not agent:"},{"line_number":261,"context_line":"            LOG.warning(_LW(\"Unable to retrieve active L2 agent on host %s\"),"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_9f32e00e","line":258,"updated":"2017-01-17 14:38:39.000000000","message":"same comment. I don\u0027t see we update db with the session","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3d23b74fda779d042c332df7bedf0c5a1703e3f0","unresolved":false,"context_lines":[{"line_number":255,"context_line":"    def update_port_up(self, context):"},{"line_number":256,"context_line":"        port \u003d context.current"},{"line_number":257,"context_line":"        agent_host \u003d context.host"},{"line_number":258,"context_line":"        session \u003d db_api.get_writer_session()"},{"line_number":259,"context_line":"        agent \u003d l2pop_db.get_agent_by_host(session, agent_host)"},{"line_number":260,"context_line":"        if not agent:"},{"line_number":261,"context_line":"            LOG.warning(_LW(\"Unable to retrieve active L2 agent on host %s\"),"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_9a6740e8","line":258,"in_reply_to":"7a3c09a3_9f32e00e","updated":"2017-01-17 17:48:55.000000000","message":"Even when line 282 seems to use the session for a creation, it doesn\u0027t change anything on the db.","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"}],"neutron/plugins/ml2/drivers/type_tunnel.py":[{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"916d32ffff758d613be2a0166328a2401a72d9ec","unresolved":false,"context_lines":[{"line_number":146,"context_line":""},{"line_number":147,"context_line":"        tunnel_id_getter \u003d operator.attrgetter(self.segmentation_key)"},{"line_number":148,"context_line":"        tunnel_col \u003d getattr(self.model, self.segmentation_key)"},{"line_number":149,"context_line":"        session \u003d db_api.get_writer_session()"},{"line_number":150,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":151,"context_line":"            # remove from table unallocated tunnels not currently allocatable"},{"line_number":152,"context_line":"            # fetch results as list via all() because we\u0027ll be iterating"},{"line_number":153,"context_line":"            # through them twice"}],"source_content_type":"text/x-python","patch_set":2,"id":"da4df55a_4d3efada","line":150,"range":{"start_line":149,"start_character":8,"end_line":150,"end_character":49},"updated":"2016-12-28 14:40:31.000000000","message":"@Roman, @Mike\n\nIf we do not have context and get session like this, do we need subtransactions? How such case should be done properly?","commit_id":"a4c083357509aedf7d2d4fc0f8e85c914cea770c"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"c63a9e85942b4c07bd992a8bcd73dfac5d99fea8","unresolved":false,"context_lines":[{"line_number":146,"context_line":""},{"line_number":147,"context_line":"        tunnel_id_getter \u003d operator.attrgetter(self.segmentation_key)"},{"line_number":148,"context_line":"        tunnel_col \u003d getattr(self.model, self.segmentation_key)"},{"line_number":149,"context_line":"        session \u003d db_api.get_writer_session()"},{"line_number":150,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":151,"context_line":"            # remove from table unallocated tunnels not currently allocatable"},{"line_number":152,"context_line":"            # fetch results as list via all() because we\u0027ll be iterating"},{"line_number":153,"context_line":"            # through them twice"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba5201f7_f33e6ad9","line":150,"range":{"start_line":149,"start_character":8,"end_line":150,"end_character":49},"in_reply_to":"ba5201f7_f0ebc076","updated":"2017-01-09 09:55:39.000000000","message":"Thanks a lot for clarification!","commit_id":"a4c083357509aedf7d2d4fc0f8e85c914cea770c"},{"author":{"_account_id":6849,"name":"Roman Podoliaka","email":"roman.podoliaka@gmail.com","username":"rpodolyaka"},"change_message_id":"f0d8f0496fd377743b01fe7faf4698b3bd624a86","unresolved":false,"context_lines":[{"line_number":146,"context_line":""},{"line_number":147,"context_line":"        tunnel_id_getter \u003d operator.attrgetter(self.segmentation_key)"},{"line_number":148,"context_line":"        tunnel_col \u003d getattr(self.model, self.segmentation_key)"},{"line_number":149,"context_line":"        session \u003d db_api.get_writer_session()"},{"line_number":150,"context_line":"        with session.begin(subtransactions\u003dTrue):"},{"line_number":151,"context_line":"            # remove from table unallocated tunnels not currently allocatable"},{"line_number":152,"context_line":"            # fetch results as list via all() because we\u0027ll be iterating"},{"line_number":153,"context_line":"            # through them twice"}],"source_content_type":"text/x-python","patch_set":2,"id":"ba5201f7_f0ebc076","line":150,"range":{"start_line":149,"start_character":8,"end_line":150,"end_character":49},"in_reply_to":"da4df55a_4d3efada","updated":"2017-01-09 09:33:14.000000000","message":"subtranscations\u003dTrue (*not* to be confused with SAVEPOINT\u0027s!) is needed to make sure your code can both start a new transaction on its own (when sync_allocations() call is the first one on the functions call stack that talks to a DB) and participate in an existing one (when sync_allocations() is called from another method that works with a DB and already established a transaction). It\u0027s mostly useful when autocommit\u003dTrue - http://docs.sqlalchemy.org/en/latest/orm/session_transaction.html#using-subtransactions-with-autocommit\n\nIn your case the transactional scope is already managed by the enginefacade: you can safely drop the session.begin(subtransactions\u003dTrue) call and just use the Session instance that\u0027s injected to the context.","commit_id":"a4c083357509aedf7d2d4fc0f8e85c914cea770c"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"2a21b6cbc04a78a3b7535586cae69655597ca7a7","unresolved":false,"context_lines":[{"line_number":17,"context_line":"import operator"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"import netaddr"},{"line_number":20,"context_line":"from neutron import context"},{"line_number":21,"context_line":"from neutron_lib import exceptions as exc"},{"line_number":22,"context_line":"from oslo_config import cfg"},{"line_number":23,"context_line":"from oslo_db import api as oslo_db_api"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_3f0bac2b","line":20,"updated":"2017-01-17 14:38:39.000000000","message":"should probably go below in lines 30+. Or you can use new context module from neutron-lib?","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"e33acec72c2de14471199d14e2ef25aee8991b36","unresolved":false,"context_lines":[{"line_number":17,"context_line":"import operator"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"import netaddr"},{"line_number":20,"context_line":"from neutron import context"},{"line_number":21,"context_line":"from neutron_lib import exceptions as exc"},{"line_number":22,"context_line":"from oslo_config import cfg"},{"line_number":23,"context_line":"from oslo_db import api as oslo_db_api"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_2eb98e15","line":20,"in_reply_to":"7a3c09a3_3f0bac2b","updated":"2017-01-18 08:24:21.000000000","message":"Oops, thanks!\nI need to use from neutron as I updated setting session there.","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"}],"neutron/plugins/ml2/drivers/type_vlan.py":[{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"2a21b6cbc04a78a3b7535586cae69655597ca7a7","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron._i18n import _, _LE, _LI, _LW"},{"line_number":24,"context_line":"from neutron.common import _deprecate"},{"line_number":25,"context_line":"from neutron.conf.plugins.ml2.drivers import driver_type"},{"line_number":26,"context_line":"from neutron import context"},{"line_number":27,"context_line":"from neutron.db import api as db_api"},{"line_number":28,"context_line":"from neutron.db.models.plugins.ml2 import vlanallocation as vlan_alloc_model"},{"line_number":29,"context_line":"from neutron.plugins.common import constants as p_const"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_c23d6b90","line":26,"updated":"2017-01-17 14:38:39.000000000","message":"should we use neutron-lib\u0027s context module now?","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"e33acec72c2de14471199d14e2ef25aee8991b36","unresolved":false,"context_lines":[{"line_number":23,"context_line":"from neutron._i18n import _, _LE, _LI, _LW"},{"line_number":24,"context_line":"from neutron.common import _deprecate"},{"line_number":25,"context_line":"from neutron.conf.plugins.ml2.drivers import driver_type"},{"line_number":26,"context_line":"from neutron import context"},{"line_number":27,"context_line":"from neutron.db import api as db_api"},{"line_number":28,"context_line":"from neutron.db.models.plugins.ml2 import vlanallocation as vlan_alloc_model"},{"line_number":29,"context_line":"from neutron.plugins.common import constants as p_const"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_ae281e34","line":26,"in_reply_to":"7a3c09a3_c23d6b90","updated":"2017-01-18 08:24:21.000000000","message":"Setting session is in context is updated in this change. https://review.openstack.org/#/c/415226/11/neutron/context.py","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":8726,"name":"Victor Morales","email":"chipahuac@hotmail.com","username":"electrocucaracha"},"change_message_id":"3d23b74fda779d042c332df7bedf0c5a1703e3f0","unresolved":false,"context_lines":[{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    @db_api.retry_db_errors"},{"line_number":67,"context_line":"    def _sync_vlan_allocations(self):"},{"line_number":68,"context_line":"        ctx \u003d context.get_admin_context()"},{"line_number":69,"context_line":"        with db_api.context_manager.writer.using(ctx):"},{"line_number":70,"context_line":"            # get existing allocations for all physical networks"},{"line_number":71,"context_line":"            allocations \u003d dict()"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_9ae66013","line":68,"range":{"start_line":68,"start_character":8,"end_line":68,"end_character":41},"updated":"2017-01-17 17:48:55.000000000","message":"I\u0027m OK, changing the scope of the context in UT, but in this case shouldn\u0027t be?\n\ndb_api.get_writer_session()","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"},{"author":{"_account_id":7249,"name":"Ann Taraday","email":"akamyshnikova@mirantis.com","username":"AKamyshnikova"},"change_message_id":"e33acec72c2de14471199d14e2ef25aee8991b36","unresolved":false,"context_lines":[{"line_number":65,"context_line":""},{"line_number":66,"context_line":"    @db_api.retry_db_errors"},{"line_number":67,"context_line":"    def _sync_vlan_allocations(self):"},{"line_number":68,"context_line":"        ctx \u003d context.get_admin_context()"},{"line_number":69,"context_line":"        with db_api.context_manager.writer.using(ctx):"},{"line_number":70,"context_line":"            # get existing allocations for all physical networks"},{"line_number":71,"context_line":"            allocations \u003d dict()"}],"source_content_type":"text/x-python","patch_set":11,"id":"7a3c09a3_6e8e362f","line":68,"range":{"start_line":68,"start_character":8,"end_line":68,"end_character":41},"in_reply_to":"7a3c09a3_9ae66013","updated":"2017-01-18 08:24:21.000000000","message":"If I use db_api.get_writer_session() we have to stick with session.begin(subtransactions\u003dTrue) and with new enginefacade we should not use it, so in my opinion getting context here is more appropriate.","commit_id":"0273435cea6e7b32355512f82124f9d3e1a4b4fb"}]}
