Reviewed: https://review.openstack.org/613126 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=ca279c68a54b054cb54d45ee9d2eed8ade9a6db5 Submitter: Zuul Branch: master
commit ca279c68a54b054cb54d45ee9d2eed8ade9a6db5 Author: Matt Riedemann <[email protected]> Date: Wed Oct 24 13:48:06 2018 -0400 Provide allocation_ratio/reserved amounts from update_provider_tree() The purpose of the RT._normalize_inventory_from_cn_obj method is to set allocation_ratio and reserved amounts on standard resource class inventory records that get sent to placement if the virt driver did not specifically set a ratio or reserved value (which none but the ironic driver do). If the allocation_ratio or reserved amount is in the inventory data dict from the virt driver, then the normalize method ignores it and lets the virt driver take priority. However, with change I6a706ec5966cdc85f97223617662fe15d3e6dc08, any virt driver that implements the update_provider_tree() interface is storing the inventory data on the ProviderTree object which gets cached and re-used, meaning once allocation_ratio/reserved is set from RT._normalize_inventory_from_cn_obj, it doesn't get unset and the normalize method always assumes the driver provided a value which should not be changed, even if the configuration value changes. We can make the config option changes take effect by changing the semantics between _normalize_inventory_from_cn_obj and drivers that implement the update_provider_tree interface, like for the libvirt driver. Effectively with this change, when a driver implements update_provider_tree(), they now control setting the allocation_ratio and reserved resource amounts for inventory they report. The libvirt driver will use the same configuration option values that _normalize_inventory_from_cn_obj used. The only difference is in update_provider_tree we don't have the ComputeNode facade to get the "real" default values when the allocation_ratio is 0.0, so we handle that like "CONF.cpu_allocation_ratio or 16.0". Eventually that will get cleaned up with blueprint initial-allocation-ratios. Change-Id: I72c83a95dabd581998470edb9543079acb6536a5 Closes-Bug: #1799727 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1799727 Title: CPU_Allocation_Ratio from nova.conf doesn't update exisiting providers Status in OpenStack Compute (nova): Fix Released Status in OpenStack Compute (nova) rocky series: In Progress Bug description: (OpenStack 14) After changing the value of cpu_allocation_ratio in nova.conf from 16 to 1 and restarting nova containers, the ProviderTree still uses the old value (A patch with extra debugging is applied to the system for ProviderTree information: https://review.openstack.org/#/c/597560/ ) Nova.conf setting: cpu_allocation_ratio=1 [root@compute-0 ~]# docker restart nova_compute nova_libvirt nova_compute nova_libvirt Inside Nova-compute.log 2018-10-23 19:19:49.217 1 DEBUG oslo_service.service [req- 9539f623-b342-4c5d-ab93-6ffacdbd8358 - - - - -] cpu_allocation_ratio = 1.0 log_opt_values /usr/lib/python2.7/site- packages/oslo_config/cfg.py:3023 2018-10-23 19:19:51.990 1 DEBUG nova.scheduler.client.report [req-9490c7f4-2157-44ef-a81c-ea3e6bf9be21 - - - - -] Updating ProviderTree inventory for provider ca60934d-074d-4628-ae61-3c3bbc9e5543 from _refresh_and_get_inventory using data: {u'VCPU': {u'allocation_ratio': 16.0, u'total': 6, u'reserved': 0, u'step_size': 1, u'min_unit': 1, u'max_unit': 6}, u'MEMORY_MB': {u'allocation_ratio': 1.0, u'total': 6143, u'reserved': 4096, u'step_size': 1, u'min_unit': 1, u'max_unit': 6143}, u'DISK_GB': {u'allocation_ratio': 1.0, u'total': 19, u'reserved': 0, u'step_size': 1, u'min_unit': 1, u'max_unit': 19}} _refresh_and_get_inventory /usr/lib/python2.7/site-packages/nova/scheduler/client/report.py:754 2018-10-23 19:19:51.990 1 DEBUG nova.compute.provider_tree [req-9490c7f4-2157-44ef-a81c-ea3e6bf9be21 - - - - -] Updating inventory in ProviderTree for provider ca60934d-074d-4628-ae61-3c3bbc9e5543 with inventory: {u'VCPU': {u'allocation_ratio': 16.0, u'total': 6, u'reserved': 0, u'step_size': 1, u'min_unit': 1, u'max_unit': 6}, u'MEMORY_MB': {u'allocation_ratio': 1.0, u'total': 6143, u'reserved': 4096, u'step_size': 1, u'min_unit': 1, u'max_unit': 6143}, u'DISK_GB': {u'allocation_ratio': 1.0, u'total': 19, u'reserved': 0, u'step_size': 1, u'min_unit': 1, u'max_unit': 19}} update_inventory /usr/lib/python2.7/site-packages/nova/compute/provider_tree.py:172 To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1799727/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

