)]}'
{"nova/compute/resource_tracker.py":[{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"dbddd4cc820033428148cb0d514b69428e57e2da","unresolved":false,"context_lines":[{"line_number":792,"context_line":"                  \u0027used_vcpus\u0027: ucpu,"},{"line_number":793,"context_line":"                  \u0027pci_stats\u0027: pci_stats})"},{"line_number":794,"context_line":""},{"line_number":795,"context_line":"    def _resource_change(self, compute_node):"},{"line_number":796,"context_line":"        \"\"\"Check to see if any resources have changed.\"\"\""},{"line_number":797,"context_line":"        nodename \u003d compute_node.hypervisor_hostname"},{"line_number":798,"context_line":"        old_compute \u003d self.old_resources[nodename]"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f4b6375_edaaa4cf","line":795,"updated":"2017-11-08 03:40:29.000000000","message":"Thinking the comment from Eric. I agree with him that the current solution is somehow backward.\n\nNow we catch inventory in provider tree\nhttps://github.com/openstack/nova/blob/master/nova/compute/provider_tree.py#L78\nSo I think we can totally remove this function and self.old_reousrces. The checking on if resource changed can be deferred to has_inventory_changed. Then we can get a more reasonable solution to handle this situation.\n\n@Jay and @Sylvain: what\u0027s your opinion? Thanks.","commit_id":"6eeda9ada479afa8ec2986fa34241c99ba84dc0c"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"ac239cc6f99bddc7920b4493573f725a094cb68e","unresolved":false,"context_lines":[{"line_number":832,"context_line":"            # format that the placement API expects and we\u0027ll be able to remove"},{"line_number":833,"context_line":"            # this code branch"},{"line_number":834,"context_line":"            # Skip update if compute node is not changed."},{"line_number":835,"context_line":"            if not is_changed:"},{"line_number":836,"context_line":"                return"},{"line_number":837,"context_line":"            self.scheduler_client.update_compute_node(compute_node)"},{"line_number":838,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"3f4b6375_d28f83ca","line":835,"updated":"2017-11-08 03:05:11.000000000","message":"An other option I thought is to remove the is_changed flag. So it always  invoke scheduler_client regardless get_inventory implemented or not. In that way, it will make the code looks clean. Both paths will do similar things - converting resource stats to inventory. The only difference is that get_inventory will convert data from driver\u0027s local cached resource stats; but update_compute_node() convert data from compute_node.\n\nI just thought if we should stop earlier for NotImplemented path, as we know the inventory surely won\u0027t change if compute_node doesn\u0027t change in this case.","commit_id":"6eeda9ada479afa8ec2986fa34241c99ba84dc0c"}],"nova/tests/unit/compute/test_resource_tracker.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"b571c47bfc0ab7f56d10911c08bfd7c10ec71b68","unresolved":false,"context_lines":[{"line_number":1121,"context_line":"        self.rt._update(mock.sentinel.ctx, new_compute)"},{"line_number":1122,"context_line":"        self.assertFalse(ucn_mock.called)"},{"line_number":1123,"context_line":"        self.assertFalse(save_mock.called)"},{"line_number":1124,"context_line":"        # Even the compute node is not updated, get_inventory still got called."},{"line_number":1125,"context_line":"        self.driver_mock.get_inventory.assert_called_once_with(_NODENAME)"},{"line_number":1126,"context_line":""},{"line_number":1127,"context_line":"    @mock.patch(\u0027nova.objects.ComputeNode.save\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f4b6375_d6c8a522","line":1124,"updated":"2017-11-07 12:44:36.000000000","message":"Should test the path where get_inventory is called in this scenario, but is NotImplemented: assert that update_compute_node is not called.","commit_id":"6eeda9ada479afa8ec2986fa34241c99ba84dc0c"},{"author":{"_account_id":17920,"name":"Jianghua Wang","email":"jianghua.wang@citrix.com","username":"wjhfresh"},"change_message_id":"3256db43339edb04777c115549ad9fb83fbefda3","unresolved":false,"context_lines":[{"line_number":1121,"context_line":"        self.rt._update(mock.sentinel.ctx, new_compute)"},{"line_number":1122,"context_line":"        self.assertFalse(ucn_mock.called)"},{"line_number":1123,"context_line":"        self.assertFalse(save_mock.called)"},{"line_number":1124,"context_line":"        # Even the compute node is not updated, get_inventory still got called."},{"line_number":1125,"context_line":"        self.driver_mock.get_inventory.assert_called_once_with(_NODENAME)"},{"line_number":1126,"context_line":""},{"line_number":1127,"context_line":"    @mock.patch(\u0027nova.objects.ComputeNode.save\u0027)"}],"source_content_type":"text/x-python","patch_set":1,"id":"3f4b6375_32281731","line":1124,"in_reply_to":"3f4b6375_d6c8a522","updated":"2017-11-08 02:47:27.000000000","message":"Eric, this path is covered by this test. As the mocked driver has get_inventory as NotImplemented.\nSee the assert in line 1122.\n\nBut it may be better to explicitly mention that in the comment?","commit_id":"6eeda9ada479afa8ec2986fa34241c99ba84dc0c"}]}
