)]}'
{"neutron/db/l3_db.py":[{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"d3cdda21ba62dc4ad2640f5b6f097063b20e0ee9","unresolved":false,"context_lines":[{"line_number":145,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":146,"context_line":"            router_db \u003d self._create_router_db(context, r, tenant_id, gw_info)"},{"line_number":147,"context_line":"        if gw_info:"},{"line_number":148,"context_line":"            self._update_router_gw_info(context, router_db[\u0027id\u0027], gw_info)"},{"line_number":149,"context_line":"        return self._make_router_dict(router_db)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _update_router_db(self, context, router_id, data, gw_info):"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_06d49f1d","line":148,"updated":"2014-07-31 09:53:10.000000000","message":"in fact if some exception occurs here then the result of previous transaction needs to be rolled back.","commit_id":"0f0eca4d57d96d2652f1829df9dcca07e4fe84cd"},{"author":{"_account_id":7805,"name":"Li Ma","email":"skywalker.nick@gmail.com","username":"Nick"},"change_message_id":"d36b9fd6b2a0d4d44b1c445c69837027c9df8af7","unresolved":false,"context_lines":[{"line_number":145,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":146,"context_line":"            router_db \u003d self._create_router_db(context, r, tenant_id, gw_info)"},{"line_number":147,"context_line":"        if gw_info:"},{"line_number":148,"context_line":"            self._update_router_gw_info(context, router_db[\u0027id\u0027], gw_info)"},{"line_number":149,"context_line":"        return self._make_router_dict(router_db)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    def _update_router_db(self, context, router_id, data, gw_info):"}],"source_content_type":"text/x-python","patch_set":2,"id":"7ac7a964_e2c0cb7e","line":148,"in_reply_to":"baada198_06d49f1d","updated":"2014-08-14 06:21:38.000000000","message":"So, this function cannot be out of the transaction. I just did an investigation of how it calls step by step. It seems that the coupling of transaction and notification is very high in the context of create_router().\n\nThe straightforward solution is to pass do_notify\u003dFalse from the innermost function (ML2 plugin interfaces) and notify all the messages in the outermost function (like create_router here), but it will expose the logic inside.\n\nI\u0027m still seeking for solutions. Do anyone have hints on it?\n\ncreate_router--\u003e\n_update_router_gw_info\n\t_get_router\n\t\tget router DB Object\n\t\traise l3.RouterNotFound\n\t_validate_gw_info\n\t\tget network DB Object\n\t\traise n_exc.BadRequest\n\t_delete_current_gw_port\n\t\traise l3.RouterExternalGatewayInUseByFloatingIp\n\t\tupdate router DB Object\n\t\tdelete_port\n\t\t\tprevent_l3_port_deletion\n\t\t\t\tget port DB Object\n\t\t\t\traise l3.L3PortInUse\n\t\t\tsession.begin()\n\t\t\t\t_delete_port_security_group_bindings\n\t\t\t\tdisassociate_floatingips\n\t\t\t\tbase.delete_port\n\t\t\tnotify_routers_updated \u003c-- HERE\n\t\t\tnotify_security_groups_member_updated \u003c-- HERE\n\t_create_gw_port\n\t\t_get_subnets_by_network\n\t\t\tget subnet DB Object\n\t\t_check_for_dup_router_subnet\n\t\t\traise n_exc.BadRequest\n\t\t\tget subnet DB Object\n\t\t\traise n_exc.BadRequest\n\t\t_create_router_gw_port\n\t\t\tcreate_port\n\t\t\t\tsession.begin()\n\t\t\t\t\t_ensure_default_security_group_on_port\n\t\t\t\t\t_get_security_groups_on_port\n\t\t\t\t\tbase.create_port\n\t\t\t\t\t_process_port_create_security_group\n\t\t\t\t\tget_network\n\t\t\t\t\t_process_port_binding\n\t\t\t\t\t_process_create_allowed_address_pairs\n\t\t\t\t\t_process_port_create_extra_dhcp_opts\n\t\t\t\tnotify_security_groups_member_updated \u003c-- HERE\n\t\t\tdelete_port\n\t\t\t\tprevent_l3_port_deletion\n\t\t\t\t\tget port DB Object\n\t\t\t\t\traise l3.L3PortInUse\n\t\t\t\tsession.begin()\n\t\t\t\t\t_delete_port_security_group_bindings\n\t\t\t\t\tdisassociate_floatingips\n\t\t\t\t\tbase.delete_port\n\t\t\t\tnotify_routers_updated \u003c-- HERE\n\t\t\t\tnotify_security_groups_member_updated \u003c-- HERE\n\t\t\traise n_exc.BadRequest\n\t\t\tupdate router DB Object","commit_id":"0f0eca4d57d96d2652f1829df9dcca07e4fe84cd"}]}
