)]}'
{"neutron/db/agents_db.py":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"9cc8d9588a7d2803f6373bd9c77efdd3d28ed901","unresolved":false,"context_lines":[{"line_number":256,"context_line":"    def delete_agent(self, context, id):"},{"line_number":257,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":258,"context_line":"            agent \u003d self._get_agent(context, id)"},{"line_number":259,"context_line":"            registry.notify(resources.AGENT, events.BEFORE_DELETE, self,"},{"line_number":260,"context_line":"                            context\u003dcontext, agent\u003dagent)"},{"line_number":261,"context_line":"            context.session.delete(agent)"},{"line_number":262,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"7a1b2928_8c46d0bd","line":259,"updated":"2016-04-11 08:25:58.000000000","message":"Why is this done in the DB transaction? If the event takes too long it may cause a DB exception. Can e move this out of the transaction?","commit_id":"123dd274054c5899d3a3047f3fbf2d32240fee06"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"e35b6149d32d79489b20fcf156ba0e0477b34cee","unresolved":false,"context_lines":[{"line_number":256,"context_line":"    def delete_agent(self, context, id):"},{"line_number":257,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":258,"context_line":"            agent \u003d self._get_agent(context, id)"},{"line_number":259,"context_line":"            registry.notify(resources.AGENT, events.BEFORE_DELETE, self,"},{"line_number":260,"context_line":"                            context\u003dcontext, agent\u003dagent)"},{"line_number":261,"context_line":"            context.session.delete(agent)"},{"line_number":262,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"7a1b2928_1f31360c","line":259,"in_reply_to":"7a1b2928_8c46d0bd","updated":"2016-04-11 12:57:15.000000000","message":"Done","commit_id":"123dd274054c5899d3a3047f3fbf2d32240fee06"}],"neutron/db/dvr_mac_db.py":[{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"141e78593401e15925c9e2b63d2418446bc15434","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                                      **kwargs):"},{"line_number":68,"context_line":"    host \u003d agent[\u0027host\u0027]"},{"line_number":69,"context_line":"    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":70,"context_line":"    if plugin.get_agents(context, filters\u003d{\u0027host\u0027: [host]}):"},{"line_number":71,"context_line":"        # there are still agents on this host, don\u0027t mess with the mac entry"},{"line_number":72,"context_line":"        # until they are all deleted."},{"line_number":73,"context_line":"        return"}],"source_content_type":"text/x-python","patch_set":3,"id":"7a1b2928_e095b240","line":70,"updated":"2016-04-11 14:12:56.000000000","message":"We are calling _delete_mac_associated_with_agent before agent is deleted(https://review.openstack.org/#/c/303668/3/neutron/db/agents_db.py L259). So in L70 agent still exists for the host(i.e get_agents() will always return agents for the host). \nHence mac is never deleted from DistributedVirtualRouterMacAddress.\n\nSo instead of registring and subscribing for BEFORE_DELETE, why can\u0027t we use AFTER_DELETE?","commit_id":"e1b87313e055f83592b5dbb052c84f6ce98e11b3"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"98d6621b6c8729f78a8a1a3cb300b7ee66e7634d","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                                      **kwargs):"},{"line_number":68,"context_line":"    host \u003d agent[\u0027host\u0027]"},{"line_number":69,"context_line":"    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":70,"context_line":"    if plugin.get_agents(context, filters\u003d{\u0027host\u0027: [host]}):"},{"line_number":71,"context_line":"        # there are still agents on this host, don\u0027t mess with the mac entry"},{"line_number":72,"context_line":"        # until they are all deleted."},{"line_number":73,"context_line":"        return"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a18252c_d5485c8a","line":70,"in_reply_to":"7a1b2928_e095b240","updated":"2016-04-11 21:18:50.000000000","message":"Whoops. I started out with AFTER_DELETE, but the risk with that is that it leaves and orphaned record if the server dies.","commit_id":"e1b87313e055f83592b5dbb052c84f6ce98e11b3"},{"author":{"_account_id":10267,"name":"venkata anil","email":"anilvenkata@redhat.com","username":"anil"},"change_message_id":"559d41f1a729538b10f8e13293bbc3fbc206cf44","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                                      **kwargs):"},{"line_number":68,"context_line":"    host \u003d agent[\u0027host\u0027]"},{"line_number":69,"context_line":"    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":70,"context_line":"    if [a for a in plugin.get_agents(context, filters\u003d{\u0027host\u0027: [host]})"},{"line_number":71,"context_line":"            if a[\u0027id\u0027] !\u003d agent[\u0027id\u0027]]:"},{"line_number":72,"context_line":"        # there are still agents on this host, don\u0027t mess with the mac entry"},{"line_number":73,"context_line":"        # until they are all deleted."}],"source_content_type":"text/x-python","patch_set":4,"id":"5a18252c_a1775901","line":70,"updated":"2016-04-12 04:40:27.000000000","message":"nice change Kevin :)\n\nI have one question. What if server dies while deleting the agent i.e during ..\n        with context.session.begin(subtransactions\u003dTrue):\n            context.session.delete(agent)\nStill should we delete the mac without the confirming that agent got deleted?","commit_id":"92527c2de2afaf4862fddc101143e4d02858924d"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"7f73f25bbd5b3811af82bab92ee4f9d0b3ac55f3","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                                      **kwargs):"},{"line_number":68,"context_line":"    host \u003d agent[\u0027host\u0027]"},{"line_number":69,"context_line":"    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":70,"context_line":"    if [a for a in plugin.get_agents(context, filters\u003d{\u0027host\u0027: [host]})"},{"line_number":71,"context_line":"            if a[\u0027id\u0027] !\u003d agent[\u0027id\u0027]]:"},{"line_number":72,"context_line":"        # there are still agents on this host, don\u0027t mess with the mac entry"},{"line_number":73,"context_line":"        # until they are all deleted."}],"source_content_type":"text/x-python","patch_set":4,"id":"5a18252c_49e8237d","line":70,"in_reply_to":"5a18252c_295de7e9","updated":"2016-04-12 09:28:09.000000000","message":"Actually I think I will leave it the way it is for now. If an admin was trying to delete an active agent it would lead to unpredictable behavior on the agent anyway. If they restart the agent it will get a new MAC and go back to normal.","commit_id":"92527c2de2afaf4862fddc101143e4d02858924d"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"3e6aadd1af70117632ee6dff36d4cd931861c1e1","unresolved":false,"context_lines":[{"line_number":67,"context_line":"                                      **kwargs):"},{"line_number":68,"context_line":"    host \u003d agent[\u0027host\u0027]"},{"line_number":69,"context_line":"    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":70,"context_line":"    if [a for a in plugin.get_agents(context, filters\u003d{\u0027host\u0027: [host]})"},{"line_number":71,"context_line":"            if a[\u0027id\u0027] !\u003d agent[\u0027id\u0027]]:"},{"line_number":72,"context_line":"        # there are still agents on this host, don\u0027t mess with the mac entry"},{"line_number":73,"context_line":"        # until they are all deleted."}],"source_content_type":"text/x-python","patch_set":4,"id":"5a18252c_295de7e9","line":70,"in_reply_to":"5a18252c_a1775901","updated":"2016-04-12 09:19:39.000000000","message":"I was thinking it should be okay because an admin would only be deleting an agent he/she doens\u0027t care about anymore. But maybe I should get them in the same transaction to be safe.","commit_id":"92527c2de2afaf4862fddc101143e4d02858924d"}]}
