)]}'
{"doc/source/reference/update-provider-tree.rst":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"880362a78f8ca3949ca2a6c344197092ce3b2383","unresolved":false,"context_lines":[{"line_number":25,"context_line":"the virt driver method ``get_available_resource`` was initially superseded by"},{"line_number":26,"context_line":"``get_inventory`` (now gone), whereby the driver could specify its inventory in"},{"line_number":27,"context_line":"terms understood by placement. In Queens, a ``get_traits`` driver method was"},{"line_number":28,"context_line":"added. But ``get_inventory`` is limited to expressing only inventory (not"},{"line_number":29,"context_line":"traits or aggregates). And both of these methods are limited to the resource"},{"line_number":30,"context_line":"provider corresponding to the compute node."},{"line_number":31,"context_line":""}],"source_content_type":"text/x-rst","patch_set":2,"id":"3fa7e38b_e2294637","line":28,"range":{"start_line":28,"start_character":29,"end_line":28,"end_character":31},"updated":"2019-11-07 23:39:18.000000000","message":"was","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d6c3e04cc26d790724481d14231bc13ef2b80492","unresolved":false,"context_lines":[{"line_number":25,"context_line":"the virt driver method ``get_available_resource`` was initially superseded by"},{"line_number":26,"context_line":"``get_inventory`` (now gone), whereby the driver could specify its inventory in"},{"line_number":27,"context_line":"terms understood by placement. In Queens, a ``get_traits`` driver method was"},{"line_number":28,"context_line":"added. But ``get_inventory`` is limited to expressing only inventory (not"},{"line_number":29,"context_line":"traits or aggregates). And both of these methods are limited to the resource"},{"line_number":30,"context_line":"provider corresponding to the compute node."},{"line_number":31,"context_line":""}],"source_content_type":"text/x-rst","patch_set":2,"id":"3fa7e38b_341b11cb","line":28,"range":{"start_line":28,"start_character":29,"end_line":28,"end_character":31},"in_reply_to":"3fa7e38b_e2294637","updated":"2019-11-08 16:14:56.000000000","message":"Done","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"880362a78f8ca3949ca2a6c344197092ce3b2383","unresolved":false,"context_lines":[{"line_number":26,"context_line":"``get_inventory`` (now gone), whereby the driver could specify its inventory in"},{"line_number":27,"context_line":"terms understood by placement. In Queens, a ``get_traits`` driver method was"},{"line_number":28,"context_line":"added. But ``get_inventory`` is limited to expressing only inventory (not"},{"line_number":29,"context_line":"traits or aggregates). And both of these methods are limited to the resource"},{"line_number":30,"context_line":"provider corresponding to the compute node."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Developments such as Nested Resource Providers necessitate the ability"}],"source_content_type":"text/x-rst","patch_set":2,"id":"3fa7e38b_821e520b","line":29,"range":{"start_line":29,"start_character":49,"end_line":29,"end_character":52},"updated":"2019-11-07 23:39:18.000000000","message":"were","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d6c3e04cc26d790724481d14231bc13ef2b80492","unresolved":false,"context_lines":[{"line_number":26,"context_line":"``get_inventory`` (now gone), whereby the driver could specify its inventory in"},{"line_number":27,"context_line":"terms understood by placement. In Queens, a ``get_traits`` driver method was"},{"line_number":28,"context_line":"added. But ``get_inventory`` is limited to expressing only inventory (not"},{"line_number":29,"context_line":"traits or aggregates). And both of these methods are limited to the resource"},{"line_number":30,"context_line":"provider corresponding to the compute node."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Developments such as Nested Resource Providers necessitate the ability"}],"source_content_type":"text/x-rst","patch_set":2,"id":"3fa7e38b_d475dd01","line":29,"range":{"start_line":29,"start_character":49,"end_line":29,"end_character":52},"in_reply_to":"3fa7e38b_821e520b","updated":"2019-11-08 16:14:56.000000000","message":"Done","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"}],"nova/compute/resource_tracker.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"880362a78f8ca3949ca2a6c344197092ce3b2383","unresolved":false,"context_lines":[{"line_number":1136,"context_line":"        \"\"\"Send resource and inventory changes to placement.\"\"\""},{"line_number":1137,"context_line":"        # NOTE(jianghuaw): Some resources(e.g. VGPU) are not saved in the"},{"line_number":1138,"context_line":"        # object of compute_node; instead the inventory data for these"},{"line_number":1139,"context_line":"        # resource is reported by driver\u0027s get_inventory(). So even there"},{"line_number":1140,"context_line":"        # is no resource change for compute_node as above, we need proceed"},{"line_number":1141,"context_line":"        # to get inventory and use report client interfaces to update"},{"line_number":1142,"context_line":"        # inventory to placement. It\u0027s report client\u0027s responsibility to"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_22d51e1c","line":1139,"range":{"start_line":1139,"start_character":43,"end_line":1139,"end_character":56},"updated":"2019-11-07 23:39:18.000000000","message":"update_provider_tree","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d6c3e04cc26d790724481d14231bc13ef2b80492","unresolved":false,"context_lines":[{"line_number":1136,"context_line":"        \"\"\"Send resource and inventory changes to placement.\"\"\""},{"line_number":1137,"context_line":"        # NOTE(jianghuaw): Some resources(e.g. VGPU) are not saved in the"},{"line_number":1138,"context_line":"        # object of compute_node; instead the inventory data for these"},{"line_number":1139,"context_line":"        # resource is reported by driver\u0027s get_inventory(). So even there"},{"line_number":1140,"context_line":"        # is no resource change for compute_node as above, we need proceed"},{"line_number":1141,"context_line":"        # to get inventory and use report client interfaces to update"},{"line_number":1142,"context_line":"        # inventory to placement. It\u0027s report client\u0027s responsibility to"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_5469ed23","line":1139,"range":{"start_line":1139,"start_character":43,"end_line":1139,"end_character":56},"in_reply_to":"3fa7e38b_22d51e1c","updated":"2019-11-08 16:14:56.000000000","message":"Done","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d6c3e04cc26d790724481d14231bc13ef2b80492","unresolved":false,"context_lines":[{"line_number":1137,"context_line":"        # NOTE(jianghuaw): Some resources(e.g. VGPU) are not saved in the"},{"line_number":1138,"context_line":"        # object of compute_node; instead the inventory data for these"},{"line_number":1139,"context_line":"        # resource is reported by driver\u0027s get_inventory(). So even there"},{"line_number":1140,"context_line":"        # is no resource change for compute_node as above, we need proceed"},{"line_number":1141,"context_line":"        # to get inventory and use report client interfaces to update"},{"line_number":1142,"context_line":"        # inventory to placement. It\u0027s report client\u0027s responsibility to"},{"line_number":1143,"context_line":"        # ensure the update request to placement only happens when inventory"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_9458c58a","line":1140,"range":{"start_line":1140,"start_character":33,"end_line":1140,"end_character":57},"updated":"2019-11-08 16:14:56.000000000","message":"This is also stale from a refactor where this comment was moving from _update() into this method. I\u0027ll fix in a FUP as well.","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c12efaa1d0b98d11fe9aac980f5fc76a49f71260","unresolved":false,"context_lines":[{"line_number":1144,"context_line":"        # is changed."},{"line_number":1145,"context_line":"        nodename \u003d compute_node.hypervisor_hostname"},{"line_number":1146,"context_line":"        # Persist the stats to the Scheduler"},{"line_number":1147,"context_line":"        # First try update_provider_tree"},{"line_number":1148,"context_line":"        # Retrieve the provider tree associated with this compute node.  If"},{"line_number":1149,"context_line":"        # it doesn\u0027t exist yet, this will create it with a (single, root)"},{"line_number":1150,"context_line":"        # provider corresponding to the compute node."}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_3416b14b","line":1147,"range":{"start_line":1147,"start_character":10,"end_line":1147,"end_character":40},"updated":"2019-11-08 15:41:37.000000000","message":"could stand to drop this as well","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d6c3e04cc26d790724481d14231bc13ef2b80492","unresolved":false,"context_lines":[{"line_number":1144,"context_line":"        # is changed."},{"line_number":1145,"context_line":"        nodename \u003d compute_node.hypervisor_hostname"},{"line_number":1146,"context_line":"        # Persist the stats to the Scheduler"},{"line_number":1147,"context_line":"        # First try update_provider_tree"},{"line_number":1148,"context_line":"        # Retrieve the provider tree associated with this compute node.  If"},{"line_number":1149,"context_line":"        # it doesn\u0027t exist yet, this will create it with a (single, root)"},{"line_number":1150,"context_line":"        # provider corresponding to the compute node."}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_54524d6a","line":1147,"range":{"start_line":1147,"start_character":10,"end_line":1147,"end_character":40},"in_reply_to":"3fa7e38b_3416b14b","updated":"2019-11-08 16:14:56.000000000","message":"Done","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"880362a78f8ca3949ca2a6c344197092ce3b2383","unresolved":false,"context_lines":[{"line_number":1201,"context_line":"        nodename \u003d compute_node.hypervisor_hostname"},{"line_number":1202,"context_line":"        old_compute \u003d self.old_resources[nodename]"},{"line_number":1203,"context_line":"        if self._resource_change(compute_node):"},{"line_number":1204,"context_line":"            # If the compute_node\u0027s resource changed, update to DB."},{"line_number":1205,"context_line":"            # NOTE(jianghuaw): Once we completely move to use get_inventory()"},{"line_number":1206,"context_line":"            # for all resource provider\u0027s inv data. We can remove this check."},{"line_number":1207,"context_line":"            # At the moment we still need this check and save compute_node."},{"line_number":1208,"context_line":"            try:"},{"line_number":1209,"context_line":"                compute_node.save()"},{"line_number":1210,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_e2de263d","line":1207,"range":{"start_line":1204,"start_character":0,"end_line":1207,"end_character":75},"updated":"2019-11-07 23:39:18.000000000","message":"?","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"c12efaa1d0b98d11fe9aac980f5fc76a49f71260","unresolved":false,"context_lines":[{"line_number":1204,"context_line":"            # If the compute_node\u0027s resource changed, update to DB."},{"line_number":1205,"context_line":"            # NOTE(jianghuaw): Once we completely move to use get_inventory()"},{"line_number":1206,"context_line":"            # for all resource provider\u0027s inv data. We can remove this check."},{"line_number":1207,"context_line":"            # At the moment we still need this check and save compute_node."},{"line_number":1208,"context_line":"            try:"},{"line_number":1209,"context_line":"                compute_node.save()"},{"line_number":1210,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_f4d3395e","line":1207,"in_reply_to":"3fa7e38b_8f243a62","updated":"2019-11-08 15:41:37.000000000","message":"OK so the comment was added in this change:\n\nhttps://review.opendev.org/#/c/518294/\n\nBack in Queens when the xenapi driver was implementing support for VGPUs and the driver didn\u0027t implement update_provider_tree (that was added here Ie7bc0b3d3c3d5b1cdea124f6415aa0e87ac8b757 in Train) but did implement get_inventory:\n\nhttps://github.com/openstack/nova/blob/e2a18a37190e4c7b7697a8811553d331e208182c/nova/virt/xenapi/driver.py#L407\n\nNote that the xenapi driver didn\u0027t yet report VGPU inventory yet.\n\nSo looking at that change:\n\nhttps://review.opendev.org/#/c/518294/2/nova/compute/resource_tracker.py\n\nThe point was that the code before would short-circuit if fields on the compute node didn\u0027t change:\n\nhttps://review.opendev.org/#/c/518294/2/nova/compute/resource_tracker.py@a808\n\nWhich meant we couldn\u0027t call the driver\u0027s get_inventory method and update placement, which would be wrong if the driver\u0027s VGPU inventory changed (which isn\u0027t tracked on the ComputeNode object).\n\nI guess the NOTE was added based on this comment:\n\nhttps://review.opendev.org/#/c/518294/1/nova/compute/resource_tracker.py@795\n\nSaying effectively if the provider tree says inventory has changed (for the most part that\u0027s just going to be VCPU/MEMORY_MB/DISK_GB, sometimes VGPU, sometimes PCPU), then save the compute node rather than rely on the _resource_change method. However, I think there are at least two issues with doing that:\n\n1. This code is removed from _update_to_placement how where we get the provider tree with updating inventory, so we\u0027d have to shuffle where the compute node save happens which is likely gross(ish).\n\n2. The bigger issue is doing that assumes nothing else in the ComputeNode fields matters besides the stuff reported in the provider tree, and that\u0027s not going to be true since the compute node has fields like current_workload, running_vms, disk_available_least, metrics, stats, etc - all crap that gets populated during this resource tracking audit and reported to the scheduler (and it\u0027s filters/weighers, which might be out of tree) via the ComputeNode record.\n\nSo I think we\u0027re safe to just remove this NOTE since it\u0027s bogus like I suspected.","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d6c3e04cc26d790724481d14231bc13ef2b80492","unresolved":false,"context_lines":[{"line_number":1204,"context_line":"            # If the compute_node\u0027s resource changed, update to DB."},{"line_number":1205,"context_line":"            # NOTE(jianghuaw): Once we completely move to use get_inventory()"},{"line_number":1206,"context_line":"            # for all resource provider\u0027s inv data. We can remove this check."},{"line_number":1207,"context_line":"            # At the moment we still need this check and save compute_node."},{"line_number":1208,"context_line":"            try:"},{"line_number":1209,"context_line":"                compute_node.save()"},{"line_number":1210,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_144cd5c6","line":1207,"in_reply_to":"3fa7e38b_94e3e5d8","updated":"2019-11-08 16:14:56.000000000","message":"Done - instead of just removing this I\u0027ll also replace it with a comment explaining why we need to do this regardless of the provider tree stuff so someone isn\u0027t confused in the future.","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"199e5decb73297365d77a87f51c0da95933786df","unresolved":false,"context_lines":[{"line_number":1204,"context_line":"            # If the compute_node\u0027s resource changed, update to DB."},{"line_number":1205,"context_line":"            # NOTE(jianghuaw): Once we completely move to use get_inventory()"},{"line_number":1206,"context_line":"            # for all resource provider\u0027s inv data. We can remove this check."},{"line_number":1207,"context_line":"            # At the moment we still need this check and save compute_node."},{"line_number":1208,"context_line":"            try:"},{"line_number":1209,"context_line":"                compute_node.save()"},{"line_number":1210,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_8f243a62","line":1207,"in_reply_to":"3fa7e38b_e2de263d","updated":"2019-11-08 03:22:54.000000000","message":"I think that comment might be bogus but I\u0027ll have to dig into the context of it. It\u0027s not the first time I\u0027ve seen it and it\u0027s puzzled me.","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"5b6d965984ab475b350fb6cf4b85162387f38f15","unresolved":false,"context_lines":[{"line_number":1204,"context_line":"            # If the compute_node\u0027s resource changed, update to DB."},{"line_number":1205,"context_line":"            # NOTE(jianghuaw): Once we completely move to use get_inventory()"},{"line_number":1206,"context_line":"            # for all resource provider\u0027s inv data. We can remove this check."},{"line_number":1207,"context_line":"            # At the moment we still need this check and save compute_node."},{"line_number":1208,"context_line":"            try:"},{"line_number":1209,"context_line":"                compute_node.save()"},{"line_number":1210,"context_line":"            except Exception:"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_94e3e5d8","line":1207,"in_reply_to":"3fa7e38b_f4d3395e","updated":"2019-11-08 16:03:09.000000000","message":"Thanks for digging into that Matt. I agree with your reasoning.","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"}],"nova/tests/unit/compute/test_resource_tracker.py":[{"author":{"_account_id":14070,"name":"Eric Fried","email":"openstack@fried.cc","username":"efried"},"change_message_id":"880362a78f8ca3949ca2a6c344197092ce3b2383","unresolved":false,"context_lines":[{"line_number":1962,"context_line":""},{"line_number":1963,"context_line":"    def test_normalize_ironic(self):"},{"line_number":1964,"context_line":"        \"\"\"Test that when normalizing the return from Ironic virt driver\u0027s"},{"line_number":1965,"context_line":"        get_inventory() method, we don\u0027t overwrite the information that the"},{"line_number":1966,"context_line":"        virt driver gave us."},{"line_number":1967,"context_line":"        \"\"\""},{"line_number":1968,"context_line":"        self.flags(reserved_host_disk_mb\u003d100,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_42edbaee","line":1965,"range":{"start_line":1965,"start_character":8,"end_line":1965,"end_character":21},"updated":"2019-11-07 23:39:18.000000000","message":"update_provider_tree","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"},{"author":{"_account_id":6873,"name":"Matt Riedemann","email":"mriedem.os@gmail.com","username":"mriedem"},"change_message_id":"d6c3e04cc26d790724481d14231bc13ef2b80492","unresolved":false,"context_lines":[{"line_number":1962,"context_line":""},{"line_number":1963,"context_line":"    def test_normalize_ironic(self):"},{"line_number":1964,"context_line":"        \"\"\"Test that when normalizing the return from Ironic virt driver\u0027s"},{"line_number":1965,"context_line":"        get_inventory() method, we don\u0027t overwrite the information that the"},{"line_number":1966,"context_line":"        virt driver gave us."},{"line_number":1967,"context_line":"        \"\"\""},{"line_number":1968,"context_line":"        self.flags(reserved_host_disk_mb\u003d100,"}],"source_content_type":"text/x-python","patch_set":2,"id":"3fa7e38b_94e685b0","line":1965,"range":{"start_line":1965,"start_character":8,"end_line":1965,"end_character":21},"in_reply_to":"3fa7e38b_42edbaee","updated":"2019-11-08 16:14:56.000000000","message":"This gets dropped in https://review.opendev.org/#/c/693436/.","commit_id":"c80912866f080c2049fb3860221f55e3c73cbf5e"}]}
