)]}'
{"blazar/plugins/instances/instance_plugin.py":[{"author":{"_account_id":8878,"name":"Masahito Muroi","email":"masahito.muroi@g.softbank.co.jp","username":"masa"},"change_message_id":"49625033d31ea53c1b352c4fac7a4cca384222aa","unresolved":false,"context_lines":[{"line_number":659,"context_line":"                    reservation, allocation[\u0027compute_host_id\u0027])"},{"line_number":660,"context_line":"                db_api.host_allocation_update("},{"line_number":661,"context_line":"                    allocation[\u0027id\u0027], {\u0027compute_host_id\u0027: new_host_id})"},{"line_number":662,"context_line":"                self._post_reallocate(reservation, lease, new_host_id, 1)"},{"line_number":663,"context_line":"        return ret"},{"line_number":664,"context_line":""},{"line_number":665,"context_line":"    def _select_host(self, reservation, lease):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9fdfeff1_44af907c","line":662,"range":{"start_line":662,"start_character":71,"end_line":662,"end_character":73},"updated":"2019-01-29 09:56:17.000000000","message":"In case of the affinity \u003d\u003d Null, the inventory should add 1, not update , shouldn\u0027t it?\n\nIf the new_host_id already has another allocation of the reservation, the number of inventory should be 2.","commit_id":"adf37367e17de2e613bcb45b8e9d98cffaa67a78"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"cbbfc651aad8444b98d8eda41da9454d9d805181","unresolved":false,"context_lines":[{"line_number":659,"context_line":"                    reservation, allocation[\u0027compute_host_id\u0027])"},{"line_number":660,"context_line":"                db_api.host_allocation_update("},{"line_number":661,"context_line":"                    allocation[\u0027id\u0027], {\u0027compute_host_id\u0027: new_host_id})"},{"line_number":662,"context_line":"                self._post_reallocate(reservation, lease, new_host_id, 1)"},{"line_number":663,"context_line":"        return ret"},{"line_number":664,"context_line":""},{"line_number":665,"context_line":"    def _select_host(self, reservation, lease):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9fdfeff1_aa493ab7","line":662,"range":{"start_line":662,"start_character":71,"end_line":662,"end_character":73},"in_reply_to":"9fdfeff1_44af907c","updated":"2019-01-31 10:22:42.000000000","message":"eeeeeeeexcellent catch. thanks a lot.","commit_id":"adf37367e17de2e613bcb45b8e9d98cffaa67a78"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"c3db47e1d1cf1ee0bd9b1fe05c6d2cda63c452ee","unresolved":false,"context_lines":[{"line_number":659,"context_line":"                    reservation, allocation[\u0027compute_host_id\u0027])"},{"line_number":660,"context_line":"                db_api.host_allocation_update("},{"line_number":661,"context_line":"                    allocation[\u0027id\u0027], {\u0027compute_host_id\u0027: new_host_id})"},{"line_number":662,"context_line":"                self._post_reallocate(reservation, lease, new_host_id, 1)"},{"line_number":663,"context_line":"        return ret"},{"line_number":664,"context_line":""},{"line_number":665,"context_line":"    def _select_host(self, reservation, lease):"}],"source_content_type":"text/x-python","patch_set":6,"id":"9fdfeff1_a2336313","line":662,"range":{"start_line":662,"start_character":71,"end_line":662,"end_character":73},"in_reply_to":"9fdfeff1_aa493ab7","updated":"2019-02-19 06:22:32.000000000","message":"I changed update_reservation_inventory() to accept adding inventory in https://review.openstack.org/#/c/634192/4 and updated this patch to use it. Thank you again for this excellent catch.","commit_id":"adf37367e17de2e613bcb45b8e9d98cffaa67a78"},{"author":{"_account_id":15197,"name":"Pierre Riteau","email":"pierre@stackhpc.com","username":"priteau","status":"StackHPC"},"change_message_id":"9c60efd984998d83ae0df9a3e76b7f07fbc4d5d9","unresolved":false,"context_lines":[{"line_number":651,"context_line":"            alloc for alloc in reservation[\u0027computehost_allocations\u0027]"},{"line_number":652,"context_line":"            if alloc[\u0027compute_host_id\u0027] in host_ids]"},{"line_number":653,"context_line":""},{"line_number":654,"context_line":"        if reservation[\u0027affinity\u0027]:"},{"line_number":655,"context_line":"            old_host_id \u003d allocations[0][\u0027compute_host_id\u0027]"},{"line_number":656,"context_line":"            new_host_id \u003d self._select_host(reservation, lease)"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"            self._pre_reallocate(reservation, old_host_id)"},{"line_number":659,"context_line":""},{"line_number":660,"context_line":"            if new_host_id is None:"},{"line_number":661,"context_line":"                for allocation in allocations:"},{"line_number":662,"context_line":"                    db_api.host_allocation_destroy(allocation[\u0027id\u0027])"},{"line_number":663,"context_line":"                LOG.warn(\u0027Could not find alternative host for \u0027"},{"line_number":664,"context_line":"                         \u0027reservation %s (lease: %s).\u0027,"},{"line_number":665,"context_line":"                         reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":666,"context_line":"                ret \u003d False"},{"line_number":667,"context_line":"            else:"},{"line_number":668,"context_line":"                for allocation in allocations:"},{"line_number":669,"context_line":"                    db_api.host_allocation_update("},{"line_number":670,"context_line":"                        allocation[\u0027id\u0027], {\u0027compute_host_id\u0027: new_host_id})"},{"line_number":671,"context_line":"                self._post_reallocate("},{"line_number":672,"context_line":"                    reservation, lease, new_host_id, len(allocations))"},{"line_number":673,"context_line":""},{"line_number":674,"context_line":"        else:"},{"line_number":675,"context_line":"            new_host_ids \u003d []"},{"line_number":676,"context_line":"            for allocation in allocations:"},{"line_number":677,"context_line":"                old_host_id \u003d allocation[\u0027compute_host_id\u0027]"},{"line_number":678,"context_line":"                new_host_id \u003d self._select_host(reservation, lease)"},{"line_number":679,"context_line":""},{"line_number":680,"context_line":"                self._pre_reallocate(reservation, old_host_id)"},{"line_number":681,"context_line":""},{"line_number":682,"context_line":"                if new_host_id is None:"},{"line_number":683,"context_line":"                    db_api.host_allocation_destroy(allocation[\u0027id\u0027])"},{"line_number":684,"context_line":"                    LOG.warn(\u0027Could not find alternative host for \u0027"},{"line_number":685,"context_line":"                             \u0027reservation %s (lease: %s).\u0027,"},{"line_number":686,"context_line":"                             reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":687,"context_line":"                    ret \u003d False"},{"line_number":688,"context_line":"                    continue"},{"line_number":689,"context_line":""},{"line_number":690,"context_line":"                db_api.host_allocation_update("},{"line_number":691,"context_line":"                    allocation[\u0027id\u0027], {\u0027compute_host_id\u0027: new_host_id})"},{"line_number":692,"context_line":"                new_host_ids.append(new_host_id)"},{"line_number":693,"context_line":""},{"line_number":694,"context_line":"            for new_host, num in collections.Counter(new_host_ids).items():"},{"line_number":695,"context_line":"                self._post_reallocate(reservation, lease, new_host, num)"},{"line_number":696,"context_line":""},{"line_number":697,"context_line":"        return ret"},{"line_number":698,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"5fc1f717_7849f5b4","line":695,"range":{"start_line":654,"start_character":0,"end_line":695,"end_character":72},"updated":"2019-03-14 18:52:31.000000000","message":"The if and else blocks are very similar. I suppose you separated them so that we don\u0027t write a warning to the logs for each allocation, in the affinity case.\n\nHowever, if affinity \u003d None (default), aren\u0027t we going to see the same problem with duplicate log entries if there are several allocations per host?","commit_id":"0d867f50b4d2363986be80f5d7255428aa1cd463"},{"author":{"_account_id":25625,"name":"Tetsuro Nakamura","email":"tetsuro.nakamura.bc@hco.ntt.co.jp","username":"tetsuro0907"},"change_message_id":"8f433570a07d2d43bc9392aeac46398a23474cc1","unresolved":false,"context_lines":[{"line_number":651,"context_line":"            alloc for alloc in reservation[\u0027computehost_allocations\u0027]"},{"line_number":652,"context_line":"            if alloc[\u0027compute_host_id\u0027] in host_ids]"},{"line_number":653,"context_line":""},{"line_number":654,"context_line":"        if reservation[\u0027affinity\u0027]:"},{"line_number":655,"context_line":"            old_host_id \u003d allocations[0][\u0027compute_host_id\u0027]"},{"line_number":656,"context_line":"            new_host_id \u003d self._select_host(reservation, lease)"},{"line_number":657,"context_line":""},{"line_number":658,"context_line":"            self._pre_reallocate(reservation, old_host_id)"},{"line_number":659,"context_line":""},{"line_number":660,"context_line":"            if new_host_id is None:"},{"line_number":661,"context_line":"                for allocation in allocations:"},{"line_number":662,"context_line":"                    db_api.host_allocation_destroy(allocation[\u0027id\u0027])"},{"line_number":663,"context_line":"                LOG.warn(\u0027Could not find alternative host for \u0027"},{"line_number":664,"context_line":"                         \u0027reservation %s (lease: %s).\u0027,"},{"line_number":665,"context_line":"                         reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":666,"context_line":"                ret \u003d False"},{"line_number":667,"context_line":"            else:"},{"line_number":668,"context_line":"                for allocation in allocations:"},{"line_number":669,"context_line":"                    db_api.host_allocation_update("},{"line_number":670,"context_line":"                        allocation[\u0027id\u0027], {\u0027compute_host_id\u0027: new_host_id})"},{"line_number":671,"context_line":"                self._post_reallocate("},{"line_number":672,"context_line":"                    reservation, lease, new_host_id, len(allocations))"},{"line_number":673,"context_line":""},{"line_number":674,"context_line":"        else:"},{"line_number":675,"context_line":"            new_host_ids \u003d []"},{"line_number":676,"context_line":"            for allocation in allocations:"},{"line_number":677,"context_line":"                old_host_id \u003d allocation[\u0027compute_host_id\u0027]"},{"line_number":678,"context_line":"                new_host_id \u003d self._select_host(reservation, lease)"},{"line_number":679,"context_line":""},{"line_number":680,"context_line":"                self._pre_reallocate(reservation, old_host_id)"},{"line_number":681,"context_line":""},{"line_number":682,"context_line":"                if new_host_id is None:"},{"line_number":683,"context_line":"                    db_api.host_allocation_destroy(allocation[\u0027id\u0027])"},{"line_number":684,"context_line":"                    LOG.warn(\u0027Could not find alternative host for \u0027"},{"line_number":685,"context_line":"                             \u0027reservation %s (lease: %s).\u0027,"},{"line_number":686,"context_line":"                             reservation[\u0027id\u0027], lease[\u0027name\u0027])"},{"line_number":687,"context_line":"                    ret \u003d False"},{"line_number":688,"context_line":"                    continue"},{"line_number":689,"context_line":""},{"line_number":690,"context_line":"                db_api.host_allocation_update("},{"line_number":691,"context_line":"                    allocation[\u0027id\u0027], {\u0027compute_host_id\u0027: new_host_id})"},{"line_number":692,"context_line":"                new_host_ids.append(new_host_id)"},{"line_number":693,"context_line":""},{"line_number":694,"context_line":"            for new_host, num in collections.Counter(new_host_ids).items():"},{"line_number":695,"context_line":"                self._post_reallocate(reservation, lease, new_host, num)"},{"line_number":696,"context_line":""},{"line_number":697,"context_line":"        return ret"},{"line_number":698,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"5fc1f717_617cd982","line":695,"range":{"start_line":654,"start_character":0,"end_line":695,"end_character":72},"in_reply_to":"5fc1f717_7849f5b4","updated":"2019-03-15 04:07:46.000000000","message":"The main reason I separated them is that we need to _select_host() for each allocation if affinity\u003dFalse or None while we need to _select_host() for all allocations at one time if affinity\u003dTrue.\n\nI\u0027m aware that these chunks are similar and tried to refactor, but I decided to leave as is since the new host selection policies are pretty different between the two block.\n\nLet me look if we can refactor in a followup.","commit_id":"0d867f50b4d2363986be80f5d7255428aa1cd463"}]}
