)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"667c690d650bdfa13510286af9af76b57b90686e","unresolved":false,"context_lines":[{"line_number":19,"context_line":"The logic in Ml2Plugin.delete_network() is also fixed to properly"},{"line_number":20,"context_line":"handle auto-deleting subnets."},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"Closes-Bug: 1234195"},{"line_number":23,"context_line":"Change-Id: I6d74f89d39ea8afe6915f1d2f9afdf66c0076f5a"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"AAAATH%2F%2F9c4%3D","line":22,"updated":"2013-10-07 13:35:15.000000000","message":"Since you are fixing line 395, I am pretty sure you can add here,\n\n   Closes-Bug: 1235486","commit_id":"23fd84086abc996087a329a7f0d3000674f12162"}],"neutron/plugins/ml2/plugin.py":[{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"e0e292fddc47edd0ba10de680cb595c48df6a5b3","unresolved":false,"context_lines":[{"line_number":392,"context_line":"                # Get subnets to auto-delete."},{"line_number":393,"context_line":"                subnets \u003d self.get_subnets(context, filters\u003dfilter)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"                if not ports or subnets:"},{"line_number":396,"context_line":"                    network \u003d self.get_network(context, id)"},{"line_number":397,"context_line":"                    mech_context \u003d driver_context.NetworkContext(self,"},{"line_number":398,"context_line":"                                                                 context,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAS3%2F%2FGR0%3D","line":395,"updated":"2013-10-04 13:05:55.000000000","message":"I think this should be\n\n    if not (ports or subnets):","commit_id":"1d0cf7fb9178a265cfc65f9936821b0c43bf08e8"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"02585ea861fc73644747655493b0aa55efd813e3","unresolved":false,"context_lines":[{"line_number":392,"context_line":"                # Get subnets to auto-delete."},{"line_number":393,"context_line":"                subnets \u003d self.get_subnets(context, filters\u003dfilter)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"                if not ports or subnets:"},{"line_number":396,"context_line":"                    network \u003d self.get_network(context, id)"},{"line_number":397,"context_line":"                    mech_context \u003d driver_context.NetworkContext(self,"},{"line_number":398,"context_line":"                                                                 context,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAS3%2F%2FGEQ%3D","line":395,"in_reply_to":"AAAAS3%2F%2FGR0%3D","updated":"2013-10-04 15:22:51.000000000","message":"Good catch! This was a previous patch, but is clearly wrong, and this patch is closely related, so I\u0027m fixing it here.","commit_id":"1d0cf7fb9178a265cfc65f9936821b0c43bf08e8"},{"author":{"_account_id":6676,"name":"zqfan","email":"aji.zqfan@gmail.com","username":"aji-zqfan"},"change_message_id":"342f7e65d08dd13ebbc43cc05b326e5ff0bc49a9","unresolved":false,"context_lines":[{"line_number":490,"context_line":"                    record \u003d self._get_subnet(context, id)"},{"line_number":491,"context_line":"                    session.delete(record)"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"                    break"},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"            for a in allocated:"},{"line_number":496,"context_line":"                self.delete_port(context, a.port_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAS3%2F%2FD6M%3D","line":493,"updated":"2013-10-05 09:12:30.000000000","message":"i\u0027m not sure about it is ok to do such change\n\nplease visit this link: https://bugs.launchpad.net/neutron/+bug/1235486","commit_id":"23fd84086abc996087a329a7f0d3000674f12162"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"3c4d55a540772d575d219fdefccd92cc595fb976","unresolved":false,"context_lines":[{"line_number":490,"context_line":"                    record \u003d self._get_subnet(context, id)"},{"line_number":491,"context_line":"                    session.delete(record)"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"                    break"},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"            for a in allocated:"},{"line_number":496,"context_line":"                self.delete_port(context, a.port_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAS3%2F%2FDxY%3D","line":493,"in_reply_to":"AAAAS3%2F%2FD6M%3D","updated":"2013-10-05 13:28:59.000000000","message":"That bug 1235486 looks to me like it might be caused by the error on line 395 that I pointed out in patch set 2.","commit_id":"23fd84086abc996087a329a7f0d3000674f12162"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"47806731eab409e89982435009cc07739258b522","unresolved":false,"context_lines":[{"line_number":490,"context_line":"                    record \u003d self._get_subnet(context, id)"},{"line_number":491,"context_line":"                    session.delete(record)"},{"line_number":492,"context_line":""},{"line_number":493,"context_line":"                    break"},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"            for a in allocated:"},{"line_number":496,"context_line":"                self.delete_port(context, a.port_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"AAAAS3%2F%2FD5w%3D","line":493,"in_reply_to":"AAAAS3%2F%2FD6M%3D","updated":"2013-10-05 09:19:29.000000000","message":"i think the bug might be a result of not invoking the code in this change.\n\nBreaking in case there are no ports on the subnet seems ok to me","commit_id":"23fd84086abc996087a329a7f0d3000674f12162"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"fdbcac976771f63754542a8b80870796eea724d8","unresolved":false,"context_lines":[{"line_number":376,"context_line":"        # drivers from being called. This approach should be revisited"},{"line_number":377,"context_line":"        # when the API layer is reworked during icehouse."},{"line_number":378,"context_line":""},{"line_number":379,"context_line":"        LOG.debug(\"deleting network %s\" % id)"},{"line_number":380,"context_line":"        session \u003d context.session"},{"line_number":381,"context_line":"        filter \u003d {\u0027network_id\u0027: [id]}"},{"line_number":382,"context_line":"        while True:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F5eI%3D","line":379,"updated":"2013-10-08 11:23:01.000000000","message":"All the log statements here might need internationalization.\nalso % might be replace with a comma in a log stament","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"4cdb284fd82976ad60a71bf42db8adaec11a865e","unresolved":false,"context_lines":[{"line_number":376,"context_line":"        # drivers from being called. This approach should be revisited"},{"line_number":377,"context_line":"        # when the API layer is reworked during icehouse."},{"line_number":378,"context_line":""},{"line_number":379,"context_line":"        LOG.debug(\"deleting network %s\" % id)"},{"line_number":380,"context_line":"        session \u003d context.session"},{"line_number":381,"context_line":"        filter \u003d {\u0027network_id\u0027: [id]}"},{"line_number":382,"context_line":"        while True:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F31g%3D","line":379,"in_reply_to":"AAAATH%2F%2F4do%3D","updated":"2013-10-08 20:42:04.000000000","message":"Done","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"ab12004398b9794ed1a17bcd5012b49aeb8b4eda","unresolved":false,"context_lines":[{"line_number":376,"context_line":"        # drivers from being called. This approach should be revisited"},{"line_number":377,"context_line":"        # when the API layer is reworked during icehouse."},{"line_number":378,"context_line":""},{"line_number":379,"context_line":"        LOG.debug(\"deleting network %s\" % id)"},{"line_number":380,"context_line":"        session \u003d context.session"},{"line_number":381,"context_line":"        filter \u003d {\u0027network_id\u0027: [id]}"},{"line_number":382,"context_line":"        while True:"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4do%3D","line":379,"in_reply_to":"AAAATH%2F%2F5eI%3D","updated":"2013-10-08 15:45:21.000000000","message":"I had intended the log statements to be temporary, to try to track down a failure mode that occurred in the gate where the network delete failed due to foreign keys from ports that should have been auto-deleted. Unfortunately, that failure mode has not recurred with the logging. I\u0027m leaning towards keeping some of the logging, and will fix it in the next update.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d7ef27e3201a3f3bd74f226247ae2822e89bca5a","unresolved":false,"context_lines":[{"line_number":382,"context_line":"        while True:"},{"line_number":383,"context_line":"            with session.begin(subtransactions\u003dTrue):"},{"line_number":384,"context_line":"                # Get ports to auto-delete."},{"line_number":385,"context_line":"                ports \u003d self.get_ports(context, filters\u003dfilter)"},{"line_number":386,"context_line":"                LOG.debug(\"ports to auto-delete: %s\" % ports)"},{"line_number":387,"context_line":"                only_auto_del \u003d all(p[\u0027device_owner\u0027]"},{"line_number":388,"context_line":"                                    in db_base_plugin_v2."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4ZQ%3D","line":385,"updated":"2013-10-08 15:00:56.000000000","message":"is it important here that you use the core plugin\u0027s version of get_ports instead of just doing a DB call using _get_ports? get_ports won\u0027t be doing a locking read, so there\u0027s a chance you\u0027d be  deleting ports down below that have already being deleted. As per MySQL documentation:\n\nConsistent read is the default mode in which InnoDB processes SELECT statements in READ COMMITTED and REPEATABLE READ isolation levels. A consistent read does not set any locks on the tables it accesses, and therefore other sessions are free to modify those tables at the same time a consistent read is being performed on the table.\n\nSuppose that you are running in the default REPEATABLE READ isolation level. When you issue a consistent read (that is, an ordinary SELECT statement), InnoDB gives your transaction a timepoint according to which your query sees the database. If another transaction deletes a row and commits after your timepoint was assigned, you do not see the row as having been deleted. Inserts and updates are treated similarly.\n\nThis means that if a concurrent delete_subnet is issued and delete_network getting too long from here till line 419 you\u0027d end up having errors while deleting ports that no longer exists.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"4cdb284fd82976ad60a71bf42db8adaec11a865e","unresolved":false,"context_lines":[{"line_number":382,"context_line":"        while True:"},{"line_number":383,"context_line":"            with session.begin(subtransactions\u003dTrue):"},{"line_number":384,"context_line":"                # Get ports to auto-delete."},{"line_number":385,"context_line":"                ports \u003d self.get_ports(context, filters\u003dfilter)"},{"line_number":386,"context_line":"                LOG.debug(\"ports to auto-delete: %s\" % ports)"},{"line_number":387,"context_line":"                only_auto_del \u003d all(p[\u0027device_owner\u0027]"},{"line_number":388,"context_line":"                                    in db_base_plugin_v2."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F3H4%3D","line":385,"in_reply_to":"AAAATH%2F%2F4N8%3D","updated":"2013-10-08 20:42:04.000000000","message":"Done","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"ab12004398b9794ed1a17bcd5012b49aeb8b4eda","unresolved":false,"context_lines":[{"line_number":382,"context_line":"        while True:"},{"line_number":383,"context_line":"            with session.begin(subtransactions\u003dTrue):"},{"line_number":384,"context_line":"                # Get ports to auto-delete."},{"line_number":385,"context_line":"                ports \u003d self.get_ports(context, filters\u003dfilter)"},{"line_number":386,"context_line":"                LOG.debug(\"ports to auto-delete: %s\" % ports)"},{"line_number":387,"context_line":"                only_auto_del \u003d all(p[\u0027device_owner\u0027]"},{"line_number":388,"context_line":"                                    in db_base_plugin_v2."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4N8%3D","line":385,"in_reply_to":"AAAATH%2F%2F4ZQ%3D","updated":"2013-10-08 15:45:21.000000000","message":"You\u0027ve convinced me (here and in our IRC conversation) that locking is needed, similar to what you are proposing in https://review.openstack.org/46563.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"fdbcac976771f63754542a8b80870796eea724d8","unresolved":false,"context_lines":[{"line_number":389,"context_line":"                                    AUTO_DELETE_PORT_OWNERS"},{"line_number":390,"context_line":"                                    for p in ports)"},{"line_number":391,"context_line":"                if not only_auto_del:"},{"line_number":392,"context_line":"                    LOG.debug(\"raising NetworkInUse\")"},{"line_number":393,"context_line":"                    raise exc.NetworkInUse(net_id\u003did)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"                # Get subnets to auto-delete."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F5eE%3D","line":392,"updated":"2013-10-08 11:23:01.000000000","message":"not sure we need the above statement, the exception is going to be logged anyway","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"4cdb284fd82976ad60a71bf42db8adaec11a865e","unresolved":false,"context_lines":[{"line_number":389,"context_line":"                                    AUTO_DELETE_PORT_OWNERS"},{"line_number":390,"context_line":"                                    for p in ports)"},{"line_number":391,"context_line":"                if not only_auto_del:"},{"line_number":392,"context_line":"                    LOG.debug(\"raising NetworkInUse\")"},{"line_number":393,"context_line":"                    raise exc.NetworkInUse(net_id\u003did)"},{"line_number":394,"context_line":""},{"line_number":395,"context_line":"                # Get subnets to auto-delete."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F31U%3D","line":392,"in_reply_to":"AAAATH%2F%2F5eE%3D","updated":"2013-10-08 20:42:04.000000000","message":"Changed the message, but keeping it to make it clear exactly where in the log the exception originates.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d7ef27e3201a3f3bd74f226247ae2822e89bca5a","unresolved":false,"context_lines":[{"line_number":406,"context_line":""},{"line_number":407,"context_line":"                    LOG.debug(\"deleting network record\")"},{"line_number":408,"context_line":"                    record \u003d self._get_network(context, id)"},{"line_number":409,"context_line":"                    session.delete(record)"},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"                    for segment in mech_context.network_segments:"},{"line_number":412,"context_line":"                        self.type_manager.release_segment(session, segment)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4YU%3D","line":409,"updated":"2013-10-08 15:00:56.000000000","message":"You cannot delete the record here before deleting the ports: this will cause a fk violation because mysql will do a CASCADE SET  NULL on the network column for the port rows affected and that\u0027s invalid. You must delete the ports first","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"ab12004398b9794ed1a17bcd5012b49aeb8b4eda","unresolved":false,"context_lines":[{"line_number":406,"context_line":""},{"line_number":407,"context_line":"                    LOG.debug(\"deleting network record\")"},{"line_number":408,"context_line":"                    record \u003d self._get_network(context, id)"},{"line_number":409,"context_line":"                    session.delete(record)"},{"line_number":410,"context_line":""},{"line_number":411,"context_line":"                    for segment in mech_context.network_segments:"},{"line_number":412,"context_line":"                        self.type_manager.release_segment(session, segment)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4MQ%3D","line":409,"in_reply_to":"AAAATH%2F%2F4YU%3D","updated":"2013-10-08 15:45:21.000000000","message":"That is the purpose of the loop. We only get here if we have entered the top of the loop, started the transaction, and determined within the transaction (in line 399) that no auto-deletion is necessary. If auto-deletion was necessary, we would have closed the transaction, done the auto-deletion, and repeated the loop. So any needed deletion will always have been performed (outside the transaction) before we get here and delete the network record.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"fdbcac976771f63754542a8b80870796eea724d8","unresolved":false,"context_lines":[{"line_number":470,"context_line":"        # DB without invoking the derived class\u0027s delete_port(),"},{"line_number":471,"context_line":"        # preventing mechanism drivers from being called. This"},{"line_number":472,"context_line":"        # approach should be revisited when the API layer is reworked"},{"line_number":473,"context_line":"        # during icehouse."},{"line_number":474,"context_line":""},{"line_number":475,"context_line":"        LOG.debug(\"deleting subnet %s\" % id)"},{"line_number":476,"context_line":"        session \u003d context.session"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F5dA%3D","line":473,"updated":"2013-10-08 11:23:01.000000000","message":"You might just change the code to invoke the plugin\u0027s delete operation instead of doing a simple db delete.\n\nPerhaps it\u0027s might easier than a \"rework\" of the API layer.\nUnless you need to redo it for other reasons anyway.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"ab12004398b9794ed1a17bcd5012b49aeb8b4eda","unresolved":false,"context_lines":[{"line_number":470,"context_line":"        # DB without invoking the derived class\u0027s delete_port(),"},{"line_number":471,"context_line":"        # preventing mechanism drivers from being called. This"},{"line_number":472,"context_line":"        # approach should be revisited when the API layer is reworked"},{"line_number":473,"context_line":"        # during icehouse."},{"line_number":474,"context_line":""},{"line_number":475,"context_line":"        LOG.debug(\"deleting subnet %s\" % id)"},{"line_number":476,"context_line":"        session \u003d context.session"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4Sw%3D","line":473,"in_reply_to":"AAAATH%2F%2F5dA%3D","updated":"2013-10-08 15:45:21.000000000","message":"My original plan was to simply call the plugin methods from NeutronDBPluginV2 to do the deletes as you suggest. But ML2 requires these methods to be called outside of any transaction (ML2 calls precommit and postcommit methods on the mechanism drivers for each create/update/delete), so this same loop approach would be needed in the base class. That could certainly be implemented, and would have been my preference earlier in the havana development cycle. But since other plugins have code working around the fact that their methods are not called for auto-deletes, there is risk these would break and need updates. So I think the current approach is the best option for havana.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"d7ef27e3201a3f3bd74f226247ae2822e89bca5a","unresolved":false,"context_lines":[{"line_number":479,"context_line":"                allocated \u003d (session.query(models_v2.IPAllocation)."},{"line_number":480,"context_line":"                             options(orm.joinedload(\u0027ports\u0027))."},{"line_number":481,"context_line":"                             filter_by(subnet_id\u003did)."},{"line_number":482,"context_line":"                             all())"},{"line_number":483,"context_line":"                LOG.debug(\"ports to auto-delete: %s\" % allocated)"},{"line_number":484,"context_line":"                only_auto_del \u003d all(not a.port_id or"},{"line_number":485,"context_line":"                                    a.ports.device_owner in db_base_plugin_v2."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4YM%3D","line":482,"updated":"2013-10-08 15:00:56.000000000","message":"you\u0027d need to lock for update here too, in case concurrent subnet and network deletions occur","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"4cdb284fd82976ad60a71bf42db8adaec11a865e","unresolved":false,"context_lines":[{"line_number":479,"context_line":"                allocated \u003d (session.query(models_v2.IPAllocation)."},{"line_number":480,"context_line":"                             options(orm.joinedload(\u0027ports\u0027))."},{"line_number":481,"context_line":"                             filter_by(subnet_id\u003did)."},{"line_number":482,"context_line":"                             all())"},{"line_number":483,"context_line":"                LOG.debug(\"ports to auto-delete: %s\" % allocated)"},{"line_number":484,"context_line":"                only_auto_del \u003d all(not a.port_id or"},{"line_number":485,"context_line":"                                    a.ports.device_owner in db_base_plugin_v2."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F3Hw%3D","line":482,"in_reply_to":"AAAATH%2F%2F4MA%3D","updated":"2013-10-08 20:42:04.000000000","message":"Done","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"ab12004398b9794ed1a17bcd5012b49aeb8b4eda","unresolved":false,"context_lines":[{"line_number":479,"context_line":"                allocated \u003d (session.query(models_v2.IPAllocation)."},{"line_number":480,"context_line":"                             options(orm.joinedload(\u0027ports\u0027))."},{"line_number":481,"context_line":"                             filter_by(subnet_id\u003did)."},{"line_number":482,"context_line":"                             all())"},{"line_number":483,"context_line":"                LOG.debug(\"ports to auto-delete: %s\" % allocated)"},{"line_number":484,"context_line":"                only_auto_del \u003d all(not a.port_id or"},{"line_number":485,"context_line":"                                    a.ports.device_owner in db_base_plugin_v2."}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4MA%3D","line":482,"in_reply_to":"AAAATH%2F%2F4YM%3D","updated":"2013-10-08 15:45:21.000000000","message":"Right.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"fdbcac976771f63754542a8b80870796eea724d8","unresolved":false,"context_lines":[{"line_number":504,"context_line":"                    break"},{"line_number":505,"context_line":""},{"line_number":506,"context_line":"            for a in allocated:"},{"line_number":507,"context_line":"                self.delete_port(context, a.port_id)"},{"line_number":508,"context_line":""},{"line_number":509,"context_line":"        try:"},{"line_number":510,"context_line":"            self.mechanism_manager.delete_subnet_postcommit(mech_context)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F5cE%3D","line":507,"updated":"2013-10-08 11:23:01.000000000","message":"Technically, if port deletion and subnet deletion are not in the same transaction we should do some rollback or mitigation action if we fail to delete a port.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"4cdb284fd82976ad60a71bf42db8adaec11a865e","unresolved":false,"context_lines":[{"line_number":504,"context_line":"                    break"},{"line_number":505,"context_line":""},{"line_number":506,"context_line":"            for a in allocated:"},{"line_number":507,"context_line":"                self.delete_port(context, a.port_id)"},{"line_number":508,"context_line":""},{"line_number":509,"context_line":"        try:"},{"line_number":510,"context_line":"            self.mechanism_manager.delete_subnet_postcommit(mech_context)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F3Hk%3D","line":507,"in_reply_to":"AAAATH%2F%2F4PY%3D","updated":"2013-10-08 20:42:04.000000000","message":"Added code to catch and log exceptions raised during auto-deletion of ports and subnets.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"ab12004398b9794ed1a17bcd5012b49aeb8b4eda","unresolved":false,"context_lines":[{"line_number":504,"context_line":"                    break"},{"line_number":505,"context_line":""},{"line_number":506,"context_line":"            for a in allocated:"},{"line_number":507,"context_line":"                self.delete_port(context, a.port_id)"},{"line_number":508,"context_line":""},{"line_number":509,"context_line":"        try:"},{"line_number":510,"context_line":"            self.mechanism_manager.delete_subnet_postcommit(mech_context)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F4PY%3D","line":507,"in_reply_to":"AAAATH%2F%2F5cE%3D","updated":"2013-10-08 15:45:21.000000000","message":"I don\u0027t think it would be workable to re-create ports or subnets once they have been auto-deleted. Maybe it would be worth catching and ignoring certain exceptions from the delete_port or delete_subnet calls, but I\u0027m not really sure of this. If the client gets an exception from delete_network or delete_subnet, it has to assume auto-deletes might have occurred.\n\nLong term, I think we need a consistent approach to whether the DB layer or the plugin controls the transaction, with the plugin having the opportunity to execute code both before and after the DB transaction commits. At the same time, we should structure bulk operations so that the DB updates all happen within a single transaction, and the postcommit processing all happens afterwards.","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"fdbcac976771f63754542a8b80870796eea724d8","unresolved":false,"context_lines":[{"line_number":512,"context_line":"            # TODO(apech) - One or more mechanism driver failed to"},{"line_number":513,"context_line":"            # delete the subnet.  Ideally we\u0027d notify the caller of"},{"line_number":514,"context_line":"            # the fact that an error occurred."},{"line_number":515,"context_line":"            pass"},{"line_number":516,"context_line":""},{"line_number":517,"context_line":"    def create_port(self, context, port):"},{"line_number":518,"context_line":"        attrs \u003d port[\u0027port\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F5b4%3D","line":515,"updated":"2013-10-08 11:23:01.000000000","message":"unrelated comment: this probably needs a log statement","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"4cdb284fd82976ad60a71bf42db8adaec11a865e","unresolved":false,"context_lines":[{"line_number":512,"context_line":"            # TODO(apech) - One or more mechanism driver failed to"},{"line_number":513,"context_line":"            # delete the subnet.  Ideally we\u0027d notify the caller of"},{"line_number":514,"context_line":"            # the fact that an error occurred."},{"line_number":515,"context_line":"            pass"},{"line_number":516,"context_line":""},{"line_number":517,"context_line":"    def create_port(self, context, port):"},{"line_number":518,"context_line":"        attrs \u003d port[\u0027port\u0027]"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAATH%2F%2F3xk%3D","line":515,"in_reply_to":"AAAATH%2F%2F5b4%3D","updated":"2013-10-08 20:42:04.000000000","message":"Done","commit_id":"1663becdf30c95ad34c1c2b15fb3f05b3a8ec666"},{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"707eac8c749548e523fadb5d4fe416ddbc0b509c","unresolved":false,"context_lines":[{"line_number":382,"context_line":"        while True:"},{"line_number":383,"context_line":"            with session.begin(subtransactions\u003dTrue):"},{"line_number":384,"context_line":"                # Get ports to auto-delete."},{"line_number":385,"context_line":"                ports \u003d (self._get_ports_query(context, filters\u003dfilter)."},{"line_number":386,"context_line":"                         all())"},{"line_number":387,"context_line":"                LOG.debug(_(\"Ports to auto-delete: %s\"), ports)"},{"line_number":388,"context_line":"                only_auto_del \u003d all(p.device_owner"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAATH%2F%2FvB0%3D","line":385,"updated":"2013-10-10 14:33:48.000000000","message":"Could refactor out duplication here and in L497-508.","commit_id":"ed78b563e13f1ed9189d7c4b9cd4317f2a50e734"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"00a41fbbbcf4bbebb766a5f761a28314f6effea2","unresolved":false,"context_lines":[{"line_number":491,"context_line":""},{"line_number":492,"context_line":"        LOG.debug(_(\"Deleting subnet %s\"), id)"},{"line_number":493,"context_line":"        session \u003d context.session"},{"line_number":494,"context_line":"        while True:"},{"line_number":495,"context_line":"            with session.begin(subtransactions\u003dTrue):"},{"line_number":496,"context_line":"                # Get ports to auto-delete."},{"line_number":497,"context_line":"                allocated \u003d (session.query(models_v2.IPAllocation)."}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAATH%2F%2Fqn0%3D","line":494,"updated":"2013-10-11 14:27:17.000000000","message":"Why do we need this while?  This code cannot loop due to the break and raises.","commit_id":"ed78b563e13f1ed9189d7c4b9cd4317f2a50e734"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"e3ea4d11bbf8d69428eeffb861a10d70152b56f8","unresolved":false,"context_lines":[{"line_number":491,"context_line":""},{"line_number":492,"context_line":"        LOG.debug(_(\"Deleting subnet %s\"), id)"},{"line_number":493,"context_line":"        session \u003d context.session"},{"line_number":494,"context_line":"        while True:"},{"line_number":495,"context_line":"            with session.begin(subtransactions\u003dTrue):"},{"line_number":496,"context_line":"                # Get ports to auto-delete."},{"line_number":497,"context_line":"                allocated \u003d (session.query(models_v2.IPAllocation)."}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAATH%2F%2FqYY%3D","line":494,"in_reply_to":"AAAATH%2F%2Fqaw%3D","updated":"2013-10-11 15:18:02.000000000","message":"Thanks for clarifying.","commit_id":"ed78b563e13f1ed9189d7c4b9cd4317f2a50e734"},{"author":{"_account_id":1689,"name":"Robert Kukura","email":"rk@theep.net","username":"rkukura"},"change_message_id":"c9d1ab77cbdb1b1688af788cc96bb4f8d1ede23f","unresolved":false,"context_lines":[{"line_number":491,"context_line":""},{"line_number":492,"context_line":"        LOG.debug(_(\"Deleting subnet %s\"), id)"},{"line_number":493,"context_line":"        session \u003d context.session"},{"line_number":494,"context_line":"        while True:"},{"line_number":495,"context_line":"            with session.begin(subtransactions\u003dTrue):"},{"line_number":496,"context_line":"                # Get ports to auto-delete."},{"line_number":497,"context_line":"                allocated \u003d (session.query(models_v2.IPAllocation)."}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAATH%2F%2Fqaw%3D","line":494,"in_reply_to":"AAAATH%2F%2Fqn0%3D","updated":"2013-10-11 15:11:14.000000000","message":"Mark, like the similar loop in delete_network(), it loops when there are resource to auto-delete. In this case, the condition on line 510 is false, so it continues on line 524, which is outside the the transaction (the with clause on line 495). If no exception is raised auto-deleting on lines 524-532, the loop repeats, starting a new transaction.","commit_id":"ed78b563e13f1ed9189d7c4b9cd4317f2a50e734"}]}
