)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"576839fd5f6323ffdef5b5e6a4bfe6e6eed3b1df","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Change-Id: I056d698ce2e312527e756ff56c962cff83a6bc04"},{"line_number":17,"context_line":"Partially-Implements: blueprint midonet-plugin-juno"},{"line_number":18,"context_line":"Signed-off-by: Joe Mills \u003cjoe@midokura.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"baada198_7cb923eb","line":18,"updated":"2014-07-25 16:54:03.000000000","message":"nit: this line can be removed","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"5e0364ab59747f7f7e2232c6fb58b9e01ea4a3e2","unresolved":false,"context_lines":[{"line_number":15,"context_line":""},{"line_number":16,"context_line":"Change-Id: I056d698ce2e312527e756ff56c962cff83a6bc04"},{"line_number":17,"context_line":"Partially-Implements: blueprint midonet-plugin-juno"},{"line_number":18,"context_line":"Signed-off-by: Joe Mills \u003cjoe@midokura.com\u003e"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"baada198_8c19427c","line":18,"in_reply_to":"baada198_7cb923eb","updated":"2014-07-28 08:14:45.000000000","message":"Done","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"}],"neutron/plugins/midonet/plugin.py":[{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"19ad6b18fc80a735a4c566f3c0f6082dd954b4a5","unresolved":false,"context_lines":[{"line_number":28,"context_line":""},{"line_number":29,"context_line":"from midonetclient import api"},{"line_number":30,"context_line":"from midonetclient import exc"},{"line_number":31,"context_line":"from midonetclient.neutron import client as n_client"},{"line_number":32,"context_line":"from neutron.api.v2 import attributes"},{"line_number":33,"context_line":"from neutron.common import constants"},{"line_number":34,"context_line":"from neutron.common import exceptions as n_exc"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_7beff4b0","line":31,"updated":"2014-07-01 12:38:28.000000000","message":"midonetclient imports should be grouped with other 3rd party modules like oslo.","commit_id":"0c6342e2332ba0351bf091ee98813793e570252d"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"19ad6b18fc80a735a4c566f3c0f6082dd954b4a5","unresolved":false,"context_lines":[{"line_number":82,"context_line":""},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"class MidonetApiException(n_exc.NeutronException):"},{"line_number":85,"context_line":"        message \u003d _(\"MidoNet API error: %(msg)s\")"},{"line_number":86,"context_line":""},{"line_number":87,"context_line":""},{"line_number":88,"context_line":"def _get_nat_ips(type, fip):"}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_5b2f90a1","line":85,"updated":"2014-07-01 12:38:28.000000000","message":"wrong indent?","commit_id":"0c6342e2332ba0351bf091ee98813793e570252d"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"19ad6b18fc80a735a4c566f3c0f6082dd954b4a5","unresolved":false,"context_lines":[{"line_number":529,"context_line":""},{"line_number":530,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":531,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":532,"context_line":"            self.api_cli.delete_network(id)"},{"line_number":533,"context_line":""},{"line_number":534,"context_line":"        LOG.info(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":535,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"baada198_fe25b2ab","line":532,"updated":"2014-07-01 12:38:28.000000000","message":"some of api calls are in a transaction and others are not.\nwhy are they inconsistent?","commit_id":"0c6342e2332ba0351bf091ee98813793e570252d"},{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"30db1f300cbf85b5ea9de9ae36a021556180f096","unresolved":false,"context_lines":[{"line_number":71,"context_line":"SNAT_RULE \u003d \u0027SNAT\u0027"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"def handle_api_error(fn):"},{"line_number":75,"context_line":"    \"\"\"Wrapper for methods that throws custom exceptions.\"\"\""},{"line_number":76,"context_line":"    def wrapped(*args, **kwargs):"},{"line_number":77,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_5fb1b88f","line":74,"updated":"2014-07-25 14:10:38.000000000","message":"Will use of this wrapper, hide traceback info for original exception? Thinking you may need functools.wraps decorator on the wrapped() method.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"5e0364ab59747f7f7e2232c6fb58b9e01ea4a3e2","unresolved":false,"context_lines":[{"line_number":71,"context_line":"SNAT_RULE \u003d \u0027SNAT\u0027"},{"line_number":72,"context_line":""},{"line_number":73,"context_line":""},{"line_number":74,"context_line":"def handle_api_error(fn):"},{"line_number":75,"context_line":"    \"\"\"Wrapper for methods that throws custom exceptions.\"\"\""},{"line_number":76,"context_line":"    def wrapped(*args, **kwargs):"},{"line_number":77,"context_line":"        try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_2c203699","line":74,"in_reply_to":"baada198_5fb1b88f","updated":"2014-07-28 08:14:45.000000000","message":"Done","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"576839fd5f6323ffdef5b5e6a4bfe6e6eed3b1df","unresolved":false,"context_lines":[{"line_number":473,"context_line":""},{"line_number":474,"context_line":"        Create a new Neutron network and its corresponding MidoNet bridge."},{"line_number":475,"context_line":"        \"\"\""},{"line_number":476,"context_line":"        LOG.info(_(\u0027MidonetPluginV2.create_network called: network\u003d%r\u0027),"},{"line_number":477,"context_line":"                 network)"},{"line_number":478,"context_line":""},{"line_number":479,"context_line":"        net_data \u003d network[\u0027network\u0027]"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_1cd747c0","line":476,"updated":"2014-07-25 16:54:03.000000000","message":"nit: please avoid 2 log statement at info level for the same function. See https://wiki.openstack.org/wiki/LoggingStandards","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"9e5cfd2ff30b897e44ed2fbf58f1e94b6255bab0","unresolved":false,"context_lines":[{"line_number":484,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":485,"context_line":"            net \u003d super(MidonetPluginV2, self).create_network(context, network)"},{"line_number":486,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":487,"context_line":"            self.api_cli.create_network(net)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"        LOG.info(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":490,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_8b97dd8f","line":487,"updated":"2014-07-02 18:03:32.000000000","message":"doing rpc in a transaction is dangerous for the default mysql dialect.\nhttp://docs.openstack.org/developer/nova/devref/threading.html#mysql-access-and-eventlet\n\nit might not be a problem as this is vendor plugin and you can choose a better db/dialect, though.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"8e24d7ae8adfff2f219db715a536b7c2229aac06","unresolved":false,"context_lines":[{"line_number":484,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":485,"context_line":"            net \u003d super(MidonetPluginV2, self).create_network(context, network)"},{"line_number":486,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":487,"context_line":"            self.api_cli.create_network(net)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"        LOG.info(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":490,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_94bfeefa","line":487,"in_reply_to":"baada198_8b97dd8f","updated":"2014-07-03 01:35:02.000000000","message":"Thanks for pointing out the potential blocking issue here. We chose to accept this risk for the sake of simplicity in the code and keeping the data consistent across the neutron database and our backend. If any users of our plugin need better performance, we expect them to deploy with a different DB than mysql.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":1923,"name":"Mohammad Banikazemi","email":"mbanikazemi@gmail.com","username":"mb-s"},"change_message_id":"2b0ef66dba13e6dce4c49ff8b75e313337e5612b","unresolved":false,"context_lines":[{"line_number":484,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":485,"context_line":"            net \u003d super(MidonetPluginV2, self).create_network(context, network)"},{"line_number":486,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":487,"context_line":"            self.api_cli.create_network(net)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"        LOG.info(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":490,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_ca3d132d","line":487,"in_reply_to":"baada198_94bfeefa","updated":"2014-07-04 03:06:50.000000000","message":"This is not mainly a matter of performance. Please see the email thread here: http://lists.openstack.org/pipermail/openstack-dev/2013-December/021913.html and the thread referenced in it.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":1923,"name":"Mohammad Banikazemi","email":"mbanikazemi@gmail.com","username":"mb-s"},"change_message_id":"66f0e25ed2b68a3c046613891d3e76836c87d80a","unresolved":false,"context_lines":[{"line_number":484,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":485,"context_line":"            net \u003d super(MidonetPluginV2, self).create_network(context, network)"},{"line_number":486,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":487,"context_line":"            self.api_cli.create_network(net)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"        LOG.info(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":490,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_2854a952","line":487,"in_reply_to":"baada198_bc557b53","updated":"2014-07-28 02:36:56.000000000","message":"Agree. The solution is simple enough that you should see if you could take calls to the controller out of the transaction. More difficult cases are say in update port but those are not part of this patch set.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"576839fd5f6323ffdef5b5e6a4bfe6e6eed3b1df","unresolved":false,"context_lines":[{"line_number":484,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":485,"context_line":"            net \u003d super(MidonetPluginV2, self).create_network(context, network)"},{"line_number":486,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":487,"context_line":"            self.api_cli.create_network(net)"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"        LOG.info(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":490,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_bc557b53","line":487,"in_reply_to":"baada198_ca3d132d","updated":"2014-07-25 16:54:03.000000000","message":"Joe, it\u0027s really a problem. To summarize eventlet might switch to another green thread at line 487, the transaction is not closed so the tables locked by that transaction will stay locked. If the green thread eventlet switches to, tries to grab the lock on the table locked by this transaction a deadlock will occur. \n\nThat said. I think you can move like 487 outside of the transaction, wrap it in a try/except and in case of errors revert the changes to Neutron db manually.\n\ntry:\n    self.api_cli.create_network(net)\nexcept MidonetApiException:\n    with excutils.save_and_reraise_exception():\n        LOG.error(_(\"MidoNet error received\"))\n        super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])\n\n\nI know it\u0027s more complex but safer. I\u0027d do something similar for all the methods.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"576839fd5f6323ffdef5b5e6a4bfe6e6eed3b1df","unresolved":false,"context_lines":[{"line_number":496,"context_line":"        Update an existing Neutron network and its corresponding MidoNet"},{"line_number":497,"context_line":"        bridge."},{"line_number":498,"context_line":"        \"\"\""},{"line_number":499,"context_line":"        LOG.info(_(\"MidonetPluginV2.update_network called: id\u003d%(id)r, \""},{"line_number":500,"context_line":"                   \"network\u003d%(network)r\"), {\u0027id\u0027: id, \u0027network\u0027: network})"},{"line_number":501,"context_line":""},{"line_number":502,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_5cf45f54","line":499,"updated":"2014-07-25 16:54:03.000000000","message":"ditto","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"576839fd5f6323ffdef5b5e6a4bfe6e6eed3b1df","unresolved":false,"context_lines":[{"line_number":504,"context_line":"                context, id, network)"},{"line_number":505,"context_line":""},{"line_number":506,"context_line":"            self._process_l3_update(context, net, network[\u0027network\u0027])"},{"line_number":507,"context_line":"            self.api_cli.update_network(id, net)"},{"line_number":508,"context_line":""},{"line_number":509,"context_line":"        LOG.info(_(\"MidonetPluginV2.update_network exiting: net\u003d%r\"), net)"},{"line_number":510,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_1fabb9d6","line":507,"updated":"2014-07-25 16:54:03.000000000","message":"same as suggested for create_network","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":1923,"name":"Mohammad Banikazemi","email":"mbanikazemi@gmail.com","username":"mb-s"},"change_message_id":"66f0e25ed2b68a3c046613891d3e76836c87d80a","unresolved":false,"context_lines":[{"line_number":504,"context_line":"                context, id, network)"},{"line_number":505,"context_line":""},{"line_number":506,"context_line":"            self._process_l3_update(context, net, network[\u0027network\u0027])"},{"line_number":507,"context_line":"            self.api_cli.update_network(id, net)"},{"line_number":508,"context_line":""},{"line_number":509,"context_line":"        LOG.info(_(\"MidonetPluginV2.update_network exiting: net\u003d%r\"), net)"},{"line_number":510,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_484f1dbe","line":507,"in_reply_to":"baada198_1fabb9d6","updated":"2014-07-28 02:36:56.000000000","message":"Here you need to make sure you save the original network so you can get back to it if call to client fails.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"5e0364ab59747f7f7e2232c6fb58b9e01ea4a3e2","unresolved":false,"context_lines":[{"line_number":504,"context_line":"                context, id, network)"},{"line_number":505,"context_line":""},{"line_number":506,"context_line":"            self._process_l3_update(context, net, network[\u0027network\u0027])"},{"line_number":507,"context_line":"            self.api_cli.update_network(id, net)"},{"line_number":508,"context_line":""},{"line_number":509,"context_line":"        LOG.info(_(\"MidonetPluginV2.update_network exiting: net\u003d%r\"), net)"},{"line_number":510,"context_line":"        return net"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_6c35ced9","line":507,"in_reply_to":"baada198_484f1dbe","updated":"2014-07-28 08:14:45.000000000","message":"Done","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"576839fd5f6323ffdef5b5e6a4bfe6e6eed3b1df","unresolved":false,"context_lines":[{"line_number":512,"context_line":"    @handle_api_error"},{"line_number":513,"context_line":"    def delete_network(self, context, id):"},{"line_number":514,"context_line":"        \"\"\"Delete a network and its corresponding MidoNet bridge.\"\"\""},{"line_number":515,"context_line":"        LOG.info(_(\"MidonetPluginV2.delete_network called: id\u003d%r\"), id)"},{"line_number":516,"context_line":""},{"line_number":517,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":518,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_bc9adb10","line":515,"updated":"2014-07-25 16:54:03.000000000","message":"ditto","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"5e0364ab59747f7f7e2232c6fb58b9e01ea4a3e2","unresolved":false,"context_lines":[{"line_number":512,"context_line":"    @handle_api_error"},{"line_number":513,"context_line":"    def delete_network(self, context, id):"},{"line_number":514,"context_line":"        \"\"\"Delete a network and its corresponding MidoNet bridge.\"\"\""},{"line_number":515,"context_line":"        LOG.info(_(\"MidonetPluginV2.delete_network called: id\u003d%r\"), id)"},{"line_number":516,"context_line":""},{"line_number":517,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":518,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_8c3062ea","line":515,"in_reply_to":"baada198_bc9adb10","updated":"2014-07-28 08:14:45.000000000","message":"Done","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"576839fd5f6323ffdef5b5e6a4bfe6e6eed3b1df","unresolved":false,"context_lines":[{"line_number":516,"context_line":""},{"line_number":517,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":518,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":519,"context_line":"            self.api_cli.delete_network(id)"},{"line_number":520,"context_line":""},{"line_number":521,"context_line":"        LOG.info(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":522,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_dfa5c103","line":519,"updated":"2014-07-25 16:54:03.000000000","message":"same as suggested for create_network","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"5e0364ab59747f7f7e2232c6fb58b9e01ea4a3e2","unresolved":false,"context_lines":[{"line_number":516,"context_line":""},{"line_number":517,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":518,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":519,"context_line":"            self.api_cli.delete_network(id)"},{"line_number":520,"context_line":""},{"line_number":521,"context_line":"        LOG.info(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":522,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_ac428638","line":519,"in_reply_to":"baada198_085a8581","updated":"2014-07-28 08:14:45.000000000","message":"Done. I am not attempting to recreate the deleted network in this case.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":1923,"name":"Mohammad Banikazemi","email":"mbanikazemi@gmail.com","username":"mb-s"},"change_message_id":"66f0e25ed2b68a3c046613891d3e76836c87d80a","unresolved":false,"context_lines":[{"line_number":516,"context_line":""},{"line_number":517,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":518,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":519,"context_line":"            self.api_cli.delete_network(id)"},{"line_number":520,"context_line":""},{"line_number":521,"context_line":"        LOG.info(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":522,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_085a8581","line":519,"in_reply_to":"baada198_dfa5c103","updated":"2014-07-28 02:36:56.000000000","message":"This is a bit tricky as you would have deleted the network by the time the access to client fails. In that case, recreating the network may not make sense. May be simply logging the error can be sufficient.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"5570462f3e14c633b21c70041d624986a48172aa","unresolved":false,"context_lines":[{"line_number":490,"context_line":"        try:"},{"line_number":491,"context_line":"            self.api_cli.create_network(net)"},{"line_number":492,"context_line":"        except Exception as ex:"},{"line_number":493,"context_line":"            LOG.error(_(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                        \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":495,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":496,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_02233958","line":493,"updated":"2014-07-28 09:08:03.000000000","message":"please use:\n\n  LOG.error(_LE(...)\n\ninstead of:\n\n  LOG.error(_(...)\n\n\nhttp://docs.openstack.org/developer/oslo.i18n/guidelines.html#choosing-a-marker-function","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"0a6933b913915509a201e790c12eb7423926705e","unresolved":false,"context_lines":[{"line_number":490,"context_line":"        try:"},{"line_number":491,"context_line":"            self.api_cli.create_network(net)"},{"line_number":492,"context_line":"        except Exception as ex:"},{"line_number":493,"context_line":"            LOG.error(_(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                        \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":495,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":496,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_4f0e183e","line":493,"in_reply_to":"baada198_02233958","updated":"2014-07-29 02:03:28.000000000","message":"Done","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"208ab71d8a294c9ffc46dff05f378f2f437a9295","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            LOG.error(_(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                        \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":495,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":496,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"},{"line_number":497,"context_line":"        LOG.debug(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":498,"context_line":"        return net"},{"line_number":499,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_bfbc666d","line":496,"updated":"2014-07-28 09:08:05.000000000","message":"would this call access DB?","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"4c917114136f130fa965573122becebccde7a261","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            LOG.error(_(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                        \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":495,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":496,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"},{"line_number":497,"context_line":"        LOG.debug(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":498,"context_line":"        return net"},{"line_number":499,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_ec2a9390","line":496,"in_reply_to":"baada198_42b51f17","updated":"2014-07-29 06:21:01.000000000","message":"I just wonder shouldn\u0027t this call be wrapped by \u0027with context.session.begin(subtransactions\u003dTrue)\u0027 and also include rollback for  self._process_l3_create(context, net, net_data).","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"4091cc13d5d087fc97107f0585e6145f152b8f78","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            LOG.error(_(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                        \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":495,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":496,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"},{"line_number":497,"context_line":"        LOG.debug(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":498,"context_line":"        return net"},{"line_number":499,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_95354c47","line":496,"in_reply_to":"baada198_bab16903","updated":"2014-07-30 19:03:42.000000000","message":"Probably I am missing something, but in delete_network there is an invocation of  _process_l3_delete. I thought it should  undo l3_create  in addition to DB entries removal in case of rollback of failed create_network operation","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"8d9e834a9497b580290dcd7e381bf21b2c486399","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            LOG.error(_(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                        \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":495,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":496,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"},{"line_number":497,"context_line":"        LOG.debug(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":498,"context_line":"        return net"},{"line_number":499,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_42b51f17","line":496,"in_reply_to":"baada198_bfbc666d","updated":"2014-07-28 17:15:44.000000000","message":"Yes, what\u0027s your concern?","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"3d0ea1eb60bb6e19ff8c94e574448b638e7f2d50","unresolved":false,"context_lines":[{"line_number":493,"context_line":"            LOG.error(_(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                        \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":495,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":496,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"},{"line_number":497,"context_line":"        LOG.debug(_(\"MidonetPluginV2.create_network exiting: net\u003d%r\"), net)"},{"line_number":498,"context_line":"        return net"},{"line_number":499,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_bab16903","line":496,"in_reply_to":"baada198_ec2a9390","updated":"2014-07-30 14:31:25.000000000","message":"There\u0027s no need of \u0027with context.session.begin(subtransactions\u003dTrue)\u0027 , since the session is opened in super(MidonetPluginV2, self).delete_network and delete_network is the only operation in this transaction. What kind of rollback? _process_l3_create is creating an ExternalNetwork that will be removed when the network associated to it will be removed from the DB since there\u0027s a backref relationship in place that specifies cascade\u003d\u0027delete\u0027 . What am I missing?","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"208ab71d8a294c9ffc46dff05f378f2f437a9295","unresolved":false,"context_lines":[{"line_number":504,"context_line":"        Update an existing Neutron network and its corresponding MidoNet"},{"line_number":505,"context_line":"        bridge."},{"line_number":506,"context_line":"        \"\"\""},{"line_number":507,"context_line":"        LOG.debug(_(\"MidonetPluginV2.update_network called: id\u003d%(id)r, \""},{"line_number":508,"context_line":"                    \"network\u003d%(network)r\"), {\u0027id\u0027: id, \u0027network\u0027: network})"},{"line_number":509,"context_line":""},{"line_number":510,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_5fc50a3b","line":507,"updated":"2014-07-28 09:08:05.000000000","message":"no need for i18n","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"0a6933b913915509a201e790c12eb7423926705e","unresolved":false,"context_lines":[{"line_number":504,"context_line":"        Update an existing Neutron network and its corresponding MidoNet"},{"line_number":505,"context_line":"        bridge."},{"line_number":506,"context_line":"        \"\"\""},{"line_number":507,"context_line":"        LOG.debug(_(\"MidonetPluginV2.update_network called: id\u003d%(id)r, \""},{"line_number":508,"context_line":"                    \"network\u003d%(network)r\"), {\u0027id\u0027: id, \u0027network\u0027: network})"},{"line_number":509,"context_line":""},{"line_number":510,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_6f111c5b","line":507,"in_reply_to":"baada198_5fc50a3b","updated":"2014-07-29 02:03:28.000000000","message":"Done","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"208ab71d8a294c9ffc46dff05f378f2f437a9295","unresolved":false,"context_lines":[{"line_number":524,"context_line":"                net \u003d super(MidonetPluginV2, self).update_network("},{"line_number":525,"context_line":"                    context, id, original_network)"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"        LOG.debug(_(\"MidonetPluginV2.update_network exiting: net\u003d%r\"), net)"},{"line_number":528,"context_line":"        return net"},{"line_number":529,"context_line":""},{"line_number":530,"context_line":"    @handle_api_error"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_bfdd4616","line":527,"updated":"2014-07-28 09:08:05.000000000","message":"no need for i18n","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"0a6933b913915509a201e790c12eb7423926705e","unresolved":false,"context_lines":[{"line_number":524,"context_line":"                net \u003d super(MidonetPluginV2, self).update_network("},{"line_number":525,"context_line":"                    context, id, original_network)"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"        LOG.debug(_(\"MidonetPluginV2.update_network exiting: net\u003d%r\"), net)"},{"line_number":528,"context_line":"        return net"},{"line_number":529,"context_line":""},{"line_number":530,"context_line":"    @handle_api_error"}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_8f0bd029","line":527,"in_reply_to":"baada198_bfdd4616","updated":"2014-07-29 02:03:28.000000000","message":"Done","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"208ab71d8a294c9ffc46dff05f378f2f437a9295","unresolved":false,"context_lines":[{"line_number":535,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":536,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":537,"context_line":""},{"line_number":538,"context_line":"        self.api_cli.delete_network(id)"},{"line_number":539,"context_line":""},{"line_number":540,"context_line":"        LOG.debug(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":541,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_7f456eb2","line":538,"updated":"2014-07-28 09:08:05.000000000","message":"is it intentionally without process_l3_delete invocation?","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"8d9e834a9497b580290dcd7e381bf21b2c486399","unresolved":false,"context_lines":[{"line_number":535,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":536,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":537,"context_line":""},{"line_number":538,"context_line":"        self.api_cli.delete_network(id)"},{"line_number":539,"context_line":""},{"line_number":540,"context_line":"        LOG.debug(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":541,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_e23e3328","line":538,"updated":"2014-07-28 17:15:44.000000000","message":"nit: Joe, you might want to log an error if this operation fails","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"0a6933b913915509a201e790c12eb7423926705e","unresolved":false,"context_lines":[{"line_number":535,"context_line":"        with context.session.begin(subtransactions\u003dTrue):"},{"line_number":536,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":537,"context_line":""},{"line_number":538,"context_line":"        self.api_cli.delete_network(id)"},{"line_number":539,"context_line":""},{"line_number":540,"context_line":"        LOG.debug(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":541,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_af06d41e","line":538,"in_reply_to":"baada198_e23e3328","updated":"2014-07-29 02:03:28.000000000","message":"Done","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":6598,"name":"Berezovsky Irena","email":"irenab.dev@gmail.com","username":"irenab"},"change_message_id":"208ab71d8a294c9ffc46dff05f378f2f437a9295","unresolved":false,"context_lines":[{"line_number":537,"context_line":""},{"line_number":538,"context_line":"        self.api_cli.delete_network(id)"},{"line_number":539,"context_line":""},{"line_number":540,"context_line":"        LOG.debug(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":541,"context_line":""},{"line_number":542,"context_line":"    def create_port(self, context, port):"},{"line_number":543,"context_line":"        \"\"\"Create a L2 port in Neutron/MidoNet.\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_df075a7f","line":540,"updated":"2014-07-28 09:08:05.000000000","message":"i18n","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"0a6933b913915509a201e790c12eb7423926705e","unresolved":false,"context_lines":[{"line_number":537,"context_line":""},{"line_number":538,"context_line":"        self.api_cli.delete_network(id)"},{"line_number":539,"context_line":""},{"line_number":540,"context_line":"        LOG.debug(_(\"MidonetPluginV2.delete_network exiting: id\u003d%r\"), id)"},{"line_number":541,"context_line":""},{"line_number":542,"context_line":"    def create_port(self, context, port):"},{"line_number":543,"context_line":"        \"\"\"Create a L2 port in Neutron/MidoNet.\"\"\""}],"source_content_type":"text/x-python","patch_set":3,"id":"baada198_cf014808","line":540,"in_reply_to":"baada198_df075a7f","updated":"2014-07-29 02:03:28.000000000","message":"Done","commit_id":"d41d5bdaaecd12cb92fc6de47092f223a25b55ab"},{"author":{"_account_id":156,"name":"Ryu Ishimoto","email":"ryu@midokura.com","username":"ryu-midokura"},"change_message_id":"9aeda10e3845b268a877dc22e2251626a54b1e1b","unresolved":false,"context_lines":[{"line_number":516,"context_line":"            self._process_l3_update(context, net, network[\u0027network\u0027])"},{"line_number":517,"context_line":""},{"line_number":518,"context_line":"        try:"},{"line_number":519,"context_line":"            self.api_cli.update_network(id, net)"},{"line_number":520,"context_line":"        except Exception as ex:"},{"line_number":521,"context_line":"            LOG.error(_LE(\"Failed to update network %(net_id)s in Midonet:\""},{"line_number":522,"context_line":"                          \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_432237a4","line":519,"updated":"2014-07-30 08:45:44.000000000","message":"I prefer that we keep this inside transaction since MidoNet client is change this to be an asynchronous call here in the near future.","commit_id":"d51166becdd5ef626f92f754bb64b4d99bd7cc02"},{"author":{"_account_id":6788,"name":"Rossella Sblendido","email":"rsblendido@suse.com","username":"rossella-o"},"change_message_id":"3f49fcb2dca2c3730bbb51366ba4f996aa3287d3","unresolved":false,"context_lines":[{"line_number":516,"context_line":"            self._process_l3_update(context, net, network[\u0027network\u0027])"},{"line_number":517,"context_line":""},{"line_number":518,"context_line":"        try:"},{"line_number":519,"context_line":"            self.api_cli.update_network(id, net)"},{"line_number":520,"context_line":"        except Exception as ex:"},{"line_number":521,"context_line":"            LOG.error(_LE(\"Failed to update network %(net_id)s in Midonet:\""},{"line_number":522,"context_line":"                          \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_72259cac","line":519,"in_reply_to":"baada198_432237a4","updated":"2014-08-04 15:31:58.000000000","message":"Hey Ryu, just curious...if the client is gonna be asynchronous I guess it will return immediately and will perform the needed operations on the MidoNet side in a second stage. At that point it will report a success or an error. If this is the correct scenario, the transaction will be over, because it will be closed when the client returns. So the transaction won\u0027t be automatically rolled back. What does it buy you to keep the cli operation inside the transaction then?","commit_id":"d51166becdd5ef626f92f754bb64b4d99bd7cc02"},{"author":{"_account_id":156,"name":"Ryu Ishimoto","email":"ryu@midokura.com","username":"ryu-midokura"},"change_message_id":"9aeda10e3845b268a877dc22e2251626a54b1e1b","unresolved":false,"context_lines":[{"line_number":537,"context_line":"            super(MidonetPluginV2, self).delete_network(context, id)"},{"line_number":538,"context_line":""},{"line_number":539,"context_line":"        try:"},{"line_number":540,"context_line":"            self.api_cli.delete_network(id)"},{"line_number":541,"context_line":"        except Exception as ex:"},{"line_number":542,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":543,"context_line":"                LOG.error(_LE(\"Failed to delete network %(net_id)s in Midonet:\""}],"source_content_type":"text/x-python","patch_set":4,"id":"baada198_03767fa3","line":540,"updated":"2014-07-30 08:45:44.000000000","message":"Same as above.  I prefer that we keep this inside the transaction since our client will be designed to not block.","commit_id":"d51166becdd5ef626f92f754bb64b4d99bd7cc02"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"c396f61859ef2a770d1d42f1a3f2489a5679f461","unresolved":false,"context_lines":[{"line_number":20,"context_line":"# @author: Rossella Sblendido, Midokura Japan KK"},{"line_number":21,"context_line":"# @author: Duarte Nunes, Midokura Japan KK"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"import functools"},{"line_number":24,"context_line":"from midonetclient import api"},{"line_number":25,"context_line":"from midonetclient import exc"},{"line_number":26,"context_line":"from midonetclient.neutron import client as n_client"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_e1516ada","line":23,"updated":"2014-07-30 20:53:32.000000000","message":"functools is stdlib. Needs a blank line here.","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"33011d6f12e7776ba5f52e4a5f83cb45fb10baa1","unresolved":false,"context_lines":[{"line_number":20,"context_line":"# @author: Rossella Sblendido, Midokura Japan KK"},{"line_number":21,"context_line":"# @author: Duarte Nunes, Midokura Japan KK"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":"import functools"},{"line_number":24,"context_line":"from midonetclient import api"},{"line_number":25,"context_line":"from midonetclient import exc"},{"line_number":26,"context_line":"from midonetclient.neutron import client as n_client"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_beca246d","line":23,"in_reply_to":"baada198_e1516ada","updated":"2014-07-31 03:00:20.000000000","message":"Done","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"c396f61859ef2a770d1d42f1a3f2489a5679f461","unresolved":false,"context_lines":[{"line_number":469,"context_line":""},{"line_number":470,"context_line":"            LOG.debug(_(\"MidonetPluginV2.delete_subnet exiting\"))"},{"line_number":471,"context_line":""},{"line_number":472,"context_line":"    @handle_api_error"},{"line_number":473,"context_line":"    def create_network(self, context, network):"},{"line_number":474,"context_line":"        \"\"\"Create Neutron network."},{"line_number":475,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_c11706ee","line":472,"updated":"2014-07-30 20:53:32.000000000","message":"All exceptions from midonetclient are caught at L.492. It seems unnecessary.","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"33011d6f12e7776ba5f52e4a5f83cb45fb10baa1","unresolved":false,"context_lines":[{"line_number":469,"context_line":""},{"line_number":470,"context_line":"            LOG.debug(_(\"MidonetPluginV2.delete_subnet exiting\"))"},{"line_number":471,"context_line":""},{"line_number":472,"context_line":"    @handle_api_error"},{"line_number":473,"context_line":"    def create_network(self, context, network):"},{"line_number":474,"context_line":"        \"\"\"Create Neutron network."},{"line_number":475,"context_line":""}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_5ebae8e0","line":472,"in_reply_to":"baada198_c11706ee","updated":"2014-07-31 03:00:20.000000000","message":"you are right, it isn\u0027t completely necessary. I would like to keep both, however, because the handle_api_error decorator will translate specific Exceptions to a MidonetApiException, while still keeping the correcting \"delete_network\" call.","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"ea9f272608b071fc184f33a28823fb9f35c43c8c","unresolved":false,"context_lines":[{"line_number":488,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":489,"context_line":""},{"line_number":490,"context_line":"        try:"},{"line_number":491,"context_line":"            self.api_cli.create_network(net)"},{"line_number":492,"context_line":"        except Exception as ex:"},{"line_number":493,"context_line":"            LOG.error(_LE(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":494,"context_line":"                          \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_c9d101ce","line":491,"updated":"2014-07-30 13:20:22.000000000","message":"why did you leave only this outside a transaction?","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"f1b8dba3da1032342c989bce8ec0a40304f0b58c","unresolved":false,"context_lines":[{"line_number":489,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":490,"context_line":""},{"line_number":491,"context_line":"        try:"},{"line_number":492,"context_line":"            self.api_cli.create_network(net)"},{"line_number":493,"context_line":"        except Exception as ex:"},{"line_number":494,"context_line":"            LOG.error(_LE(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":495,"context_line":"                          \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_3c6b7df2","line":492,"updated":"2014-07-31 04:26:34.000000000","message":"why only create_network call is done outside a transaction?","commit_id":"6908f7f1a07170f8f7269dce2bb72d5265be86ce"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"b68fcaf90461f34fc90676cfbe4380e81dd3f941","unresolved":false,"context_lines":[{"line_number":489,"context_line":"            self._process_l3_create(context, net, net_data)"},{"line_number":490,"context_line":""},{"line_number":491,"context_line":"        try:"},{"line_number":492,"context_line":"            self.api_cli.create_network(net)"},{"line_number":493,"context_line":"        except Exception as ex:"},{"line_number":494,"context_line":"            LOG.error(_LE(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":495,"context_line":"                          \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_8586ecb8","line":492,"in_reply_to":"baada198_3c6b7df2","updated":"2014-07-31 06:55:09.000000000","message":"Hi Takashi, sorry for flip flopping on this change so much. We previously decided that the correction for a failed delete made sense, so we would keep the API call out of the transaction. Then we later decided that it was safe enough to keep this in the same transaction considering our future plans for the plugin. So with my latest change, all the operations are inside the transaction.","commit_id":"6908f7f1a07170f8f7269dce2bb72d5265be86ce"},{"author":{"_account_id":6854,"name":"YAMAMOTO Takashi","email":"yamamoto@midokura.com","username":"yamamoto"},"change_message_id":"f1b8dba3da1032342c989bce8ec0a40304f0b58c","unresolved":false,"context_lines":[{"line_number":492,"context_line":"            self.api_cli.create_network(net)"},{"line_number":493,"context_line":"        except Exception as ex:"},{"line_number":494,"context_line":"            LOG.error(_LE(\"Failed to create a network %(net_id)s in Midonet:\""},{"line_number":495,"context_line":"                          \"%(err)s\"), {\"net_id\": net[\"id\"], \"err\": ex})"},{"line_number":496,"context_line":"            with excutils.save_and_reraise_exception():"},{"line_number":497,"context_line":"                super(MidonetPluginV2, self).delete_network(context, net[\u0027id\u0027])"},{"line_number":498,"context_line":"        LOG.debug(\"MidonetPluginV2.create_network exiting: net\u003d%r\", net)"}],"source_content_type":"text/x-python","patch_set":6,"id":"baada198_3cb45d81","line":495,"updated":"2014-07-31 04:26:34.000000000","message":"this LOG.error call should be inside save_and_reraise_exception block below.","commit_id":"6908f7f1a07170f8f7269dce2bb72d5265be86ce"}],"neutron/tests/unit/midonet/test_midonet_plugin.py":[{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"30db1f300cbf85b5ea9de9ae36a021556180f096","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def tearDown(self):"},{"line_number":80,"context_line":"        super(MidonetPluginV2TestCase, self).tearDown()"},{"line_number":81,"context_line":"        self.mock_api.stop()"},{"line_number":82,"context_line":"        self.module_patcher.stop()"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"class TestMidonetNetworksV2(test_plugin.TestNetworksV2,"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_bfc5743e","line":82,"updated":"2014-07-25 14:10:38.000000000","message":"The stop is needed for the module_patcher, because it is a dict mock, but is not needed for mock_api. Could remove L81.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"5e0364ab59747f7f7e2232c6fb58b9e01ea4a3e2","unresolved":false,"context_lines":[{"line_number":79,"context_line":"    def tearDown(self):"},{"line_number":80,"context_line":"        super(MidonetPluginV2TestCase, self).tearDown()"},{"line_number":81,"context_line":"        self.mock_api.stop()"},{"line_number":82,"context_line":"        self.module_patcher.stop()"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":""},{"line_number":85,"context_line":"class TestMidonetNetworksV2(test_plugin.TestNetworksV2,"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_2c6e76c8","line":82,"in_reply_to":"baada198_bfc5743e","updated":"2014-07-28 08:14:45.000000000","message":"Done","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":6659,"name":"Paul Michali","email":"pc@michali.net","username":"pcm"},"change_message_id":"30db1f300cbf85b5ea9de9ae36a021556180f096","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        }"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        self.module_patcher \u003d mock.patch.dict(\u0027sys.modules\u0027, modules)"},{"line_number":186,"context_line":"        self.module_patcher.start()"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"        # import midonetclient here because it needs proper mock objects to be"},{"line_number":189,"context_line":"        # assigned to this module first.  \u0027midoclient_mock\u0027 object is the"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_bfd654c1","line":186,"updated":"2014-07-25 14:10:38.000000000","message":"Should add an addCleanup() to stop the module_patcher mock.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"5e0364ab59747f7f7e2232c6fb58b9e01ea4a3e2","unresolved":false,"context_lines":[{"line_number":183,"context_line":"        }"},{"line_number":184,"context_line":""},{"line_number":185,"context_line":"        self.module_patcher \u003d mock.patch.dict(\u0027sys.modules\u0027, modules)"},{"line_number":186,"context_line":"        self.module_patcher.start()"},{"line_number":187,"context_line":""},{"line_number":188,"context_line":"        # import midonetclient here because it needs proper mock objects to be"},{"line_number":189,"context_line":"        # assigned to this module first.  \u0027midoclient_mock\u0027 object is the"}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_ec771e9d","line":186,"in_reply_to":"baada198_bfd654c1","updated":"2014-07-28 08:14:45.000000000","message":"Done","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":4395,"name":"Aaron Rosen","email":"aaronorosen@gmail.com","username":"arosen"},"change_message_id":"f8ac90da936d0d11d39aede8ec3a92a4e3a3bbaf","unresolved":false,"context_lines":[{"line_number":188,"context_line":"        # import midonetclient here because it needs proper mock objects to be"},{"line_number":189,"context_line":"        # assigned to this module first.  \u0027midoclient_mock\u0027 object is the"},{"line_number":190,"context_line":"        # mock object used for this module."},{"line_number":191,"context_line":"        from midonetclient.neutron.client import MidonetClient"},{"line_number":192,"context_line":"        client_class \u003d MidonetClient"},{"line_number":193,"context_line":"        self.mock_class \u003d client_class()"},{"line_number":194,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_12a5d246","line":191,"updated":"2014-07-10 06:55:48.000000000","message":"Why not just move this to the top of the file then? I don\u0027t think importing this here makes a difference does it?","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"1c259f4c4130955c1874d4ab4d000d5b6e1b61d9","unresolved":false,"context_lines":[{"line_number":188,"context_line":"        # import midonetclient here because it needs proper mock objects to be"},{"line_number":189,"context_line":"        # assigned to this module first.  \u0027midoclient_mock\u0027 object is the"},{"line_number":190,"context_line":"        # mock object used for this module."},{"line_number":191,"context_line":"        from midonetclient.neutron.client import MidonetClient"},{"line_number":192,"context_line":"        client_class \u003d MidonetClient"},{"line_number":193,"context_line":"        self.mock_class \u003d client_class()"},{"line_number":194,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"baada198_15721c11","line":191,"in_reply_to":"baada198_12a5d246","updated":"2014-07-10 07:20:13.000000000","message":"This is because the MidonetClient module itself depends on other modules being mocked: midonetclient, midonetclient.neutron, midonetclient.neutron.client. If we import at the top of the file (before the other modules are mocked), then MidonetClient would fail to initialize.","commit_id":"fe8e4b00fcb18ff5feaa07dc683466e2923cbfe3"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"c396f61859ef2a770d1d42f1a3f2489a5679f461","unresolved":false,"context_lines":[{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    def tearDown(self):"},{"line_number":78,"context_line":"        super(MidonetPluginV2TestCase, self).tearDown()"},{"line_number":79,"context_line":"        self.module_patcher.stop()"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"class TestMidonetNetworksV2(test_plugin.TestNetworksV2,"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_21b7e2f9","line":79,"updated":"2014-07-30 20:53:32.000000000","message":"Please use self.addCleanup in setUp instead of teadDown.\n\n  self.addCleanup(self.module_pather.stop)\n\ntearDown is discouraged now.","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"33011d6f12e7776ba5f52e4a5f83cb45fb10baa1","unresolved":false,"context_lines":[{"line_number":76,"context_line":""},{"line_number":77,"context_line":"    def tearDown(self):"},{"line_number":78,"context_line":"        super(MidonetPluginV2TestCase, self).tearDown()"},{"line_number":79,"context_line":"        self.module_patcher.stop()"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":""},{"line_number":82,"context_line":"class TestMidonetNetworksV2(test_plugin.TestNetworksV2,"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_5e5e68e9","line":79,"in_reply_to":"baada198_21b7e2f9","updated":"2014-07-31 03:00:20.000000000","message":"Done","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"c396f61859ef2a770d1d42f1a3f2489a5679f461","unresolved":false,"context_lines":[{"line_number":170,"context_line":"        p \u003d mock.patch.dict(sys.modules, {\u0027midonetclient\u0027: mock.Mock()})"},{"line_number":171,"context_line":"        p.start()"},{"line_number":172,"context_line":"        # dict patches must be explicitly stopped"},{"line_number":173,"context_line":"        self.addCleanup(p.stop)"},{"line_number":174,"context_line":"        self.midoclient_mock \u003d mock.MagicMock()"},{"line_number":175,"context_line":"        self.midoclient_mock.midonetclient.neutron.client.return_value \u003d True"},{"line_number":176,"context_line":"        modules \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_a1c69248","line":173,"updated":"2014-07-30 20:53:32.000000000","message":"L.167-L.191 are very similar or equal to L.49-74 above. Could you share the code in both classes?","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"},{"author":{"_account_id":8837,"name":"Joe Mills","email":"joe.h.mills@gmail.com","username":"joemido"},"change_message_id":"33011d6f12e7776ba5f52e4a5f83cb45fb10baa1","unresolved":false,"context_lines":[{"line_number":170,"context_line":"        p \u003d mock.patch.dict(sys.modules, {\u0027midonetclient\u0027: mock.Mock()})"},{"line_number":171,"context_line":"        p.start()"},{"line_number":172,"context_line":"        # dict patches must be explicitly stopped"},{"line_number":173,"context_line":"        self.addCleanup(p.stop)"},{"line_number":174,"context_line":"        self.midoclient_mock \u003d mock.MagicMock()"},{"line_number":175,"context_line":"        self.midoclient_mock.midonetclient.neutron.client.return_value \u003d True"},{"line_number":176,"context_line":"        modules \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"baada198_fee3bc31","line":173,"in_reply_to":"baada198_a1c69248","updated":"2014-07-31 03:00:20.000000000","message":"The truth is that this code duplication is only here extremely temporarily. This code only exists at all to get the UT to pass between patches as we update our plugin. This is all removed in a review already in review:\n\nhttps://review.openstack.org/#/c/106288/1/neutron/tests/unit/midonet/test_midonet_plugin.py","commit_id":"f39bed84b9e6395a04d3674eed995e9fb6285405"}]}
