Fix boot policy for Intel Node Manager driver
Correction time parameter does not apply to boot time policy and should be set to zero. Change-Id: I342c576508a2c65d3022d0f6e27ad5454178cf6b
This commit is contained in:
parent
10b87cb98e
commit
9e96fb9f7e
@ -262,6 +262,8 @@ def set_policy(policy):
|
||||
mode = 0x00 if policy['target_limit']['boot_mode'] == 'power' else 0x01
|
||||
cores_disabled = policy['target_limit']['cores_disabled'] << 1
|
||||
limit = mode | cores_disabled
|
||||
# correction time does not apply to boot time policy
|
||||
policy['correction_time'] = 0
|
||||
|
||||
policy_values = struct.pack('<HIHH', limit, policy['correction_time'],
|
||||
policy['trigger_limit'],
|
||||
|
@ -162,6 +162,9 @@ class IntelNMVendorPassthru(base.VendorInterface):
|
||||
if not isinstance(kwargs['target_limit'], dict):
|
||||
raise exception.InvalidParameterValue(_('Invalid boot '
|
||||
'policy'))
|
||||
elif 'correction_time' not in kwargs:
|
||||
raise exception.MissingParameterValue(
|
||||
_('Missing "correction_time" for no-boot policy'))
|
||||
|
||||
elif method == 'set_nm_policy_suspend':
|
||||
jsonschema.validate(kwargs, self.suspend_schema)
|
||||
|
@ -73,7 +73,7 @@
|
||||
"maximum": 65535
|
||||
}
|
||||
},
|
||||
"required": ["domain_id", "enable", "policy_id", "policy_trigger", "action", "power_domain", "target_limit", "correction_time", "reporting_period" ],
|
||||
"required": ["domain_id", "enable", "policy_id", "policy_trigger", "action", "power_domain", "target_limit", "reporting_period" ],
|
||||
"additionalProperties": false
|
||||
}
|
||||
|
||||
|
@ -73,10 +73,9 @@ class IntelNMPoliciesCommandTestCase(base.TestCase):
|
||||
'storage': 'persistent', 'action': 'alert',
|
||||
'power_domain': 'primary',
|
||||
'target_limit': {'boot_mode': 'power', 'cores_disabled': 2},
|
||||
'correction_time': 2000, 'trigger_limit': 100,
|
||||
'reporting_period': 600}
|
||||
'trigger_limit': 100, 'reporting_period': 600}
|
||||
expected = ['0x2E', '0xC1', '0x57', '0x01', '0x00', '0x10', '0x7B',
|
||||
'0x14', '0x00', '0x04', '0x00', '0xd0', '0x07', '0x00',
|
||||
'0x14', '0x00', '0x04', '0x00', '0x00', '0x00', '0x00',
|
||||
'0x00', '0x00', '0x00', '0x58', '0x02']
|
||||
result = commands.set_policy(policy)
|
||||
self.assertEqual(expected, result)
|
||||
|
@ -257,6 +257,7 @@ class IntelNMPassthruTestCase(db_base.DbTestCase):
|
||||
|
||||
def test_validate_policy_boot(self):
|
||||
data = _POLICY.copy()
|
||||
del data['correction_time']
|
||||
data['policy_trigger'] = 'boot'
|
||||
data['target_limit'] = {'boot_mode': 'power', 'cores_disabled': 2}
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
@ -272,6 +273,15 @@ class IntelNMPassthruTestCase(db_base.DbTestCase):
|
||||
task.driver.vendor.validate, task,
|
||||
'set_nm_policy', 'fake', **data)
|
||||
|
||||
def test_validate_policy_no_correction_time(self):
|
||||
data = _POLICY.copy()
|
||||
del data['correction_time']
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
shared=False) as task:
|
||||
self.assertRaises(exception.MissingParameterValue,
|
||||
task.driver.vendor.validate, task,
|
||||
'set_nm_policy', 'fake', **data)
|
||||
|
||||
def test_validate_statistics_no_policy(self):
|
||||
data = {'scope': 'policy', 'domain_id': 'platform'}
|
||||
with task_manager.acquire(self.context, self.node.uuid,
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
fixes:
|
||||
- Set boot policy for Intel Node Manager fixed, boot policy does not require
|
||||
"correction_time" parameter and it always should be set to zero.
|
Loading…
Reference in New Issue
Block a user