)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"953c3bae3c6f89b0ee6ec8b09d8de3403796c820","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"WIP: Don\u0027t delete allocation if instance being scheduled"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"There could be a potential race if some other but the compute service"},{"line_number":10,"context_line":"create allocations (say, the scheduler) because then the self-healing"},{"line_number":11,"context_line":"process that runs periodically on compute would delete that allocation"},{"line_number":12,"context_line":"given it wouldn\u0027t find the related instance for that host."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"5ff73747_019f78b4","line":9,"updated":"2017-04-26 15:51:58.000000000","message":"something other than","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"9eedbbb9d23a7f4b9294afbee21361a5a5df21d4","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"WIP: Don\u0027t delete allocation if instance being scheduled"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"There could be a potential race if some other but the compute service"},{"line_number":10,"context_line":"create allocations (say, the scheduler) because then the self-healing"},{"line_number":11,"context_line":"process that runs periodically on compute would delete that allocation"},{"line_number":12,"context_line":"given it wouldn\u0027t find the related instance for that host."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"5ff73747_b8a0a091","line":9,"range":{"start_line":9,"start_character":35,"end_line":9,"end_character":49},"updated":"2017-04-28 19:35:06.000000000","message":"Repeating cdent\u0027s comment from PS1: something other than","commit_id":"0bc807fb77a59e5739849b239d47081b9a445dec"}],"nova/compute/resource_tracker.py":[{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"953c3bae3c6f89b0ee6ec8b09d8de3403796c820","unresolved":false,"context_lines":[{"line_number":1001,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1002,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1003,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1004,"context_line":"            # we already wrote the allocation previously."},{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"}],"source_content_type":"text/x-python","patch_set":1,"id":"5ff73747_81cca861","line":1004,"updated":"2017-04-26 15:51:58.000000000","message":"What is the reason for why this code shouldn\u0027t go in the original remove_deleted_instances method? If we don\u0027t want to delete them now, why would we ever?\n\nAnd if we never do, why not use the pre-existing method?","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"cba2fdafba925d08e44f6dd87685af73ce4d5f77","unresolved":false,"context_lines":[{"line_number":1001,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1002,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1003,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1004,"context_line":"            # we already wrote the allocation previously."},{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"}],"source_content_type":"text/x-python","patch_set":1,"id":"5ff73747_cb7161aa","line":1004,"in_reply_to":"5ff73747_2a8c7634","updated":"2017-04-28 13:24:37.000000000","message":"The code duplication is worrisome. I would prefer to see the RT add the host/node info to the dict, and the logic in remove_deleted_instances() updated to account for it.\n\nOh, and if you do go that route, I would totally support changing the parameter of that method from \u0027instance_uuids\u0027 to \u0027instance_dict\u0027.","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"dd764bc7162aadc278619013070937c0348cf0c4","unresolved":false,"context_lines":[{"line_number":1001,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1002,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1003,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1004,"context_line":"            # we already wrote the allocation previously."},{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"}],"source_content_type":"text/x-python","patch_set":1,"id":"5ff73747_2a8c7634","line":1004,"in_reply_to":"5ff73747_5fff9433","updated":"2017-04-27 07:49:30.000000000","message":"Because we need to lookup the related instance host and node fields *for the allocations returned by Placement* (not from tracked_instances which are the ones we don\u0027t care about since we already track them)","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"fcff8834857a105458025fe18179534684221a6f","unresolved":false,"context_lines":[{"line_number":1001,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1002,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1003,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1004,"context_line":"            # we already wrote the allocation previously."},{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"}],"source_content_type":"text/x-python","patch_set":1,"id":"5ff73747_f0d57744","line":1004,"in_reply_to":"5ff73747_81cca861","updated":"2017-04-26 16:27:36.000000000","message":"Because having the report client calling the Nova object facade for getting the instance seems wrong to me.","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"31ccf322c687ee4975f3a766360caac0ecb0c58b","unresolved":false,"context_lines":[{"line_number":1001,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1002,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1003,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1004,"context_line":"            # we already wrote the allocation previously."},{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"}],"source_content_type":"text/x-python","patch_set":1,"id":"5ff73747_304bdfb0","line":1004,"in_reply_to":"5ff73747_f0d57744","updated":"2017-04-26 16:40:51.000000000","message":"So the idea is to completely replace the other method? If so, okay, that\u0027s fine. The thing that wasn\u0027t clear was that if that other method wasn\u0027t being replaced why that one shouldn\u0027t also get this fix.","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"104a03906ddb29fbbd27640c3283b9a40aa90453","unresolved":false,"context_lines":[{"line_number":1001,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1002,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1003,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1004,"context_line":"            # we already wrote the allocation previously."},{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"}],"source_content_type":"text/x-python","patch_set":1,"id":"5ff73747_5fff9433","line":1004,"in_reply_to":"5ff73747_f0d57744","updated":"2017-04-26 18:56:37.000000000","message":"Why would you need to call the object facade? Don\u0027t you already have the plain dicts in tracked_instances?","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"926ad32ecfa876a1024700d98b4279e3e68561f2","unresolved":false,"context_lines":[{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"},{"line_number":1008,"context_line":"                or instance.host \u003d\u003d self.node):"},{"line_number":1009,"context_line":"                    continue"},{"line_number":1010,"context_line":"            LOG.warning(_LW(\u0027Deleting stale allocation for instance %s\u0027),"},{"line_number":1011,"context_line":"                        allocation_uuid)"}],"source_content_type":"text/x-python","patch_set":1,"id":"5ff73747_a1afa4e1","line":1008,"range":{"start_line":1008,"start_character":28,"end_line":1008,"end_character":32},"updated":"2017-04-26 15:42:39.000000000","message":"OH MAN... s/host/node","commit_id":"9108f6dff94bed863eb8430caf50364de8ce49c3"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"62bfa83d533fed1ec58fa91e0d0db7b8a576c2bf","unresolved":false,"context_lines":[{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"},{"line_number":1008,"context_line":"                or instance.node \u003d\u003d self.node):"},{"line_number":1009,"context_line":"                    continue"},{"line_number":1010,"context_line":"            LOG.warning(_LW(\u0027Deleting stale allocation for instance %s\u0027),"},{"line_number":1011,"context_line":"                        allocation_uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5ff73747_12af592a","line":1008,"updated":"2017-05-01 16:13:06.000000000","message":"There is no \"node\" attribute of the resource tracker anymore since we now have only a single resource tracker instance that handles all compute node objects assigned to the host.","commit_id":"0bc807fb77a59e5739849b239d47081b9a445dec"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d3cf6ea16ac57dd31cf93b8a1cb696d2f05d223d","unresolved":false,"context_lines":[{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"},{"line_number":1008,"context_line":"                or instance.node \u003d\u003d self.node):"},{"line_number":1009,"context_line":"                    continue"},{"line_number":1010,"context_line":"            LOG.warning(_LW(\u0027Deleting stale allocation for instance %s\u0027),"},{"line_number":1011,"context_line":"                        allocation_uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5ff73747_da30c4eb","line":1008,"in_reply_to":"5ff73747_12af592a","updated":"2017-05-02 16:32:51.000000000","message":"I don\u0027t think this conditional is correct. If instance.host is not set, then it\u0027s being scheduled and we should skip it. If it\u0027s set to our host/node then it _is_ stale because it\u0027s assigned to us and we aren\u0027t tracking it. Right? So I think this should just be:\n\n if not instance.host:\n     continue\n\nRight?","commit_id":"0bc807fb77a59e5739849b239d47081b9a445dec"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"661e3878b9e3becc72c2d701f0f9b7ca4eecf340","unresolved":false,"context_lines":[{"line_number":1005,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1006,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1007,"context_line":"            if (not instance.host or instance.host \u003d\u003d self.host"},{"line_number":1008,"context_line":"                or instance.node \u003d\u003d self.node):"},{"line_number":1009,"context_line":"                    continue"},{"line_number":1010,"context_line":"            LOG.warning(_LW(\u0027Deleting stale allocation for instance %s\u0027),"},{"line_number":1011,"context_line":"                        allocation_uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f044301_c95b4d2c","line":1008,"in_reply_to":"5ff73747_da30c4eb","updated":"2017-05-04 17:03:28.000000000","message":"Agree that we only need \"if not instance.host:\"","commit_id":"0bc807fb77a59e5739849b239d47081b9a445dec"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"62bfa83d533fed1ec58fa91e0d0db7b8a576c2bf","unresolved":false,"context_lines":[{"line_number":1010,"context_line":"            LOG.warning(_LW(\u0027Deleting stale allocation for instance %s\u0027),"},{"line_number":1011,"context_line":"                        allocation_uuid)"},{"line_number":1012,"context_line":"            self.scheduler_client.reportclient._delete_allocation_for_instance("},{"line_number":1013,"context_line":"                allocation_uuid)"},{"line_number":1014,"context_line":""},{"line_number":1015,"context_line":"        cn.free_ram_mb \u003d max(0, cn.free_ram_mb)"},{"line_number":1016,"context_line":"        cn.free_disk_gb \u003d max(0, cn.free_disk_gb)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5ff73747_52b96176","line":1013,"updated":"2017-05-01 16:13:06.000000000","message":"I actually don\u0027t see any reason to have the above code. We are making a compute-\u003econductor-\u003eDB-\u003ecompute call for each and every instance on the host just to determine if the instance is \"being scheduled\".\n\nWe could do this in a single DB call by simply filtering out instances that are in task_state in (SCHEDULING, BLOCK_DEVICE_MAPPING, NETWORKING, BUILDING) right after we call InstanceList.get_all_by_host_and_node() here:\n\nhttps://github.com/openstack/nova/blob/master/nova/compute/resource_tracker.py#L609","commit_id":"0bc807fb77a59e5739849b239d47081b9a445dec"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"d3cf6ea16ac57dd31cf93b8a1cb696d2f05d223d","unresolved":false,"context_lines":[{"line_number":1010,"context_line":"            LOG.warning(_LW(\u0027Deleting stale allocation for instance %s\u0027),"},{"line_number":1011,"context_line":"                        allocation_uuid)"},{"line_number":1012,"context_line":"            self.scheduler_client.reportclient._delete_allocation_for_instance("},{"line_number":1013,"context_line":"                allocation_uuid)"},{"line_number":1014,"context_line":""},{"line_number":1015,"context_line":"        cn.free_ram_mb \u003d max(0, cn.free_ram_mb)"},{"line_number":1016,"context_line":"        cn.free_disk_gb \u003d max(0, cn.free_disk_gb)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5ff73747_da17a445","line":1013,"in_reply_to":"5ff73747_52b96176","updated":"2017-05-02 16:32:51.000000000","message":"Actually I think this is only doing the check for any instances that we found in placement but that aren\u0027t in our instance list, right? L1000 is where we build that delta.","commit_id":"0bc807fb77a59e5739849b239d47081b9a445dec"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"661e3878b9e3becc72c2d701f0f9b7ca4eecf340","unresolved":false,"context_lines":[{"line_number":1010,"context_line":"            LOG.warning(_LW(\u0027Deleting stale allocation for instance %s\u0027),"},{"line_number":1011,"context_line":"                        allocation_uuid)"},{"line_number":1012,"context_line":"            self.scheduler_client.reportclient._delete_allocation_for_instance("},{"line_number":1013,"context_line":"                allocation_uuid)"},{"line_number":1014,"context_line":""},{"line_number":1015,"context_line":"        cn.free_ram_mb \u003d max(0, cn.free_ram_mb)"},{"line_number":1016,"context_line":"        cn.free_disk_gb \u003d max(0, cn.free_disk_gb)"}],"source_content_type":"text/x-python","patch_set":2,"id":"3f044301_6991d999","line":1013,"in_reply_to":"5ff73747_da17a445","updated":"2017-05-04 17:03:28.000000000","message":"Yeah, this only iterates over the instance UUIDs that are in allocations but not in self.tracked_instances.","commit_id":"0bc807fb77a59e5739849b239d47081b9a445dec"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"59f1488d8d4657d74611de5b4d3ba889dbb603de","unresolved":false,"context_lines":[{"line_number":1003,"context_line":"            # we already wrote the allocation previously."},{"line_number":1004,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, allocation_uuid,"},{"line_number":1005,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1006,"context_line":"            if not instance.host:"},{"line_number":1007,"context_line":"                continue"},{"line_number":1008,"context_line":"            LOG.warning(\u0027Deleting stale allocation for instance %s\u0027,"},{"line_number":1009,"context_line":"                        allocation_uuid)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f044301_4fff3daa","line":1006,"updated":"2017-05-04 17:59:20.000000000","message":"OK, logic above checks out. There\u0027s a semaphore lock held on the compute node for methods that change the tracked_instanmce dict so there should be no situations where an instance.host attribute is set (by instance_claim()) in between when lines 996 and 998 are called.","commit_id":"20fa3f1d2fbd9d58c99dd886f5f9ca3ab4e73d04"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"59f1488d8d4657d74611de5b4d3ba889dbb603de","unresolved":false,"context_lines":[{"line_number":1007,"context_line":"                continue"},{"line_number":1008,"context_line":"            LOG.warning(\u0027Deleting stale allocation for instance %s\u0027,"},{"line_number":1009,"context_line":"                        allocation_uuid)"},{"line_number":1010,"context_line":"            self.reportclient._delete_allocation_for_instance( allocation_uuid)"},{"line_number":1011,"context_line":""},{"line_number":1012,"context_line":"        cn.free_ram_mb \u003d max(0, cn.free_ram_mb)"},{"line_number":1013,"context_line":"        cn.free_disk_gb \u003d max(0, cn.free_disk_gb)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f044301_2f2e3143","line":1010,"updated":"2017-05-04 17:59:20.000000000","message":"extra space after \"instance(\" ...","commit_id":"20fa3f1d2fbd9d58c99dd886f5f9ca3ab4e73d04"},{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"03f5c680c58737eef97f6130b36c112ca4a75f90","unresolved":false,"context_lines":[{"line_number":1007,"context_line":"                continue"},{"line_number":1008,"context_line":"            LOG.warning(\u0027Deleting stale allocation for instance %s\u0027,"},{"line_number":1009,"context_line":"                        allocation_uuid)"},{"line_number":1010,"context_line":"            self.reportclient._delete_allocation_for_instance( allocation_uuid)"},{"line_number":1011,"context_line":""},{"line_number":1012,"context_line":"        cn.free_ram_mb \u003d max(0, cn.free_ram_mb)"},{"line_number":1013,"context_line":"        cn.free_disk_gb \u003d max(0, cn.free_disk_gb)"}],"source_content_type":"text/x-python","patch_set":3,"id":"3f044301_c727b164","line":1010,"in_reply_to":"3f044301_2f2e3143","updated":"2017-05-04 19:34:28.000000000","message":"Done","commit_id":"20fa3f1d2fbd9d58c99dd886f5f9ca3ab4e73d04"},{"author":{"_account_id":4393,"name":"Dan Smith","email":"dms@danplanet.com","username":"danms"},"change_message_id":"2a4b9af6a67aa10452099cca73f34928c51e183b","unresolved":false,"context_lines":[{"line_number":1001,"context_line":"    def _remove_deleted_instances_allocations(self, context, cn):"},{"line_number":1002,"context_line":"        inst_dict \u003d {instance[\u0027uuid\u0027]: instance"},{"line_number":1003,"context_line":"                     for instance in self.tracked_instances.values()}"},{"line_number":1004,"context_line":"        allocations \u003d self.reportclient.get_allocations(cn.uuid) or {}"},{"line_number":1005,"context_line":"        allocations_to_delete \u003d set(allocations.keys()) - set(inst_dict.keys())"},{"line_number":1006,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1007,"context_line":"            # Allocations related to instances being scheduled or instances"}],"source_content_type":"text/x-python","patch_set":6,"id":"3f044301_7531780b","line":1004,"updated":"2017-05-07 17:35:41.000000000","message":"Without looking, I think we fetch instance allocations when healing each instance to check if we need to auto-heal. We could probably unify some of that by doing an initial fetch of all of them, then updating and creating the ones we need, followed by purging the ones we don\u0027t. However, this is fine for a first pass.","commit_id":"dcf25d6d1a1a3bf256bdfa837186057f89730073"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"2a8ec2d545648260cbcfa0bb1194bce0c1cfee1d","unresolved":false,"context_lines":[{"line_number":1003,"context_line":"                     for instance in self.tracked_instances.values()}"},{"line_number":1004,"context_line":"        allocations \u003d self.reportclient.get_allocations(cn.uuid) or {}"},{"line_number":1005,"context_line":"        allocations_to_delete \u003d set(allocations.keys()) - set(inst_dict.keys())"},{"line_number":1006,"context_line":"        for allocation_uuid in allocations_to_delete:"},{"line_number":1007,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1008,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1009,"context_line":"            # we already wrote the allocation previously."}],"source_content_type":"text/x-python","patch_set":7,"id":"ff0f0b1f_483bbdd0","line":1006,"updated":"2017-05-17 18:06:27.000000000","message":"I\u0027d prefer we used consumer_uuid instead of allocation_uuid here, because that\u0027s what the uuid is. Or if not consumer_uuid then instance_uuid. \n\nIt\u0027s not strictly necessary, but I certainly stumbled here.","commit_id":"d00b86908f909437df94d53cf06a04a420b82727"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b56910a40c0cdfbc0f4b1297c227735412cf501d","unresolved":false,"context_lines":[{"line_number":1000,"context_line":""},{"line_number":1001,"context_line":"    def _remove_deleted_instances_allocations(self, context, cn):"},{"line_number":1002,"context_line":"        inst_dict \u003d {instance[\u0027uuid\u0027]: instance"},{"line_number":1003,"context_line":"                     for instance in self.tracked_instances.values()}"},{"line_number":1004,"context_line":"        allocations \u003d self.reportclient.get_allocations_for_resource_provider("},{"line_number":1005,"context_line":"            cn.uuid) or {}"},{"line_number":1006,"context_line":"        allocations_to_delete \u003d set(allocations.keys()) - set(inst_dict.keys())"}],"source_content_type":"text/x-python","patch_set":9,"id":"ff0f0b1f_4419f21f","line":1003,"updated":"2017-05-22 14:22:58.000000000","message":"RT.tracked_instances is a dict keyed by instance UUID already, so just do:\n\n tracked_keys \u003d set(self.tracked_instances.keys())\n\nand then below on line 1006 just do:\n\n allocations_to_delete \u003d set(allocations.keys()) - tracked_keys","commit_id":"e9215ed8960cdcd902f73a96bda30eb43c0443b8"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b56910a40c0cdfbc0f4b1297c227735412cf501d","unresolved":false,"context_lines":[{"line_number":1006,"context_line":"        allocations_to_delete \u003d set(allocations.keys()) - set(inst_dict.keys())"},{"line_number":1007,"context_line":"        for instance_uuid in allocations_to_delete:"},{"line_number":1008,"context_line":"            # Allocations related to instances being scheduled or instances"},{"line_number":1009,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1010,"context_line":"            # we already wrote the allocation previously."},{"line_number":1011,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, instance_uuid,"},{"line_number":1012,"context_line":"                                                    expected_attrs\u003d[])"}],"source_content_type":"text/x-python","patch_set":9,"id":"ff0f0b1f_04a3fab3","line":1009,"range":{"start_line":1009,"start_character":14,"end_line":1009,"end_character":53},"updated":"2017-05-22 14:22:58.000000000","message":"what do you mean by \"instances already scheduled to that specific host\"? Do you mean an instance that has its host attribute set already? If so, the above contradicts line 1013, and you should probably just remove the above from the comment, since we\u0027re only concerned with finding instances that have been deleted but have not yet had their allocation records in the placement service removed.","commit_id":"e9215ed8960cdcd902f73a96bda30eb43c0443b8"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b56910a40c0cdfbc0f4b1297c227735412cf501d","unresolved":false,"context_lines":[{"line_number":1009,"context_line":"            # already scheduled to that specific host should not be deleted if"},{"line_number":1010,"context_line":"            # we already wrote the allocation previously."},{"line_number":1011,"context_line":"            instance \u003d objects.Instance.get_by_uuid(context, instance_uuid,"},{"line_number":1012,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1013,"context_line":"            if not instance.host:"},{"line_number":1014,"context_line":"                continue"},{"line_number":1015,"context_line":"            LOG.warning(\u0027Deleting stale allocation for instance %s\u0027,"}],"source_content_type":"text/x-python","patch_set":9,"id":"ff0f0b1f_e4bec6b2","line":1012,"updated":"2017-05-22 14:22:58.000000000","message":"It would be more efficient to do a single objects.InstanceList.get_by_filters() and pass in all instance UUIDs in allocations_to_delete, instead of calling the conductor and DB for each deleted instance.\n\nBut, that said, there shouldn\u0027t be too many deleted instances on any particular host so this performance problem isn\u0027t too important.","commit_id":"e9215ed8960cdcd902f73a96bda30eb43c0443b8"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"60a9419c16a7ed5b7e6efe9a9c9643969e29a91f","unresolved":false,"context_lines":[{"line_number":1010,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1011,"context_line":"            if not instance.host:"},{"line_number":1012,"context_line":"                continue"},{"line_number":1013,"context_line":"            LOG.warning(\u0027Deleting stale allocation for instance %s\u0027,"},{"line_number":1014,"context_line":"                        instance_uuid)"},{"line_number":1015,"context_line":"            self.reportclient.delete_allocation_for_instance(instance_uuid)"},{"line_number":1016,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"ff0f0b1f_b1cf4baf","line":1013,"updated":"2017-05-26 18:40:50.000000000","message":"Why is this a warning? Won\u0027t this spew a ton of warnings until the conductor is removing allocations during reschedules? What about a normal delete flow where we actually remove the instance on the compute and cleanup the allocations?","commit_id":"439f67e7bc795f171af8248400c3f3e17a0bbe7e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"93645b82c42503172bb76cb23709abdf2c9b3a30","unresolved":false,"context_lines":[{"line_number":1010,"context_line":"                                                    expected_attrs\u003d[])"},{"line_number":1011,"context_line":"            if not instance.host:"},{"line_number":1012,"context_line":"                continue"},{"line_number":1013,"context_line":"            LOG.warning(\u0027Deleting stale allocation for instance %s\u0027,"},{"line_number":1014,"context_line":"                        instance_uuid)"},{"line_number":1015,"context_line":"            self.reportclient.delete_allocation_for_instance(instance_uuid)"},{"line_number":1016,"context_line":""}],"source_content_type":"text/x-python","patch_set":12,"id":"ff0f0b1f_516c6f9b","line":1013,"in_reply_to":"ff0f0b1f_b1cf4baf","updated":"2017-05-26 18:43:37.000000000","message":"Good lord:\n\nhttp://logstash.openstack.org/#dashboard/file/logstash.json?query\u003dmessage%3A%5C%22Deleting%20stale%20allocation%20for%20instance%5C%22%20AND%20tags%3A%5C%22screen-n-cpu.txt%5C%22\u0026from\u003d7d","commit_id":"439f67e7bc795f171af8248400c3f3e17a0bbe7e"}],"nova/scheduler/client/report.py":[{"author":{"_account_id":7166,"name":"Sylvain Bauza","email":"sbauza@redhat.com","username":"sbauza"},"change_message_id":"c0890acbcc4e5afb3f4831b3e21922ad0b1660aa","unresolved":false,"context_lines":[{"line_number":916,"context_line":"        else:"},{"line_number":917,"context_line":"            return resp.json()[\u0027allocations\u0027]"},{"line_number":918,"context_line":""},{"line_number":919,"context_line":"    def remove_deleted_instances(self, compute_node, instance_uuids):"},{"line_number":920,"context_line":"        allocations \u003d self.get_allocations(compute_node.uuid)"},{"line_number":921,"context_line":"        if allocations is None:"},{"line_number":922,"context_line":"            allocations \u003d {}"}],"source_content_type":"text/x-python","patch_set":5,"id":"3f044301_c77a0223","line":919,"range":{"start_line":919,"start_character":8,"end_line":919,"end_character":31},"updated":"2017-05-05 08:50:13.000000000","message":"forgot to remove that one.","commit_id":"c80b8101b2df40905825741945d1d5952aa44b64"},{"author":{"_account_id":11564,"name":"Chris Dent","email":"cdent@anticdent.org","username":"chdent"},"change_message_id":"2a8ec2d545648260cbcfa0bb1194bce0c1cfee1d","unresolved":false,"context_lines":[{"line_number":908,"context_line":"            self.delete_allocation_for_instance(instance.uuid)"},{"line_number":909,"context_line":""},{"line_number":910,"context_line":"    @safe_connect"},{"line_number":911,"context_line":"    def get_allocations(self, rp_uuid):"},{"line_number":912,"context_line":"        url \u003d \u0027/resource_providers/%s/allocations\u0027 % rp_uuid"},{"line_number":913,"context_line":"        resp \u003d self.get(url)"},{"line_number":914,"context_line":"        if not resp:"}],"source_content_type":"text/x-python","patch_set":7,"id":"ff0f0b1f_062137b5","line":911,"updated":"2017-05-17 18:06:27.000000000","message":"If we\u0027re making this public anyway, it might make sense to rename it in the process so that it is clear it is allocations by resource provider.","commit_id":"d00b86908f909437df94d53cf06a04a420b82727"},{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b56910a40c0cdfbc0f4b1297c227735412cf501d","unresolved":false,"context_lines":[{"line_number":937,"context_line":"            instances \u003d objects.InstanceList.get_by_host_and_node(context,"},{"line_number":938,"context_line":"                    host, nodename)"},{"line_number":939,"context_line":"            for instance in instances:"},{"line_number":940,"context_line":"                self.delete_allocation_for_instance(instance.uuid)"},{"line_number":941,"context_line":"        url \u003d \"/resource_providers/%s\" % rp_uuid"},{"line_number":942,"context_line":"        resp \u003d self.delete(url)"},{"line_number":943,"context_line":"        if resp:"}],"source_content_type":"text/x-python","patch_set":9,"id":"ff0f0b1f_c4af427b","line":940,"updated":"2017-05-22 14:22:58.000000000","message":"++ all good changes here.","commit_id":"e9215ed8960cdcd902f73a96bda30eb43c0443b8"}],"nova/tests/unit/compute/test_resource_tracker.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"b56910a40c0cdfbc0f4b1297c227735412cf501d","unresolved":false,"context_lines":[{"line_number":2292,"context_line":"            ret \u003d _INSTANCE_FIXTURES[0].obj_clone()"},{"line_number":2293,"context_line":"            ret.uuid \u003d inst_uuid"},{"line_number":2294,"context_line":"            if inst_uuid \u003d\u003d uuids.scheduled:"},{"line_number":2295,"context_line":"                ret.host \u003d \"\""},{"line_number":2296,"context_line":"            return ret"},{"line_number":2297,"context_line":""},{"line_number":2298,"context_line":"        mock_inst_get.side_effect \u003d get_by_uuid"}],"source_content_type":"text/x-python","patch_set":9,"id":"ff0f0b1f_84402aa7","line":2295,"updated":"2017-05-22 14:22:58.000000000","message":"maybe set host to None instead of \"\"?","commit_id":"e9215ed8960cdcd902f73a96bda30eb43c0443b8"}]}
