)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"7f8370216e1705869a4a55e765a4a1c1297d8b7f","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     aitianxiang \u003caitianxiang@chinatelecom.cn\u003e"},{"line_number":5,"context_line":"CommitDate: 2019-12-25 09:46:04 +0800"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Scheduler a vm to a reporting compute node"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When scheduling a vm to a reporting compute node,"},{"line_number":10,"context_line":"update_available_resource will clear self.stats and update compute_nodes"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3fa7e38b_404f8469","line":7,"range":{"start_line":7,"start_character":0,"end_line":7,"end_character":42},"updated":"2020-01-02 14:35:45.000000000","message":"preserve num_instances during update_available_resource","commit_id":"b6536e616346fbea729084cad951ed64f309f60f"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"7f8370216e1705869a4a55e765a4a1c1297d8b7f","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Scheduler a vm to a reporting compute node"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"When scheduling a vm to a reporting compute node,"},{"line_number":10,"context_line":"update_available_resource will clear self.stats and update compute_nodes"},{"line_number":11,"context_line":"table in db firstly, and update this table after calculating all"},{"line_number":12,"context_line":"instances on this node. At this moment, the scheduler filter will pass"},{"line_number":13,"context_line":"this node because there is no num_instances in compute_nodes.stats."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Change-Id: Iffe8eaf009c62d34bbe703b39c802dce69d74c81"},{"line_number":16,"context_line":"Closes-Bug:#1857448"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"3fa7e38b_a0d99884","line":13,"range":{"start_line":9,"start_character":0,"end_line":13,"end_character":67},"updated":"2020-01-02 14:35:45.000000000","message":"During the execution of the update_available_resource perodic task the num_instances value is reset and saved to the db while the task is running. As a result the NumInstancesFilter can allow hosts to pass that would otherwise be rejected due to the incorrect data. This change preserves the number of instances running on the host while the periodic task completes.","commit_id":"b6536e616346fbea729084cad951ed64f309f60f"}],"nova/compute/resource_tracker.py":[{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"7f8370216e1705869a4a55e765a4a1c1297d8b7f","unresolved":false,"context_lines":[{"line_number":721,"context_line":"            dev_pools_obj \u003d self.pci_tracker.stats.to_device_pools_obj()"},{"line_number":722,"context_line":"            compute_node.pci_device_pools \u003d dev_pools_obj"},{"line_number":723,"context_line":""},{"line_number":724,"context_line":"    def _copy_resources(self, compute_node, resources, initial\u003dFalse):"},{"line_number":725,"context_line":"        \"\"\"Copy resource values to supplied compute_node.\"\"\""},{"line_number":726,"context_line":"        nodename \u003d resources[\u0027hypervisor_hostname\u0027]"},{"line_number":727,"context_line":"        stats \u003d self.stats[nodename]"},{"line_number":728,"context_line":"        # purge old stats and init with anything passed in by the driver"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_606640bf","line":725,"range":{"start_line":724,"start_character":3,"end_line":725,"end_character":60},"updated":"2020-01-02 14:35:45.000000000","message":"this funciton is rather badly named.\n\nfirstly it does not create a copy what it is basically doing is as follows\n\n\u003e\u003e\u003e x \u003d [\"a\", \"b\", \"c\"]\n\u003e\u003e\u003e data \u003d {0 : x}\n\u003e\u003e\u003e y \u003d data[0]\n\u003e\u003e\u003e y[1] \u003d \u0027d\u0027\n\u003e\u003e\u003e x\n[\u0027a\u0027, \u0027d\u0027, \u0027c\u0027]\n\n\nself.stats is a dictionary of dictionaries.\n\nso  stats \u003d self.stats[nodename] creates a refernce to the sub dictionary in self.stats not a copy.\n\nso when we do stats.clear() it clears the ditonary at\nself.stats[nodename] as well since stats it a referece to it not a copy.\n\nthe i proceeds to update the states later in this function\nso at no point is a copy created.\n\nthis should be renamed to _update_resouces or something similar.","commit_id":"b6536e616346fbea729084cad951ed64f309f60f"},{"author":{"_account_id":31454,"name":"tianxiang ai","email":"aitianxiang@chinatelecom.cn","username":"aitianxiang"},"change_message_id":"372ff8c73a7437ad5a99f992f6c5ce525313ac1f","unresolved":false,"context_lines":[{"line_number":721,"context_line":"            dev_pools_obj \u003d self.pci_tracker.stats.to_device_pools_obj()"},{"line_number":722,"context_line":"            compute_node.pci_device_pools \u003d dev_pools_obj"},{"line_number":723,"context_line":""},{"line_number":724,"context_line":"    def _copy_resources(self, compute_node, resources, initial\u003dFalse):"},{"line_number":725,"context_line":"        \"\"\"Copy resource values to supplied compute_node.\"\"\""},{"line_number":726,"context_line":"        nodename \u003d resources[\u0027hypervisor_hostname\u0027]"},{"line_number":727,"context_line":"        stats \u003d self.stats[nodename]"},{"line_number":728,"context_line":"        # purge old stats and init with anything passed in by the driver"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_0150ab08","line":725,"range":{"start_line":724,"start_character":3,"end_line":725,"end_character":60},"in_reply_to":"3fa7e38b_606640bf","updated":"2020-01-03 01:05:54.000000000","message":"Yes,stats \u003d self.stats[nodename] in this branch is not a copy,but i found that it is a deepcopy in Queens.\nThe code is:\ncompute_node.stats \u003d copy.deepcopy(self.stats)\nMaybe someone update the code but deesn\u0027t update the name of this function.","commit_id":"b6536e616346fbea729084cad951ed64f309f60f"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"7f8370216e1705869a4a55e765a4a1c1297d8b7f","unresolved":false,"context_lines":[{"line_number":1442,"context_line":"        cn.free_disk_gb \u003d (cn.local_gb - cn.local_gb_used)"},{"line_number":1443,"context_line":"        cn.current_workload \u003d 0"},{"line_number":1444,"context_line":"        cn.running_vms \u003d 0"},{"line_number":1445,"context_line":"        stats \u003d self.stats[nodename]"},{"line_number":1446,"context_line":"        stats[\u0027num_instances\u0027] \u003d 0"},{"line_number":1447,"context_line":""},{"line_number":1448,"context_line":"        instance_by_uuid \u003d {}"},{"line_number":1449,"context_line":"        for instance in instances:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_a0f518ce","line":1446,"range":{"start_line":1445,"start_character":5,"end_line":1446,"end_character":34},"updated":"2020-01-02 14:35:45.000000000","message":"as noted above this is the same as doing \n\nself.stats[nodename][\u0027num_instances\u0027] \u003d 0\nin that stats is not not a copy its a reference to the dictionary at self.stats[nodename]","commit_id":"b6536e616346fbea729084cad951ed64f309f60f"},{"author":{"_account_id":31454,"name":"tianxiang ai","email":"aitianxiang@chinatelecom.cn","username":"aitianxiang"},"change_message_id":"372ff8c73a7437ad5a99f992f6c5ce525313ac1f","unresolved":false,"context_lines":[{"line_number":1442,"context_line":"        cn.free_disk_gb \u003d (cn.local_gb - cn.local_gb_used)"},{"line_number":1443,"context_line":"        cn.current_workload \u003d 0"},{"line_number":1444,"context_line":"        cn.running_vms \u003d 0"},{"line_number":1445,"context_line":"        stats \u003d self.stats[nodename]"},{"line_number":1446,"context_line":"        stats[\u0027num_instances\u0027] \u003d 0"},{"line_number":1447,"context_line":""},{"line_number":1448,"context_line":"        instance_by_uuid \u003d {}"},{"line_number":1449,"context_line":"        for instance in instances:"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_81157b40","line":1446,"range":{"start_line":1445,"start_character":5,"end_line":1446,"end_character":34},"in_reply_to":"3fa7e38b_a0f518ce","updated":"2020-01-03 01:05:54.000000000","message":"Yes,you are right.I will fix it.","commit_id":"b6536e616346fbea729084cad951ed64f309f60f"},{"author":{"_account_id":21813,"name":"Andrey Volkov","email":"m@amadev.ru","username":"avolkov"},"change_message_id":"a4272834736b8175192bcc828de9cd220e59c560","unresolved":false,"context_lines":[{"line_number":866,"context_line":""},{"line_number":867,"context_line":"        # initialize the compute node object, creating it"},{"line_number":868,"context_line":"        # if it does not already exist."},{"line_number":869,"context_line":"        is_new_compute_node \u003d self._init_compute_node(context, resources)"},{"line_number":870,"context_line":""},{"line_number":871,"context_line":"        nodename \u003d resources[\u0027hypervisor_hostname\u0027]"},{"line_number":872,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_1abf7060","line":869,"range":{"start_line":869,"start_character":8,"end_line":869,"end_character":73},"updated":"2020-01-09 07:44:53.000000000","message":"Stats.num_instances is reset here via _copy_resources.","commit_id":"8f4ec1dc74458687f5f1cb94961a851dcb419217"},{"author":{"_account_id":21813,"name":"Andrey Volkov","email":"m@amadev.ru","username":"avolkov"},"change_message_id":"a4272834736b8175192bcc828de9cd220e59c560","unresolved":false,"context_lines":[{"line_number":884,"context_line":"                            \u0027resources\u0027])"},{"line_number":885,"context_line":""},{"line_number":886,"context_line":"        # Now calculate usage based on instance utilization:"},{"line_number":887,"context_line":"        instance_by_uuid \u003d self._update_usage_from_instances("},{"line_number":888,"context_line":"            context, instances, nodename)"},{"line_number":889,"context_line":""},{"line_number":890,"context_line":"        # Grab all in-progress migrations:"},{"line_number":891,"context_line":"        migrations \u003d objects.MigrationList.get_in_progress_by_host_and_node("}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_dab47883","line":888,"range":{"start_line":887,"start_character":2,"end_line":888,"end_character":41},"updated":"2020-01-09 07:44:53.000000000","message":"And recalculated here via Stats.update_stats_for_instance","commit_id":"8f4ec1dc74458687f5f1cb94961a851dcb419217"},{"author":{"_account_id":21813,"name":"Andrey Volkov","email":"m@amadev.ru","username":"avolkov"},"change_message_id":"a4272834736b8175192bcc828de9cd220e59c560","unresolved":false,"context_lines":[{"line_number":928,"context_line":"        self._populate_assigned_resources(context, instance_by_uuid)"},{"line_number":929,"context_line":""},{"line_number":930,"context_line":"        # update the compute_node"},{"line_number":931,"context_line":"        self._update(context, cn, startup\u003dstartup)"},{"line_number":932,"context_line":"        LOG.debug(\u0027Compute_service record updated for %(host)s:%(node)s\u0027,"},{"line_number":933,"context_line":"                  {\u0027host\u0027: self.host, \u0027node\u0027: nodename})"},{"line_number":934,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_fa60540f","line":931,"range":{"start_line":931,"start_character":1,"end_line":931,"end_character":50},"updated":"2020-01-09 07:44:53.000000000","message":"And finally saved to DB here.","commit_id":"8f4ec1dc74458687f5f1cb94961a851dcb419217"},{"author":{"_account_id":21813,"name":"Andrey Volkov","email":"m@amadev.ru","username":"avolkov"},"change_message_id":"a4272834736b8175192bcc828de9cd220e59c560","unresolved":false,"context_lines":[{"line_number":1442,"context_line":"        cn.free_disk_gb \u003d (cn.local_gb - cn.local_gb_used)"},{"line_number":1443,"context_line":"        cn.current_workload \u003d 0"},{"line_number":1444,"context_line":"        cn.running_vms \u003d 0"},{"line_number":1445,"context_line":"        self.stats[nodename][\u0027num_instances\u0027] \u003d 0"},{"line_number":1446,"context_line":""},{"line_number":1447,"context_line":"        instance_by_uuid \u003d {}"},{"line_number":1448,"context_line":"        for instance in instances:"}],"source_content_type":"text/x-python","patch_set":3,"id":"3fa7e38b_7a86a4bc","line":1445,"updated":"2020-01-09 07:44:53.000000000","message":"Not sure if it\u0027s needed at all. Stats.num_instances already returns 0 if no instances","commit_id":"8f4ec1dc74458687f5f1cb94961a851dcb419217"}]}
