Make association_refresh configurable
The provider-tree refresh in the SchedulerReportClient() instance of each compute node happens every five minutes as it is hard coded. This patch adds this update interval as a new config option which can be set/changed on each compute node. Change-Id: I00f92aac44d7b0169f94940ef389796c782b0cc1 Closes-Bug: #1767309
This commit is contained in:
parent
c15a0139af
commit
41d6b479fe
@ -640,6 +640,21 @@ Possible values:
|
||||
Related options:
|
||||
|
||||
* ``shutdown_timeout``
|
||||
"""),
|
||||
cfg.IntOpt('resource_provider_association_refresh',
|
||||
default=300,
|
||||
min=1,
|
||||
help="""
|
||||
Interval for updating nova-compute-side cache of the compute node resource
|
||||
provider's aggregates and traits info.
|
||||
|
||||
This option specifies the number of seconds between attempts to update a
|
||||
provider's aggregates and traits information in the local cache of the compute
|
||||
node.
|
||||
|
||||
Possible values:
|
||||
|
||||
* Any positive integer in seconds.
|
||||
""")
|
||||
]
|
||||
|
||||
|
@ -45,9 +45,6 @@ _RE_INV_IN_USE = re.compile("Inventory for (.+) on resource provider "
|
||||
"(.+) in use")
|
||||
WARN_EVERY = 10
|
||||
PLACEMENT_CLIENT_SEMAPHORE = 'placement_client'
|
||||
# Number of seconds between attempts to update a provider's aggregates and
|
||||
# traits
|
||||
ASSOCIATION_REFRESH = 300
|
||||
POST_RPS_RETURNS_PAYLOAD_API_VERSION = '1.20'
|
||||
NESTED_PROVIDER_API_VERSION = '1.14'
|
||||
POST_ALLOCATIONS_API_VERSION = '1.13'
|
||||
@ -778,8 +775,8 @@ class SchedulerReportClient(object):
|
||||
sharing providers for the specified resource provider uuid.
|
||||
|
||||
Only refresh if there has been no refresh during the lifetime of
|
||||
this process, ASSOCIATION_REFRESH seconds have passed, or the force arg
|
||||
has been set to True.
|
||||
this process, CONF.compute.resource_provider_association_refresh
|
||||
seconds have passed, or the force arg has been set to True.
|
||||
|
||||
Note that we do *not* refresh inventories. The reason is largely
|
||||
historical: all code paths that get us here are doing inventory refresh
|
||||
@ -848,10 +845,12 @@ class SchedulerReportClient(object):
|
||||
"recently".
|
||||
|
||||
Associations are stale if association_refresh_time for this uuid is not
|
||||
set or is more than ASSOCIATION_REFRESH seconds ago.
|
||||
set or is more than CONF.compute.resource_provider_association_refresh
|
||||
seconds ago.
|
||||
"""
|
||||
refresh_time = self._association_refresh_time.get(uuid, 0)
|
||||
return (time.time() - refresh_time) > ASSOCIATION_REFRESH
|
||||
return ((time.time() - refresh_time) >
|
||||
CONF.compute.resource_provider_association_refresh)
|
||||
|
||||
def _update_inventory_attempt(self, context, rp_uuid, inv_data):
|
||||
"""Update the inventory for this resource provider if needed.
|
||||
|
@ -2273,14 +2273,16 @@ class TestAssociations(SchedulerReportClientTestCase):
|
||||
|
||||
with mock.patch('time.time') as mock_future:
|
||||
# Not called a second time because not enough time has passed.
|
||||
mock_future.return_value = now + report.ASSOCIATION_REFRESH / 2
|
||||
mock_future.return_value = (now +
|
||||
CONF.compute.resource_provider_association_refresh / 2)
|
||||
self.client._refresh_associations(self.context, uuid)
|
||||
mock_agg_get.assert_not_called()
|
||||
mock_trait_get.assert_not_called()
|
||||
mock_shr_get.assert_not_called()
|
||||
|
||||
# Called because time has passed.
|
||||
mock_future.return_value = now + report.ASSOCIATION_REFRESH + 1
|
||||
mock_future.return_value = (now +
|
||||
CONF.compute.resource_provider_association_refresh + 1)
|
||||
self.client._refresh_associations(self.context, uuid)
|
||||
mock_agg_get.assert_called_once_with(self.context, uuid)
|
||||
mock_trait_get.assert_called_once_with(self.context, uuid)
|
||||
|
@ -0,0 +1,9 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
The nova-compute service now allows specifying the interval for updating
|
||||
nova-compute-side cache of the compute node resource provider's aggregates
|
||||
and traits info via a new config option called
|
||||
``[compute]/resource_provider_association_refresh`` which defaults to 300.
|
||||
This was previously hard-coded to run every 300 seconds which may be too
|
||||
often in a large deployment.
|
Loading…
x
Reference in New Issue
Block a user