Cells: Make bandwidth_update_interval configurable
Bandwidth updates have been known to cause queues to backup. This configuration provides a way to throttle or disable bandwidth updates as necessary. Fixes bug 1199899 Change-Id: Ic57e6e3915a9b97155b9fd677e1b96e6aaadb17e
This commit is contained in:
committed by
Rick Harris
parent
c6f832073d
commit
e402b88edf
@@ -55,6 +55,9 @@ cells_opts = [
|
||||
help='Number of seconds after which a lack of capability and '
|
||||
'capacity updates signals the child cell is to be '
|
||||
'treated as a mute.'),
|
||||
cfg.IntOpt('bandwidth_update_interval',
|
||||
default=600,
|
||||
help='Seconds between bandwidth updates for cells.'),
|
||||
]
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
@@ -358,6 +358,7 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
self._last_bw_usage_poll = 0
|
||||
self._last_vol_usage_poll = 0
|
||||
self._last_info_cache_heal = 0
|
||||
self._last_bw_usage_cell_update = 0
|
||||
self.compute_api = compute.API()
|
||||
self.compute_rpcapi = compute_rpcapi.ComputeAPI()
|
||||
self.conductor_api = conductor.API()
|
||||
@@ -3867,6 +3868,14 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
CONF.bandwidth_poll_interval):
|
||||
self._last_bw_usage_poll = curr_time
|
||||
LOG.info(_("Updating bandwidth usage cache"))
|
||||
cells_update_interval = CONF.cells.bandwidth_update_interval
|
||||
if (cells_update_interval > 0 and
|
||||
curr_time - self._last_bw_usage_cell_update >
|
||||
cells_update_interval):
|
||||
self._last_bw_usage_cell_update = curr_time
|
||||
update_cells = True
|
||||
else:
|
||||
update_cells = False
|
||||
|
||||
instances = self.conductor_api.instance_get_all_by_host(
|
||||
context, self.host, columns_to_join=[])
|
||||
@@ -3925,7 +3934,8 @@ class ComputeManager(manager.SchedulerDependentManager):
|
||||
bw_out,
|
||||
bw_ctr['bw_in'],
|
||||
bw_ctr['bw_out'],
|
||||
last_refreshed=refreshed)
|
||||
last_refreshed=refreshed,
|
||||
update_cells=update_cells)
|
||||
|
||||
def _get_host_volume_bdms(self, context, host):
|
||||
"""Return all block device mappings on a compute host."""
|
||||
|
||||
@@ -162,11 +162,12 @@ class LocalAPI(object):
|
||||
|
||||
def bw_usage_update(self, context, uuid, mac, start_period,
|
||||
bw_in, bw_out, last_ctr_in, last_ctr_out,
|
||||
last_refreshed=None):
|
||||
last_refreshed=None, update_cells=True):
|
||||
return self._manager.bw_usage_update(context, uuid, mac, start_period,
|
||||
bw_in, bw_out,
|
||||
last_ctr_in, last_ctr_out,
|
||||
last_refreshed)
|
||||
last_refreshed,
|
||||
update_cells=update_cells)
|
||||
|
||||
def security_group_get_by_instance(self, context, instance):
|
||||
return self._manager.security_group_get_by_instance(context, instance)
|
||||
|
||||
@@ -68,7 +68,7 @@ class ConductorManager(manager.Manager):
|
||||
namespace. See the ComputeTaskManager class for details.
|
||||
"""
|
||||
|
||||
RPC_API_VERSION = '1.53'
|
||||
RPC_API_VERSION = '1.54'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ConductorManager, self).__init__(service_name='conductor',
|
||||
@@ -226,11 +226,13 @@ class ConductorManager(manager.Manager):
|
||||
def bw_usage_update(self, context, uuid, mac, start_period,
|
||||
bw_in=None, bw_out=None,
|
||||
last_ctr_in=None, last_ctr_out=None,
|
||||
last_refreshed=None):
|
||||
last_refreshed=None,
|
||||
update_cells=True):
|
||||
if [bw_in, bw_out, last_ctr_in, last_ctr_out].count(None) != 4:
|
||||
self.db.bw_usage_update(context, uuid, mac, start_period,
|
||||
bw_in, bw_out, last_ctr_in, last_ctr_out,
|
||||
last_refreshed)
|
||||
last_refreshed,
|
||||
update_cells=update_cells)
|
||||
usage = self.db.bw_usage_get(context, uuid, start_period, mac)
|
||||
return jsonutils.to_primitive(usage)
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
block_device_mapping_get_all_by_instance
|
||||
1.52 - Pass instance objects for compute_confirm_resize
|
||||
1.53 - Added compute_reboot
|
||||
1.54 - Added 'update_cells' argument to bw_usage_update
|
||||
"""
|
||||
|
||||
BASE_RPC_API_VERSION = '1.0'
|
||||
@@ -222,13 +223,20 @@ class ConductorAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
def bw_usage_update(self, context, uuid, mac, start_period,
|
||||
bw_in=None, bw_out=None,
|
||||
last_ctr_in=None, last_ctr_out=None,
|
||||
last_refreshed=None):
|
||||
msg = self.make_msg('bw_usage_update',
|
||||
uuid=uuid, mac=mac, start_period=start_period,
|
||||
bw_in=bw_in, bw_out=bw_out,
|
||||
last_ctr_in=last_ctr_in, last_ctr_out=last_ctr_out,
|
||||
last_refreshed=last_refreshed)
|
||||
return self.call(context, msg, version='1.5')
|
||||
last_refreshed=None, update_cells=True):
|
||||
msg_kwargs = dict(uuid=uuid, mac=mac, start_period=start_period,
|
||||
bw_in=bw_in, bw_out=bw_out, last_ctr_in=last_ctr_in,
|
||||
last_ctr_out=last_ctr_out,
|
||||
last_refreshed=last_refreshed)
|
||||
|
||||
if self.can_send_version('1.54'):
|
||||
version = '1.54'
|
||||
msg_kwargs['update_cells'] = update_cells
|
||||
else:
|
||||
version = '1.5'
|
||||
|
||||
msg = self.make_msg('bw_usage_update', **msg_kwargs)
|
||||
return self.call(context, msg, version=version)
|
||||
|
||||
def security_group_get_by_instance(self, context, instance):
|
||||
instance_p = jsonutils.to_primitive(instance)
|
||||
|
||||
@@ -265,7 +265,7 @@ class _BaseTestCase(object):
|
||||
update_args = (self.context, 'uuid', 'mac', 0, 10, 20, 5, 10, 20)
|
||||
get_args = (self.context, 'uuid', 0, 'mac')
|
||||
|
||||
db.bw_usage_update(*update_args)
|
||||
db.bw_usage_update(*update_args, update_cells=True)
|
||||
db.bw_usage_get(*get_args).AndReturn('foo')
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
Reference in New Issue
Block a user