Fix service_parameter_get_one return in max_cpu_frequency semantic check

service_parameter_get_one returns a ServiceParameter. In order to get
the service parameter value the value attribute must be specified.

Story: 2009886
Task: 45487

Signed-off-by: Iago Estrela <IagoFilipe.EstrelaBarros@windriver.com>
Change-Id: I5de62c540528ca6404fd27d2fece0ee8dcc451c9
This commit is contained in:
Iago Estrela 2022-05-27 13:58:52 -03:00
parent 36ad54f2bd
commit f9d0338178
2 changed files with 4 additions and 2 deletions

View File

@ -2900,7 +2900,7 @@ class HostController(rest.RestController):
service=constants.SERVICE_TYPE_PLATFORM,
section=constants.SERVICE_PARAM_SECTION_PLATFORM_CONFIG,
name=constants.SERVICE_PARAM_NAME_PLATFORM_MAX_CPU_PERCENTAGE
)
).value
max_cpu_floor = (int(max_cpu_percentage) * max_cpu_default) // 100
# Restore the max_cpu_frequency to default if user set max_cpu_frequency

View File

@ -3444,8 +3444,10 @@ class TestHostModifyCPUMaxFrequency(TestHost):
def setUp(self):
super(TestHostModifyCPUMaxFrequency, self).setUp()
self.real_service_parameter_get_one = self.dbapi.service_parameter_get_one
service_parameter = mock.Mock()
service_parameter.value = 80
self.dbapi.service_parameter_get_one = mock.Mock(
return_value=constants.SERVICE_PARAM_PLATFORM_MAX_CPU_PERCENTAGE_DEFAULT)
return_value=service_parameter)
def tearDown(self):
super(TestHostModifyCPUMaxFrequency, self).tearDown()