)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a8a4fb152992521a563cd216f19ea2e2de8f7477","unresolved":false,"context_lines":[{"line_number":18,"context_line":"a duplicate record to determine if there is a duplicate. If there"},{"line_number":19,"context_line":"is a race, one of the commits will fail with an uncaught DBDuplicateError,"},{"line_number":20,"context_line":"which will be converted to a RetryRequest to start the process"},{"line_number":21,"context_line":"over. At this point a new MAC will be generated or in the case"},{"line_number":22,"context_line":"that the MAC was specified it will query the DB, find the dup,"},{"line_number":23,"context_line":"and raise the error."},{"line_number":24,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"7aa08908_d06b5583","line":21,"range":{"start_line":21,"start_character":22,"end_line":21,"end_character":47},"updated":"2016-06-08 23:49:18.000000000","message":"If the mac was specified explicitly this will be a little bit different.  It will trigger a retry but then it\u0027ll use the same mac address.  On the retry, it\u0027ll look again for a duplicate and should detect it the second time.  Not so bad.","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"}],"neutron/db/db_base_plugin_v2.py":[{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"7ebac509e103abd4c10acec90854fa5f45d8005c","unresolved":false,"context_lines":[{"line_number":1177,"context_line":""},{"line_number":1178,"context_line":"    def _create_port_with_mac(self, context, network_id, port_data,"},{"line_number":1179,"context_line":"                              mac_address):"},{"line_number":1180,"context_line":"        if self._is_mac_in_use(context, network_id, mac_address):"},{"line_number":1181,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1182,"context_line":"        db_port \u003d models_v2.Port(mac_address\u003dmac_address, **port_data)"},{"line_number":1183,"context_line":"        context.session.add(db_port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_90c70d95","line":1180,"updated":"2016-06-08 23:47:21.000000000","message":"Assuming that generating unique MACs is more common than not, wouldn\u0027t it be more efficient to stop using _is_mac_in_use, and just let the code raise a duplicate exception when relevant?","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"10e2a633bd2c2b5e0b275fee2f29da41670ecd05","unresolved":false,"context_lines":[{"line_number":1177,"context_line":""},{"line_number":1178,"context_line":"    def _create_port_with_mac(self, context, network_id, port_data,"},{"line_number":1179,"context_line":"                              mac_address):"},{"line_number":1180,"context_line":"        if self._is_mac_in_use(context, network_id, mac_address):"},{"line_number":1181,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1182,"context_line":"        db_port \u003d models_v2.Port(mac_address\u003dmac_address, **port_data)"},{"line_number":1183,"context_line":"        context.session.add(db_port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_4de82e17","line":1180,"in_reply_to":"7aa08908_3586d665","updated":"2016-06-09 22:08:23.000000000","message":"I know what you mean by \"that problem.\"  I\u0027m trying to explain that it is irrelevant because on retry if it tries the same mac address this check will raise MacAddressInUse.  If it tries a different mac address, then it is highly likely to succeed the next time.  So, we don\u0027t need to distinguish when DBDuplicateEntry is raised, we just retry regardless and the next retry is highly likely to work it all out.\n\n| \"wouldn\u0027t it be more efficient to stop using _is_mac_in_use, and just let the code raise a duplicate exception when relevant?\"\n\nThis isn\u0027t enough.  we still need _is_mac_in_use before L1240.  We can\u0027t just let the code raise DBDuplicateEntry to solve this.","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"56beb77a2bc62aacde6030bc6f15709df831b671","unresolved":false,"context_lines":[{"line_number":1177,"context_line":""},{"line_number":1178,"context_line":"    def _create_port_with_mac(self, context, network_id, port_data,"},{"line_number":1179,"context_line":"                              mac_address):"},{"line_number":1180,"context_line":"        if self._is_mac_in_use(context, network_id, mac_address):"},{"line_number":1181,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1182,"context_line":"        db_port \u003d models_v2.Port(mac_address\u003dmac_address, **port_data)"},{"line_number":1183,"context_line":"        context.session.add(db_port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_3586d665","line":1180,"in_reply_to":"7aa08908_48b30a0b","updated":"2016-06-09 18:25:04.000000000","message":"I guess I\u0027m not explaining myself properly.\n\nBy \"that problem\", I meant:\n\n\u003e How do we tell which is which when both can be raised when the transaction is being committed finally?\n\nThat problem isn\u0027t being solved since a duplicate DB error can still be thrown by either MAC or IP generation. I understand that a duplicate DB error will cause a retry.\n\n\u003e Remove this explicit check here...\n\nThis is what I meant in my very first comment: \"... wouldn\u0027t it be more efficient to stop using _is_mac_in_use, and just let the code raise a duplicate exception when relevant?\"","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"03744b995d5135b6f65a3941b3dc62dddcf536ac","unresolved":false,"context_lines":[{"line_number":1177,"context_line":""},{"line_number":1178,"context_line":"    def _create_port_with_mac(self, context, network_id, port_data,"},{"line_number":1179,"context_line":"                              mac_address):"},{"line_number":1180,"context_line":"        if self._is_mac_in_use(context, network_id, mac_address):"},{"line_number":1181,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1182,"context_line":"        db_port \u003d models_v2.Port(mac_address\u003dmac_address, **port_data)"},{"line_number":1183,"context_line":"        context.session.add(db_port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_dc4864cf","line":1180,"in_reply_to":"7aa08908_8bffb7a9","updated":"2016-06-09 16:57:37.000000000","message":"But this patch doesn\u0027t solve that problem... The proposed code can still raise a Duplicate DB error.","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"7dc25dd7f2fc3b65e8221d23af2c88c506815976","unresolved":false,"context_lines":[{"line_number":1177,"context_line":""},{"line_number":1178,"context_line":"    def _create_port_with_mac(self, context, network_id, port_data,"},{"line_number":1179,"context_line":"                              mac_address):"},{"line_number":1180,"context_line":"        if self._is_mac_in_use(context, network_id, mac_address):"},{"line_number":1181,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1182,"context_line":"        db_port \u003d models_v2.Port(mac_address\u003dmac_address, **port_data)"},{"line_number":1183,"context_line":"        context.session.add(db_port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_8bffb7a9","line":1180,"in_reply_to":"7aa08908_90c70d95","updated":"2016-06-09 15:35:00.000000000","message":"Assaf, that\u0027s the problem!  Over the course of the transaction, we have several things that can cause duplicate exceptions.  One is duplicate mac which is supposed to raise a duplicate mac exception.  The other is duplicate IP address which is supposed to issue a retry.  How do we tell which is which when both can be raised when the transaction is being committed finally?","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"43003e5e748a2c60a4d6d373956c631b2efb425e","unresolved":false,"context_lines":[{"line_number":1177,"context_line":""},{"line_number":1178,"context_line":"    def _create_port_with_mac(self, context, network_id, port_data,"},{"line_number":1179,"context_line":"                              mac_address):"},{"line_number":1180,"context_line":"        if self._is_mac_in_use(context, network_id, mac_address):"},{"line_number":1181,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1182,"context_line":"        db_port \u003d models_v2.Port(mac_address\u003dmac_address, **port_data)"},{"line_number":1183,"context_line":"        context.session.add(db_port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_48b30a0b","line":1180,"in_reply_to":"7aa08908_dc4864cf","updated":"2016-06-09 18:21:45.000000000","message":"If it raises a duplicate db error then the operation will be retried and the mac address will either be regenerated (in the case of auto-generated mac) or this check will detect the duplicate the second time around (in the case a specific mac address is requested).  So, it does solve the problem.  It just may not be the most efficient.\n\nI think I see a better way to solve this.  Remove this explicit check here and see L1190 for more details.","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"43003e5e748a2c60a4d6d373956c631b2efb425e","unresolved":false,"context_lines":[{"line_number":1187,"context_line":"        max_retries \u003d cfg.CONF.mac_generation_retries"},{"line_number":1188,"context_line":"        for i in range(max_retries):"},{"line_number":1189,"context_line":"            mac \u003d self._generate_mac()"},{"line_number":1190,"context_line":"            try:"},{"line_number":1191,"context_line":"                return self._create_port_with_mac("},{"line_number":1192,"context_line":"                    context, network_id, port_data, mac)"},{"line_number":1193,"context_line":"            except exc.MacAddressInUse:"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_52d29835","line":1190,"updated":"2016-06-09 18:21:45.000000000","message":"Remove the try / except around this call to _create_port_with_mac and just let the DBDuplicateEntry exception kick the normal retry mechanism at whatever point it happens to be raised (up to the transaction commit)","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"43003e5e748a2c60a4d6d373956c631b2efb425e","unresolved":false,"context_lines":[{"line_number":1236,"context_line":"            if p[\u0027mac_address\u0027] is constants.ATTR_NOT_SPECIFIED:"},{"line_number":1237,"context_line":"                db_port \u003d self._create_port(context, network_id, port_data)"},{"line_number":1238,"context_line":"                p[\u0027mac_address\u0027] \u003d db_port[\u0027mac_address\u0027]"},{"line_number":1239,"context_line":"            else:"},{"line_number":1240,"context_line":"                db_port \u003d self._create_port_with_mac("},{"line_number":1241,"context_line":"                    context, network_id, port_data, p[\u0027mac_address\u0027])"},{"line_number":1242,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_92aa4084","line":1239,"updated":"2016-06-09 18:21:45.000000000","message":"Do the explicit check here since this is the code path that explicitly requests a specific mac address and needs to raise MacAddressInUse and abort the API call if it is in use.","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"a6d8667e29ae75ba099d4ae8c8b9b786fae04a95","unresolved":false,"context_lines":[{"line_number":1188,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1189,"context_line":""},{"line_number":1190,"context_line":"    def _create_port(self, context, network_id, port_data):"},{"line_number":1191,"context_line":"        max_retries \u003d cfg.CONF.mac_generation_retries"},{"line_number":1192,"context_line":"        for i in range(max_retries):"},{"line_number":1193,"context_line":"            mac \u003d self._generate_mac()"},{"line_number":1194,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"7aa08908_2dcb2220","side":"PARENT","line":1191,"range":{"start_line":1191,"start_character":22,"end_line":1191,"end_character":53},"updated":"2016-06-09 22:23:48.000000000","message":"I didn\u0027t think this through all the way.  Why was this config added?  Were people hitting problems generating mac addresses in a reasonable number of tries?  Or, was this just a config added during development that no one ever uses?  Do we know if anyone uses this?","commit_id":"d72a21ae6fedda3aca61ce3e7f29eeb6b487732f"},{"author":{"_account_id":8873,"name":"Assaf Muller","email":"amuller@redhat.com","username":"amuller"},"change_message_id":"41a2441cce7026781a628ee47029672f7696bafe","unresolved":false,"context_lines":[{"line_number":1188,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1189,"context_line":""},{"line_number":1190,"context_line":"    def _create_port(self, context, network_id, port_data):"},{"line_number":1191,"context_line":"        max_retries \u003d cfg.CONF.mac_generation_retries"},{"line_number":1192,"context_line":"        for i in range(max_retries):"},{"line_number":1193,"context_line":"            mac \u003d self._generate_mac()"},{"line_number":1194,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"7aa08908_ad5a724e","side":"PARENT","line":1191,"range":{"start_line":1191,"start_character":22,"end_line":1191,"end_character":53},"in_reply_to":"7aa08908_2dcb2220","updated":"2016-06-09 22:28:03.000000000","message":"I would guess the latter but I don\u0027t have access to usage statistics to verify that.\n\nI don\u0027t recall a bug reported related to that config FWIW.","commit_id":"d72a21ae6fedda3aca61ce3e7f29eeb6b487732f"},{"author":{"_account_id":7787,"name":"Kevin Benton","email":"kevin@benton.pub","username":"blak111"},"change_message_id":"d60cef14780de21b9175200133276c465a71b060","unresolved":false,"context_lines":[{"line_number":1188,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1189,"context_line":""},{"line_number":1190,"context_line":"    def _create_port(self, context, network_id, port_data):"},{"line_number":1191,"context_line":"        max_retries \u003d cfg.CONF.mac_generation_retries"},{"line_number":1192,"context_line":"        for i in range(max_retries):"},{"line_number":1193,"context_line":"            mac \u003d self._generate_mac()"},{"line_number":1194,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":2,"id":"7aa08908_036c359b","side":"PARENT","line":1191,"range":{"start_line":1191,"start_character":22,"end_line":1191,"end_character":53},"in_reply_to":"7aa08908_ad5a724e","updated":"2016-06-09 23:08:43.000000000","message":"They were added as part of \n\nI4d3fe12fd1e3c347b8e286d920a0609d0b3c4e8c\n\nand \n\nIc109ae65993141c6dc7d63f394066a31e79e2b4c\n\n\nNo associated bugs. I doubt it was user encountered.","commit_id":"d72a21ae6fedda3aca61ce3e7f29eeb6b487732f"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"d39c17829795a2ac5885ae67f001b4ab23ae2c87","unresolved":false,"context_lines":[{"line_number":1188,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1189,"context_line":""},{"line_number":1190,"context_line":"    def _create_port(self, context, network_id, port_data):"},{"line_number":1191,"context_line":"        max_retries \u003d cfg.CONF.mac_generation_retries"},{"line_number":1192,"context_line":"        for i in range(max_retries):"},{"line_number":1193,"context_line":"            mac \u003d self._generate_mac()"},{"line_number":1194,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7aa08908_94ad4833","side":"PARENT","line":1191,"range":{"start_line":1191,"start_character":31,"end_line":1191,"end_character":53},"updated":"2016-06-14 17:50:26.000000000","message":"This effectively obsoletes mac_generation_retries for its original purpose (but leaves it for generating dvr mac addresses).  I\u0027m totally okay with that.  I also seriously doubt that its addition was driven by any real user need.  And, we\u0027re still limiting the number of retries, just in a more general way.\n\nI think that we ought to deprecate it for Newton and remove it in Ocata, just in case someone has set it so that things don\u0027t just blow up unexpectedly.  I\u0027ll put a patch up as a follow-on to this one that proposes replacing it in the dvr mac generation stuff with a more generic max retries.\n\nJust to be clear, I don\u0027t think that this patch needs to wait for deprecation.  I think obsoleting the option is fine in this case, without warning.  The deprecation is just to follow procedure and avoid blowing up on an option that used to work and wasn\u0027t properly deprecated.","commit_id":"d72a21ae6fedda3aca61ce3e7f29eeb6b487732f"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"d085bc67dd9a65da5d9a18224d128d48cd5c086e","unresolved":false,"context_lines":[{"line_number":1188,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dmac_address)"},{"line_number":1189,"context_line":""},{"line_number":1190,"context_line":"    def _create_port(self, context, network_id, port_data):"},{"line_number":1191,"context_line":"        max_retries \u003d cfg.CONF.mac_generation_retries"},{"line_number":1192,"context_line":"        for i in range(max_retries):"},{"line_number":1193,"context_line":"            mac \u003d self._generate_mac()"},{"line_number":1194,"context_line":"            try:"}],"source_content_type":"text/x-python","patch_set":4,"id":"7aa08908_e37ac676","side":"PARENT","line":1191,"range":{"start_line":1191,"start_character":31,"end_line":1191,"end_character":53},"in_reply_to":"7aa08908_94ad4833","updated":"2016-06-15 23:26:45.000000000","message":"Just to follow up:  https://review.openstack.org/330273","commit_id":"d72a21ae6fedda3aca61ce3e7f29eeb6b487732f"}],"neutron/db/ipam_backend_mixin.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"43003e5e748a2c60a4d6d373956c631b2efb425e","unresolved":false,"context_lines":[{"line_number":107,"context_line":"    def _update_db_port(self, context, db_port, new_port, network_id, new_mac):"},{"line_number":108,"context_line":"        # Remove all attributes in new_port which are not in the port DB model"},{"line_number":109,"context_line":"        # and then update the port"},{"line_number":110,"context_line":"        if new_mac and self._is_mac_in_use(context, network_id, new_mac):"},{"line_number":111,"context_line":"            raise exc.MacAddressInUse(net_id\u003dnetwork_id, mac\u003dnew_mac)"},{"line_number":112,"context_line":"        db_port.update(self._filter_non_model_columns(new_port,"},{"line_number":113,"context_line":"                                                      models_v2.Port))"}],"source_content_type":"text/x-python","patch_set":1,"id":"7aa08908_b23bfc37","line":110,"range":{"start_line":110,"start_character":11,"end_line":110,"end_character":18},"updated":"2016-06-09 18:21:45.000000000","message":"This update is requesting a specific mac address.  So, keep this explicit check here.","commit_id":"039e09336f3d327139aed9591758cf5b53be0bee"}]}
