fix multinode tempest test failure

fix all five tempest tests:
watcher_tempest_plugin.tests.api.admin.test_service.
TestShowListService.test_show_service

watcher_tempest_plugin.tests.api.admin.test_service.
TestShowListService.test_show_service_with_links

tearDownClass (watcher_tempest_plugin.tests.api.admin.
test_action_plan.TestCreateDeleteExecuteActionPlan)

watcher_tempest_plugin.tests.scenario.test_execute_basic_optim
.TestExecuteBasicStrategy.test_execute_basic_action_plan

watcher_tempest_plugin.tests.scenario.test_execute_workload_balancing
.TestExecuteWorkloadBalancingStrategy
.test_execute_workload_stabilization

Change-Id: I4d8945cf2dedea3fa32029d6c07d24a411c1f2e4
Closes-Bug: #1695225
This commit is contained in:
licanwei
2017-06-05 11:40:05 +08:00
parent b4b3856f14
commit 65c63a9351
5 changed files with 46 additions and 17 deletions

View File

@@ -308,13 +308,17 @@ class WorkloadStabilization(base.WorkloadStabilizationBaseStrategy):
)
if avg_meter is None:
raise exception.NoSuchMetricForHost(
metric=meter_name,
host=node_id)
if meter_name == 'hardware.memory.used':
avg_meter /= oslo_utils.units.Ki
if meter_name == 'compute.node.cpu.percent':
avg_meter /= 100
if meter_name == 'hardware.memory.used':
avg_meter = node.memory
if meter_name == 'compute.node.cpu.percent':
avg_meter = 1
LOG.warning('No values returned by node %s for %s',
node_id, meter_name)
else:
if meter_name == 'hardware.memory.used':
avg_meter /= oslo_utils.units.Ki
if meter_name == 'compute.node.cpu.percent':
avg_meter /= 100
hosts_load[node_id][metric] = avg_meter
return hosts_load