Rename variable vm_avg_cpu_util

The variable vm_avg_cpu_util was renamed to host_avg_cpu_util for
clarity, as it was really referring to the host average cpu util.

Change-Id: I7aaef9eb2c8421d01715c86afa36ab67f2fd5f30
Closes-Bug: #1559113
This commit is contained in:
Larry Rensing
2016-03-18 10:45:08 -05:00
parent cb9bb7301b
commit 2836f460e3

View File

@@ -277,25 +277,25 @@ class BasicConsolidation(base.BaseStrategy):
:return: :return:
""" """
resource_id = "%s_%s" % (hypervisor.uuid, hypervisor.hostname) resource_id = "%s_%s" % (hypervisor.uuid, hypervisor.hostname)
vm_avg_cpu_util = self.ceilometer. \ host_avg_cpu_util = self.ceilometer. \
statistic_aggregation(resource_id=resource_id, statistic_aggregation(resource_id=resource_id,
meter_name=self.HOST_CPU_USAGE_METRIC_NAME, meter_name=self.HOST_CPU_USAGE_METRIC_NAME,
period="7200", period="7200",
aggregate='avg' aggregate='avg'
) )
if vm_avg_cpu_util is None: if host_avg_cpu_util is None:
LOG.error( LOG.error(
_LE("No values returned by %(resource_id)s " _LE("No values returned by %(resource_id)s "
"for %(metric_name)s"), "for %(metric_name)s"),
resource_id=resource_id, resource_id=resource_id,
metric_name=self.HOST_CPU_USAGE_METRIC_NAME, metric_name=self.HOST_CPU_USAGE_METRIC_NAME,
) )
vm_avg_cpu_util = 100 host_avg_cpu_util = 100
cpu_capacity = model.get_resource_from_id( cpu_capacity = model.get_resource_from_id(
resource.ResourceType.cpu_cores).get_capacity(hypervisor) resource.ResourceType.cpu_cores).get_capacity(hypervisor)
total_cores_used = cpu_capacity * (vm_avg_cpu_util / 100) total_cores_used = cpu_capacity * (host_avg_cpu_util / 100)
return self.calculate_weight(model, hypervisor, total_cores_used, return self.calculate_weight(model, hypervisor, total_cores_used,
0, 0,