)]}'
{"neutron/plugins/ml2/plugin.py":[{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"de8dfdcaec953fd23c3dbcad4bf43545687b4327","unresolved":false,"context_lines":[{"line_number":638,"context_line":"            for port in ports:"},{"line_number":639,"context_line":"                try:"},{"line_number":640,"context_line":"                    self.delete_port(context, port.id)"},{"line_number":641,"context_line":"                except exc.PortNotFound:"},{"line_number":642,"context_line":"                    # concurrent port deletion can be performed by"},{"line_number":643,"context_line":"                    # release_dhcp_port caused by concurrent subnet_delete"},{"line_number":644,"context_line":"                    LOG.info(_LI(\"Port %s was deleted concurrently\"), port.id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_78874a61","line":641,"updated":"2014-12-23 23:45:57.000000000","message":"just idle curiosity...but if subnet_delete ends up deleting the ports as you infer here, why not just get rid of this block and go directly to 650? Would that work?\n\nthere might be another race in line 738; where delete_network and delete_subnet are served in this sequence, no?","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"a72b98228dc5924ba977e95371f9e02c7c65925a","unresolved":false,"context_lines":[{"line_number":638,"context_line":"            for port in ports:"},{"line_number":639,"context_line":"                try:"},{"line_number":640,"context_line":"                    self.delete_port(context, port.id)"},{"line_number":641,"context_line":"                except exc.PortNotFound:"},{"line_number":642,"context_line":"                    # concurrent port deletion can be performed by"},{"line_number":643,"context_line":"                    # release_dhcp_port caused by concurrent subnet_delete"},{"line_number":644,"context_line":"                    LOG.info(_LI(\"Port %s was deleted concurrently\"), port.id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_67e44da8","line":641,"in_reply_to":"3a961159_4be5aca2","updated":"2015-01-06 20:02:26.000000000","message":"You cannot foresee the sequence delete_network/subnet. For that matter they could even be issued by two different clients. Even if they did get issued by the same client, the requests could be handled by two separate servers and out of order.\n\nAs for the evidence, was the trace experienced in the upstream CI or on some other environment.\n\nMy point is that if we have multiple attempts at deleting ports (done here and at subnet deleting), we\u0027re bound to this races. We should try to get rid of the race altogether rather than put a band aid, like this one.\n\nSometimes the band aid is the easiest option and I am okay with that, but here it sounds like we could potentially avoid the race if we have ports being deleted either explicitly or via subnet deletion.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"af2ee25ac2e0d90fe5a87fa4603e02d62f601227","unresolved":false,"context_lines":[{"line_number":638,"context_line":"            for port in ports:"},{"line_number":639,"context_line":"                try:"},{"line_number":640,"context_line":"                    self.delete_port(context, port.id)"},{"line_number":641,"context_line":"                except exc.PortNotFound:"},{"line_number":642,"context_line":"                    # concurrent port deletion can be performed by"},{"line_number":643,"context_line":"                    # release_dhcp_port caused by concurrent subnet_delete"},{"line_number":644,"context_line":"                    LOG.info(_LI(\"Port %s was deleted concurrently\"), port.id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_de91ff52","line":641,"in_reply_to":"3a961159_78874a61","updated":"2014-12-24 08:54:21.000000000","message":"delete_subnet itself doesn\u0027t delete ports. It notifies DHCP agent about subnet deletion, and it deletes dhcp port via rpc. That\u0027s why the race happens between delete_subnet/delete_network.\n\nRegarding delete_network and delete_subnet:\n\nFirst of all, it would not be a correct sequence to issue. \nIf we\u0027re working with one client instance, both operations are synchronous, so issuing delete_subnet after delete_network should then result in 404.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"9c470028eb689630bf9ff60f840cc8c0c23ab2fb","unresolved":false,"context_lines":[{"line_number":638,"context_line":"            for port in ports:"},{"line_number":639,"context_line":"                try:"},{"line_number":640,"context_line":"                    self.delete_port(context, port.id)"},{"line_number":641,"context_line":"                except exc.PortNotFound:"},{"line_number":642,"context_line":"                    # concurrent port deletion can be performed by"},{"line_number":643,"context_line":"                    # release_dhcp_port caused by concurrent subnet_delete"},{"line_number":644,"context_line":"                    LOG.info(_LI(\"Port %s was deleted concurrently\"), port.id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_d78e00d0","line":641,"in_reply_to":"3a961159_d6aabb6f","updated":"2014-12-30 08:28:13.000000000","message":"Yup, Armando is right. The message order is not enforced.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"6f9afbdfd321f91258ae48244a5e830420ecf7ad","unresolved":false,"context_lines":[{"line_number":638,"context_line":"            for port in ports:"},{"line_number":639,"context_line":"                try:"},{"line_number":640,"context_line":"                    self.delete_port(context, port.id)"},{"line_number":641,"context_line":"                except exc.PortNotFound:"},{"line_number":642,"context_line":"                    # concurrent port deletion can be performed by"},{"line_number":643,"context_line":"                    # release_dhcp_port caused by concurrent subnet_delete"},{"line_number":644,"context_line":"                    LOG.info(_LI(\"Port %s was deleted concurrently\"), port.id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_4be5aca2","line":641,"in_reply_to":"3a961159_d78e00d0","updated":"2015-01-06 11:12:04.000000000","message":"Well, it is enforced by the client!\nIt doesn\u0027t make sense to issue delete_network and then delete_subnet, from client perspective.\nSo, when client receives delete_subnet response, means that DB operation completes. Of course it causes some async operations on backend which may result in subsequent DB changes, but the point is that from client standpoint those operations are always ordered.\n\nRegarding hard evidence, Armando, what kind of hard evidence would you need? It was log analysis that showed the sequence of operations.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"0dff52d3794150d5c69e93150458b44a2b402d7c","unresolved":false,"context_lines":[{"line_number":638,"context_line":"            for port in ports:"},{"line_number":639,"context_line":"                try:"},{"line_number":640,"context_line":"                    self.delete_port(context, port.id)"},{"line_number":641,"context_line":"                except exc.PortNotFound:"},{"line_number":642,"context_line":"                    # concurrent port deletion can be performed by"},{"line_number":643,"context_line":"                    # release_dhcp_port caused by concurrent subnet_delete"},{"line_number":644,"context_line":"                    LOG.info(_LI(\"Port %s was deleted concurrently\"), port.id)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_d6aabb6f","line":641,"in_reply_to":"3a961159_de91ff52","updated":"2014-12-24 19:35:51.000000000","message":"\u003e delete_subnet itself doesn\u0027t delete ports.\n\nI know, I said \u0027ends up deleting the ports\u0027, just like you said it yourself\n\n\u003e First of all, it would not be a correct sequence to issue. \n\nThis is nonsense. In a highly concurrent multi-server environments there is no guarantee that the order of processing of delete_network and delete_subnet can be preserved.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"05f07405d38cc6ae58ab4d9b3f913044d726aa80","unresolved":false,"context_lines":[{"line_number":647,"context_line":"                        LOG.exception(_LE(\"Exception auto-deleting port %s\"),"},{"line_number":648,"context_line":"                                      port.id)"},{"line_number":649,"context_line":""},{"line_number":650,"context_line":"            for subnet in subnets:"},{"line_number":651,"context_line":"                try:"},{"line_number":652,"context_line":"                    self.delete_subnet(context, subnet.id)"},{"line_number":653,"context_line":"                except Exception:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_974f18be","line":650,"updated":"2014-12-30 08:23:48.000000000","message":"I think this loop also needs to deal with SubnetNotFound problem","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"b9bd1643cb7aeb2ff13b4531a233bc372d7b7eb2","unresolved":false,"context_lines":[{"line_number":647,"context_line":"                        LOG.exception(_LE(\"Exception auto-deleting port %s\"),"},{"line_number":648,"context_line":"                                      port.id)"},{"line_number":649,"context_line":""},{"line_number":650,"context_line":"            for subnet in subnets:"},{"line_number":651,"context_line":"                try:"},{"line_number":652,"context_line":"                    self.delete_subnet(context, subnet.id)"},{"line_number":653,"context_line":"                except Exception:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_de11ad54","line":650,"in_reply_to":"3a961159_974f18be","updated":"2014-12-30 19:58:44.000000000","message":"It\u0027s out of scope as the change deals with PortNotFound","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"7db5ff8e92fa3ffba8f62ff2e819dac5349c9b42","unresolved":false,"context_lines":[{"line_number":647,"context_line":"                        LOG.exception(_LE(\"Exception auto-deleting port %s\"),"},{"line_number":648,"context_line":"                                      port.id)"},{"line_number":649,"context_line":""},{"line_number":650,"context_line":"            for subnet in subnets:"},{"line_number":651,"context_line":"                try:"},{"line_number":652,"context_line":"                    self.delete_subnet(context, subnet.id)"},{"line_number":653,"context_line":"                except Exception:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_2aee8c8b","line":650,"in_reply_to":"3a961159_de11ad54","updated":"2015-01-06 20:40:22.000000000","message":"I think it makes sense to fix it in the scope of this patch.\nThanks, gongysh.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"}],"neutron/tests/unit/ml2/test_ml2_plugin.py":[{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"fccb516f87dfe9ca632f5c704716d3a41f1f4690","unresolved":false,"context_lines":[{"line_number":125,"context_line":"                with self.port(subnet\u003ds,"},{"line_number":126,"context_line":"                               device_owner\u003d\"network:dhcp\") as p:"},{"line_number":127,"context_line":"                    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":128,"context_line":"                    with contextlib.nested("},{"line_number":129,"context_line":"                        mock.patch.object(ml2_plugin.LOG, \u0027info\u0027),"},{"line_number":130,"context_line":"                        mock.patch.object(plugin, \"delete_port\")"},{"line_number":131,"context_line":"                    ) as (log_f, delete_f):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_e4ac6c37","line":128,"updated":"2014-12-24 10:55:42.000000000","message":"I really would like to stop this habit of asserting that logs are being called... It\u0027s an anti pattern if I\u0027ve ever seen one.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"29a5263c424e0ff16fc4f135753932acb422a4d9","unresolved":false,"context_lines":[{"line_number":125,"context_line":"                with self.port(subnet\u003ds,"},{"line_number":126,"context_line":"                               device_owner\u003d\"network:dhcp\") as p:"},{"line_number":127,"context_line":"                    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":128,"context_line":"                    with contextlib.nested("},{"line_number":129,"context_line":"                        mock.patch.object(ml2_plugin.LOG, \u0027info\u0027),"},{"line_number":130,"context_line":"                        mock.patch.object(plugin, \"delete_port\")"},{"line_number":131,"context_line":"                    ) as (log_f, delete_f):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_7d593cfc","line":128,"in_reply_to":"3a961159_0aff1003","updated":"2015-01-06 21:05:49.000000000","message":"Done","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"7130e7f57bfc0fb83c236a77083d08a08321ae56","unresolved":false,"context_lines":[{"line_number":125,"context_line":"                with self.port(subnet\u003ds,"},{"line_number":126,"context_line":"                               device_owner\u003d\"network:dhcp\") as p:"},{"line_number":127,"context_line":"                    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":128,"context_line":"                    with contextlib.nested("},{"line_number":129,"context_line":"                        mock.patch.object(ml2_plugin.LOG, \u0027info\u0027),"},{"line_number":130,"context_line":"                        mock.patch.object(plugin, \"delete_port\")"},{"line_number":131,"context_line":"                    ) as (log_f, delete_f):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_0aff1003","line":128,"in_reply_to":"3a961159_8a45c070","updated":"2015-01-06 20:51:29.000000000","message":"+1 - PortNotFound being raised but not re-raised should be enough of an indication that the intended codepath has been followed.\n\nI\u0027m more upset at the continued use of the wsgi layer for testing.  Consider extracting out port and subnet deletion so they can be tested directly.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"62a3dcaa2e21188ba053580db5efd3f68a124804","unresolved":false,"context_lines":[{"line_number":125,"context_line":"                with self.port(subnet\u003ds,"},{"line_number":126,"context_line":"                               device_owner\u003d\"network:dhcp\") as p:"},{"line_number":127,"context_line":"                    plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":128,"context_line":"                    with contextlib.nested("},{"line_number":129,"context_line":"                        mock.patch.object(ml2_plugin.LOG, \u0027info\u0027),"},{"line_number":130,"context_line":"                        mock.patch.object(plugin, \"delete_port\")"},{"line_number":131,"context_line":"                    ) as (log_f, delete_f):"}],"source_content_type":"text/x-python","patch_set":1,"id":"3a961159_8a45c070","line":128,"in_reply_to":"3a961159_e4ac6c37","updated":"2015-01-06 20:45:07.000000000","message":"Agree, here it is not necessary for verification.","commit_id":"812a982eebfdba10ff5da86c87e9cf00cdc35b82"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"17a475ca4c0ecd1103f2b03c58b2c37c9aa70857","unresolved":false,"context_lines":[{"line_number":119,"context_line":""},{"line_number":120,"context_line":"class TestMl2NetworksV2(test_plugin.TestNetworksV2,"},{"line_number":121,"context_line":"                        Ml2PluginV2TestCase):"},{"line_number":122,"context_line":"    def test_delete_network_concurrent_auto_port_delete(self):"},{"line_number":123,"context_line":"        with self.network() as net:"},{"line_number":124,"context_line":"            with self.subnet(network\u003dnet) as s:"},{"line_number":125,"context_line":"                with self.port(subnet\u003ds,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a961159_c0f40789","line":122,"updated":"2015-01-06 21:39:47.000000000","message":"Whenever a test addition is significantly more complex than the code it targets, I smell anti-pattern.  As per my comment on the previous patch, here is what I would suggest:\n\n# Extracted out of delete_network\ndef _delete_ports(self, context, ports)\n for port in ports:\n   self.delete_port(context, port.id)\n ...\n\ndef test_delete_ports_ignores_missing_port(self):\n plugin \u003d manager.NeutronManager.get_plugin()\n with mock.patch.object(plugin, \u0027delete_port\u0027, side_effect\u003dexc.PortNotFound()):\n    plugin._delete_ports(None, [mock.MagicMock()])","commit_id":"38916dd907bc49f791fedb48ae9eff41c2ba40f5"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"6163e85967ea35d3ce1b4c9e493ff0c59d5cf17e","unresolved":false,"context_lines":[{"line_number":119,"context_line":""},{"line_number":120,"context_line":"class TestMl2NetworksV2(test_plugin.TestNetworksV2,"},{"line_number":121,"context_line":"                        Ml2PluginV2TestCase):"},{"line_number":122,"context_line":"    def test_delete_network_concurrent_auto_port_delete(self):"},{"line_number":123,"context_line":"        with self.network() as net:"},{"line_number":124,"context_line":"            with self.subnet(network\u003dnet) as s:"},{"line_number":125,"context_line":"                with self.port(subnet\u003ds,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3a961159_9b0d1092","line":122,"in_reply_to":"3a961159_c0f40789","updated":"2015-01-06 22:11:27.000000000","message":"oh, you\u0027re suggesting refactoring delete_network method itself.\nYep, that looks better.","commit_id":"38916dd907bc49f791fedb48ae9eff41c2ba40f5"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"6f02bd3b8f756e67eea1e7527184e82906e48769","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                        Ml2PluginV2TestCase):"},{"line_number":122,"context_line":"    def test_port_delete_helper_tolerates_failure(self):"},{"line_number":123,"context_line":"        plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":124,"context_line":"        ports \u003d [models_v2.Port(id\u003d\"123\"),"},{"line_number":125,"context_line":"                 models_v2.Port(id\u003d\"124\")]"},{"line_number":126,"context_line":"        with mock.patch.object(plugin, \"delete_port\") as delete_f:"},{"line_number":127,"context_line":"            def _delete_port(*args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_31b6fbdc","line":124,"updated":"2015-01-06 23:12:42.000000000","message":"As per my example, why go through the trouble of using real ports, a real context, and defining a method to raise an exception? The following is functionally equivalent:\n\nplugin \u003d manager.NeutronManager.get_plugin()\nwith mock.patch.object(plugin, \u0027delete_port\u0027, side_effect\u003dexc.PortNotFound(port_id\u003d\u0027123\u0027)):\n  plugin._delete_ports(None, [mock.MagicMock()])","commit_id":"7312f470b3112891c066171fdddc0d6c044832e2"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"dd63ddbfb3d61af2a82ec181ab528a8f6db7bd33","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                        Ml2PluginV2TestCase):"},{"line_number":122,"context_line":"    def test_port_delete_helper_tolerates_failure(self):"},{"line_number":123,"context_line":"        plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":124,"context_line":"        ports \u003d [models_v2.Port(id\u003d\"123\"),"},{"line_number":125,"context_line":"                 models_v2.Port(id\u003d\"124\")]"},{"line_number":126,"context_line":"        with mock.patch.object(plugin, \"delete_port\") as delete_f:"},{"line_number":127,"context_line":"            def _delete_port(*args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_3bac15ed","line":124,"in_reply_to":"3a961159_31b6fbdc","updated":"2015-01-07 02:58:57.000000000","message":"I agree","commit_id":"7312f470b3112891c066171fdddc0d6c044832e2"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"5ab76ba079bd73039040078a1f645891d02202b5","unresolved":false,"context_lines":[{"line_number":121,"context_line":"                        Ml2PluginV2TestCase):"},{"line_number":122,"context_line":"    def test_port_delete_helper_tolerates_failure(self):"},{"line_number":123,"context_line":"        plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":124,"context_line":"        ports \u003d [models_v2.Port(id\u003d\"123\"),"},{"line_number":125,"context_line":"                 models_v2.Port(id\u003d\"124\")]"},{"line_number":126,"context_line":"        with mock.patch.object(plugin, \"delete_port\") as delete_f:"},{"line_number":127,"context_line":"            def _delete_port(*args, **kwargs):"}],"source_content_type":"text/x-python","patch_set":3,"id":"3a961159_87268ab8","line":124,"in_reply_to":"3a961159_31b6fbdc","updated":"2015-01-07 07:59:26.000000000","message":"Ok.\n\nI initially wanted to preserve some kind of real data passing into those methods, but for sure this way is equivalent and more simple.","commit_id":"7312f470b3112891c066171fdddc0d6c044832e2"},{"author":{"_account_id":2035,"name":"Maru Newby","email":"marun@redhat.com","username":"maru"},"change_message_id":"a57a9c9a7b9d1f15b31dfeda2eb6a8632f487c16","unresolved":false,"context_lines":[{"line_number":118,"context_line":""},{"line_number":119,"context_line":"class TestMl2NetworksV2(test_plugin.TestNetworksV2,"},{"line_number":120,"context_line":"                        Ml2PluginV2TestCase):"},{"line_number":121,"context_line":"    def test_port_delete_helper_tolerates_failure(self):"},{"line_number":122,"context_line":"        plugin \u003d manager.NeutronManager.get_plugin()"},{"line_number":123,"context_line":"        with mock.patch.object(plugin, \"delete_port\","},{"line_number":124,"context_line":"                               side_effect\u003dexc.PortNotFound(port_id\u003d\"123\")):"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_7b8a08c0","line":121,"updated":"2015-01-07 18:44:31.000000000","message":"Please name unit tests after the methods they target to make discoverability easier, e.g. test_delete_ports_tolerates_failure.  I\u0027m not going to block merge, but I would appreciate it if you would fix this either in this change or in a follow-on.","commit_id":"8479921e111e1c306db76c52b33115cc5a77c420"}]}
