)]}'
{"neutron/db/db_base_plugin_v2.py":[{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"81d58805733702098e55646cfaec0bea847dcb59","unresolved":false,"context_lines":[{"line_number":1291,"context_line":"                else:"},{"line_number":1292,"context_line":"                    raise n_exc.SubnetInUse(subnet_id\u003did)"},{"line_number":1293,"context_line":""},{"line_number":1294,"context_line":"            self._check_subnet_in_use_by_services(context, id)"},{"line_number":1295,"context_line":"            context.session.delete(subnet)"},{"line_number":1296,"context_line":""},{"line_number":1297,"context_line":"    def get_subnet(self, context, id, fields\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_7e13ebb7","line":1294,"updated":"2014-11-24 19:21:57.000000000","message":"this is not optimal because you are adding another call to the DB. If I understand it correctly the bug was filed to get better logging. If there\u0027s a VPN attached the subnet delete fails because of a DB constraint violation, a DBError exception is thrown. Do you think it would be acceptable to modify _check_subnet_in_use_by_services and instead of calling the DB, catch the DBError exception, inspect the stacktrace to get the useful info to log and throw it again? In this way it\u0027s also easier to generalize it for other services.","commit_id":"507102b0107259c5307f1193f841c7a06fe1b3be"},{"author":{"_account_id":10237,"name":"Numan Siddique","email":"nusiddiq@redhat.com","username":"numansiddique"},"change_message_id":"6c357c2aef960821984bf5dcca897b3c2d0c9363","unresolved":false,"context_lines":[{"line_number":1291,"context_line":"                else:"},{"line_number":1292,"context_line":"                    raise n_exc.SubnetInUse(subnet_id\u003did)"},{"line_number":1293,"context_line":""},{"line_number":1294,"context_line":"            self._check_subnet_in_use_by_services(context, id)"},{"line_number":1295,"context_line":"            context.session.delete(subnet)"},{"line_number":1296,"context_line":""},{"line_number":1297,"context_line":"    def get_subnet(self, context, id, fields\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_be6545b0","line":1294,"in_reply_to":"5a890539_7e13ebb7","updated":"2014-11-25 06:57:48.000000000","message":"DBError exception is thrown at the end of the \"with\" (I think in the session.commit()).\nSince context.session.delete is not raising the DBError exception, I am not sure how to catch this.\n\nAlso, router_interface_delete also calls \"vpnservice.check_subnet_in_use\" to check if the router interface is still used by vpnservice (https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L537)\n\nHence I took this approach.\n\nIn my opinion its better to check for foreign key constraints before calling session.delete rather than catching the DBError exception. But since I am new to db, I am not sure what is the right approach.","commit_id":"507102b0107259c5307f1193f841c7a06fe1b3be"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"48809e6c40933169fea4ef9e24e29262af96b320","unresolved":false,"context_lines":[{"line_number":1291,"context_line":"                else:"},{"line_number":1292,"context_line":"                    raise n_exc.SubnetInUse(subnet_id\u003did)"},{"line_number":1293,"context_line":""},{"line_number":1294,"context_line":"            self._check_subnet_in_use_by_services(context, id)"},{"line_number":1295,"context_line":"            context.session.delete(subnet)"},{"line_number":1296,"context_line":""},{"line_number":1297,"context_line":"    def get_subnet(self, context, id, fields\u003dNone):"}],"source_content_type":"text/x-python","patch_set":3,"id":"5a890539_416c7d08","line":1294,"in_reply_to":"5a890539_be6545b0","updated":"2014-11-25 10:47:52.000000000","message":"You can catch it putting a try/except block that surrounds the \"with\", before line 1273\n\nYou are right that router_interface_delete check if the vpn service uses the router interface but in this case it\u0027s done for correctness, no DBError would be thrown. The port is deleted and VPNService has no foreign key using the port.\n\nI prefer avoiding to add calls to the DB if it\u0027s not necessary. Anyway let\u0027s hear other opinions, I am gonna remove my -1","commit_id":"507102b0107259c5307f1193f841c7a06fe1b3be"},{"author":{"_account_id":10370,"name":"Romil Gupta","email":"romilgupta19@gmail.com","username":"romilg"},"change_message_id":"c22fe75be8fcede25a2831af2551d5d455101ab0","unresolved":false,"context_lines":[{"line_number":1537,"context_line":""},{"line_number":1538,"context_line":"    def _check_subnet_in_use_by_services(self, context, subnet_id):"},{"line_number":1539,"context_line":"        vpnservice \u003d manager.NeutronManager.get_service_plugins().get("},{"line_number":1540,"context_line":"            service_constants.VPN)"},{"line_number":1541,"context_line":"        if vpnservice:"},{"line_number":1542,"context_line":"            vpnservice.check_subnet_in_use(context, subnet_id)"}],"source_content_type":"text/x-python","patch_set":4,"id":"3a961159_c579b9fd","line":1540,"updated":"2014-12-18 10:23:19.000000000","message":"Probably, we could use property something like this:\n\n    @property\n    def service_plugin(self):\n        return manager.NeutronManager.get_service_plugins()","commit_id":"90fb063fa43e7fa281b03617eb576ff97f116e93"}],"neutron/plugins/ml2/plugin.py":[{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"6d77a57191d9b534ee049485f95ad87cdd82af87","unresolved":false,"context_lines":[{"line_number":735,"context_line":"                    LOG.debug(_(\"Tenant-owned ports exist\"))"},{"line_number":736,"context_line":"                    raise exc.SubnetInUse(subnet_id\u003did)"},{"line_number":737,"context_line":""},{"line_number":738,"context_line":"                self._check_subnet_in_use_by_services(context, id)"},{"line_number":739,"context_line":"                if not allocated:"},{"line_number":740,"context_line":"                    mech_context \u003d driver_context.SubnetContext(self, context,"},{"line_number":741,"context_line":"                                                                subnet)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a890539_405e8e46","line":738,"updated":"2014-11-21 10:27:56.000000000","message":"i believe this should be moved to a base class - NeutronDbPluginV2, otherwise you fixing the issue for ml2 plugin only.","commit_id":"6c866c37515c30e14a4bf58971d20bb24aafcbe7"},{"author":{"_account_id":10237,"name":"Numan Siddique","email":"nusiddiq@redhat.com","username":"numansiddique"},"change_message_id":"54fef09a349415a901dad0bbf6972cc1d77b631c","unresolved":false,"context_lines":[{"line_number":735,"context_line":"                    LOG.debug(_(\"Tenant-owned ports exist\"))"},{"line_number":736,"context_line":"                    raise exc.SubnetInUse(subnet_id\u003did)"},{"line_number":737,"context_line":""},{"line_number":738,"context_line":"                self._check_subnet_in_use_by_services(context, id)"},{"line_number":739,"context_line":"                if not allocated:"},{"line_number":740,"context_line":"                    mech_context \u003d driver_context.SubnetContext(self, context,"},{"line_number":741,"context_line":"                                                                subnet)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5a890539_26c43a91","line":738,"in_reply_to":"5a890539_405e8e46","updated":"2014-11-21 11:05:27.000000000","message":"Since delete_subnet doesn\u0027t call the base class \u0027subnet_delete\u0027, I couldn\u0027t move the fix to the base class.\nPlease see L705.\nYou think this function should call base class \u0027subnet_delete\u0027 ?","commit_id":"6c866c37515c30e14a4bf58971d20bb24aafcbe7"}]}
