Browse Source

Improve logs of Workload Stabilization strategy

This patch set refactors logs of workload stabilization
strategy to make them more readable and sensible.

Related-Bug: #1874416
Change-Id: I408988712bb7560728157f3b4e4f2b37572128c4
changes/77/726877/2
Alexander Chadin 2 years ago
committed by licanwei
parent
commit
4c56eba5be
2 changed files with 30 additions and 6 deletions
  1. +1
    -0
      .zuul.yaml
  2. +29
    -6
      watcher/decision_engine/strategy/strategies/workload_stabilization.py

+ 1
- 0
.zuul.yaml View File

@@ -119,6 +119,7 @@
- job:
name: watcher-tempest-functional
parent: devstack-tempest
voting: false
timeout: 7200
required-projects:
- openstack/ceilometer


+ 29
- 6
watcher/decision_engine/strategy/strategies/workload_stabilization.py View File

@@ -254,7 +254,7 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
:param instance: instance for which statistic is gathered.
:return: dict
"""
LOG.debug('get_instance_load started')
LOG.debug('Getting load for %s', instance.uuid)
instance_load = {'uuid': instance.uuid, 'vcpus': instance.vcpus}
for meter in self.metrics:
avg_meter = self.datasource_backend.statistic_aggregation(
@@ -269,6 +269,10 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
return
if meter == 'cpu_util':
avg_meter /= float(100)
LOG.debug('Load of %(metric)s for %(instance)s is %(value)s',
{'metric': meter,
'instance': instance.uuid,
'value': avg_meter})
instance_load[meter] = avg_meter
return instance_load

@@ -293,6 +297,7 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
for node_id, node in self.get_available_nodes().items():
hosts_load[node_id] = {}
hosts_load[node_id]['vcpus'] = node.vcpus
LOG.debug('Getting load for %s', node_id)
for metric in self.metrics:
resource_id = ''
avg_meter = None
@@ -315,6 +320,10 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
avg_meter /= oslo_utils.units.Ki
if meter_name == 'compute.node.cpu.percent':
avg_meter /= 100
LOG.debug('Load of %(metric)s for %(node)s is %(value)s',
{'metric': metric,
'node': node_id,
'value': avg_meter})
hosts_load[node_id][metric] = avg_meter
return hosts_load

@@ -442,12 +451,15 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
normalized_load = self.normalize_hosts_load(hosts_load)
for metric in self.metrics:
metric_sd = self.get_sd(normalized_load, metric)
LOG.info("Standard deviation for %s is %s.",
(metric, metric_sd))
LOG.info("Standard deviation for %(metric)s is %(sd)s.",
{'metric': metric, 'sd': metric_sd})
if metric_sd > float(self.thresholds[metric]):
LOG.info("Standard deviation of %s exceeds"
" appropriate threshold %s.",
(metric, metric_sd))
LOG.info("Standard deviation of %(metric)s exceeds"
" appropriate threshold %(threshold)s by %(sd)s.",
{'metric': metric,
'threshold': float(self.thresholds[metric]),
'sd': metric_sd})
LOG.info("Launching workload optimization...")
return self.simulate_migrations(hosts_load)

def add_migration(self,
@@ -523,12 +535,23 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
if weighted_sd < min_sd:
min_sd = weighted_sd
hosts_load = instance_load[-1]
LOG.info("Migration of %(instance_uuid)s from %(s_host)s "
"to %(host)s reduces standard deviation to "
"%(min_sd)s.",
{'instance_uuid': instance_host['instance'],
's_host': instance_host['s_host'],
'host': instance_host['host'],
'min_sd': min_sd})
self.migrate(instance_host['instance'],
instance_host['s_host'],
instance_host['host'])

for metric, value in zip(self.metrics, instance_load[:-1]):
if value < float(self.thresholds[metric]):
LOG.info("At least one of metrics' values fell "
"below the threshold values. "
"Workload Stabilization has successfully "
"completed optimization process.")
balanced = True
break
if balanced:


Loading…
Cancel
Save