)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"11a9e41b6e796dc7d8f39a7a77e2228e1d333cfb","unresolved":false,"context_lines":[{"line_number":7,"context_line":"Add virt resource update to ComputeNode object"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"The virt driver method get_available_resources() returns a dict"},{"line_number":10,"context_line":"to the resource tracker. The fields of will be copied into a"},{"line_number":11,"context_line":"ComputeNode object as an update. The copy is not exact as some"},{"line_number":12,"context_line":"fields may be missing and some are named differently."},{"line_number":13,"context_line":""}],"source_content_type":"text/x-gerrit-commit-message","patch_set":2,"id":"fa32b979_fd2a002c","line":10,"updated":"2015-06-13 14:43:33.000000000","message":"s/of will/will/","commit_id":"ad7a3e00c1d9ac4b358fb27490b1408da2528633"}],"nova/objects/compute_node.py":[{"author":{"_account_id":7,"name":"Jay Pipes","email":"jaypipes@gmail.com","username":"jaypipes"},"change_message_id":"11a9e41b6e796dc7d8f39a7a77e2228e1d333cfb","unresolved":false,"context_lines":[{"line_number":293,"context_line":"            si \u003d resources[\u0027supported_instances\u0027]"},{"line_number":294,"context_line":"            if isinstance(si, six.string_types):"},{"line_number":295,"context_line":"                si \u003d jsonutils.loads(si)"},{"line_number":296,"context_line":"            self.supported_hv_specs \u003d [objects.HVSpec.from_list(s) for s in si]"},{"line_number":297,"context_line":""},{"line_number":298,"context_line":""},{"line_number":299,"context_line":"@base.NovaObjectRegistry.register"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_5df1accc","line":296,"updated":"2015-06-13 14:43:33.000000000","message":"There are a couple problems with the above code.\n\nThe first problem is that the above will *always* mark the compute node object as being changed, even when nothing has actually changed between the hypervisor\u0027s view of the compute resources and the database\u0027s view of the compute resources. This means that a bunch of unnecessary updates to the database will occur.\n\nThe second problem is that you are mixing resources (quantifiable amounts) and options/configuration (like host_ip, hypervisor_type) in the same method. This is certainly something that the resource-objects blueprint and patch series is aiming to stop doing, and this single method jumbles the qualitative and quantitative things all together...","commit_id":"ad7a3e00c1d9ac4b358fb27490b1408da2528633"},{"author":{"_account_id":7461,"name":"Paul Murray","email":"pmurray@hpe.com","username":"ptm"},"change_message_id":"0692d894fb0d77915371d4fd35c1a867ac322d5b","unresolved":false,"context_lines":[{"line_number":293,"context_line":"            si \u003d resources[\u0027supported_instances\u0027]"},{"line_number":294,"context_line":"            if isinstance(si, six.string_types):"},{"line_number":295,"context_line":"                si \u003d jsonutils.loads(si)"},{"line_number":296,"context_line":"            self.supported_hv_specs \u003d [objects.HVSpec.from_list(s) for s in si]"},{"line_number":297,"context_line":""},{"line_number":298,"context_line":""},{"line_number":299,"context_line":"@base.NovaObjectRegistry.register"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_ed1a356e","line":296,"in_reply_to":"fa32b979_5df1accc","updated":"2015-06-15 08:29:58.000000000","message":"Hi Jay, actually, the object is only saved if the has_changed() method is true, that uses obj_equal_prims() which ignores attributes marked as changed and only deals with the ones that are actually changed since the last save.\n\nThe compute node is updated in lots of places due to calculations going through instances, migrations, orphans, etc. Its only at the end of the update_available_resources() method that we can see if anything did actually change as a net result.\n\nSo I can put in a check to see if the value is the same before updating it, but to be honest, its pointless to fiddle around so much for this.\n\nI\u0027ll see if I can catch you on IRC to discuss this.","commit_id":"ad7a3e00c1d9ac4b358fb27490b1408da2528633"}],"nova/tests/unit/objects/test_compute_node.py":[{"author":{"_account_id":1063,"name":"Ed Leafe","email":"ed@leafe.com","username":"ed-leafe"},"change_message_id":"4d39f8f87003bfa139a969bc0da76528e925fe7c","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        compute \u003d compute_node.ComputeNode()"},{"line_number":476,"context_line":"        compute.update_from_virt_driver(resources)"},{"line_number":477,"context_line":"        expected \u003d fake_compute_with_resources"},{"line_number":478,"context_line":"        del expected.vcpus"},{"line_number":479,"context_line":"        self.assertTrue(base.obj_equal_prims(expected, compute))"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"    def test_update_from_virt_driver_extra_field(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_52d2d201","line":478,"updated":"2015-06-15 13:52:10.000000000","message":"I think that \u0027expected\u0027 should be a copy.deepcopy() before deleting, as you\u0027re modifying the value for the entire script. This would affect results if the tests are run in a random order.","commit_id":"ad7a3e00c1d9ac4b358fb27490b1408da2528633"},{"author":{"_account_id":7461,"name":"Paul Murray","email":"pmurray@hpe.com","username":"ptm"},"change_message_id":"c94d7aa8b1aa0bf69a140b9d147931fad9e71978","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        compute \u003d compute_node.ComputeNode()"},{"line_number":476,"context_line":"        compute.update_from_virt_driver(resources)"},{"line_number":477,"context_line":"        expected \u003d fake_compute_with_resources"},{"line_number":478,"context_line":"        del expected.vcpus"},{"line_number":479,"context_line":"        self.assertTrue(base.obj_equal_prims(expected, compute))"},{"line_number":480,"context_line":""},{"line_number":481,"context_line":"    def test_update_from_virt_driver_extra_field(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"fa32b979_7735a1f5","line":478,"in_reply_to":"fa32b979_52d2d201","updated":"2015-06-19 17:02:38.000000000","message":"Well spotted - Jay pointed out in another patch that I could be using compute.obj_clone() instead of copy.deepcopy(compute). It is actually the same but makes sense, so I will adopt that from here on.","commit_id":"ad7a3e00c1d9ac4b358fb27490b1408da2528633"}]}
