Fix for read-only and unchanged attributes

This patch fixes the set_settings() in which if
any attribute is read-only and unchanged, it will be
considered as readonly attribute and not unchanged attribute.

Change-Id: I530f1c2f1b8d91f996b91fa0a5f0535ddcfa76e6
This commit is contained in:
Rachit7194 2020-04-24 03:14:09 -04:00 committed by Christopher Dearborn
parent e3ad37aae8
commit 05ff2ec7a3
3 changed files with 13 additions and 7 deletions

View File

@ -346,7 +346,8 @@ class ClientBIOSConfigurationTestCase(base.BaseTest):
'SetAttributes']['ok'])
result = self.drac_client.set_bios_settings(
{'ProcVirtualization': 'Disabled'})
{'ProcVirtualization': 'Disabled',
'DynamicCoreAllocation': 'Disabled'})
self.assertEqual({'is_commit_required': True,
'is_reboot_required': constants.RebootRequired.true},

View File

@ -202,13 +202,13 @@
<n1:AttributeDisplayName>Logical Processor Idling</n1:AttributeDisplayName>
<n1:AttributeName>DynamicCoreAllocation</n1:AttributeName>
<n1:CurrentValue>Disabled</n1:CurrentValue>
<n1:Dependency xsi:nil="true"/>
<n1:DisplayOrder>421</n1:DisplayOrder>
<n1:Dependency>&lt;Dep&gt;&lt;AttrLev Op="OR"&gt;&lt;ROIf Name="ProcPwrPerf"&gt;MaxPerf&lt;/ROIf&gt;&lt;/AttrLev&gt;&lt;/Dep&gt;</n1:Dependency>
<n1:DisplayOrder>5817</n1:DisplayOrder>
<n1:FQDD>BIOS.Setup.1-1</n1:FQDD>
<n1:GroupDisplayName>Processor Settings</n1:GroupDisplayName>
<n1:GroupID>ProcSettings</n1:GroupID>
<n1:InstanceID>BIOS.Setup.1-1:DynamicCoreAllocation</n1:InstanceID>
<n1:IsReadOnly>false</n1:IsReadOnly>
<n1:IsReadOnly>true</n1:IsReadOnly>
<n1:PendingValue xsi:nil="true"/>
<n1:PossibleValues>Enabled</n1:PossibleValues>
<n1:PossibleValues>Disabled</n1:PossibleValues>
@ -1492,4 +1492,4 @@
<wsman:EndOfSequence/>
</wsen:EnumerateResponse>
</s:Body>
</s:Envelope>
</s:Envelope>

View File

@ -368,9 +368,14 @@ def set_settings(settings_type,
if type(current_setting_value) is list:
current_setting_value = current_setting_value[0]
if current_settings[attr].read_only:
unchanged_attribute = str(new_settings[attr]) == str(
current_setting_value)
# check if read-only attribute is unchanged
if current_settings[attr].read_only and not unchanged_attribute:
read_only_keys.append(attr)
elif str(new_settings[attr]) == str(current_setting_value):
if unchanged_attribute:
unchanged_attribs.append(attr)
else:
validation_msg = current_settings[attr].validate(