Fix for clear_foreign_config() unsupported on some controllers

iDRAC driver fails to clear foreign drives on some controllers
and returns  message_id ``STOR058`` which means controllers does
not support clear_foreign_config operation.

Change-Id: I7df2d30242e7a490dfdce04d7f6ce98c68e9f0ed
This commit is contained in:
Rachit7194 2019-09-12 05:04:09 -04:00
parent ceef78a938
commit 8394938d2f
4 changed files with 52 additions and 3 deletions

View File

@ -95,7 +95,8 @@ VirtualDisk = collections.namedtuple(
'status', 'raid_status', 'span_depth', 'span_length',
'pending_operations', 'physical_disks'])
NO_FOREIGN_DRIVE = "STOR018"
NO_FOREIGN_DRIVES = ["STOR058", "STOR018"]
class RAIDManagement(object):
@ -831,10 +832,12 @@ class RAIDManagement(object):
'MessageID',
uris.DCIM_RAIDService).text
# A MessageID 'STOR018' indicates no foreign drive was
# A MessageID 'STOR018'/'STOR058' indicates no foreign drive was
# detected. Return a value which informs the caller nothing
# further needs to be done.
if message_id == NO_FOREIGN_DRIVE:
no_foreign_drives_detected = any(
stor_id == message_id for stor_id in NO_FOREIGN_DRIVES)
if no_foreign_drives_detected:
is_commit_required_value = False
is_reboot_required_value = constants.RebootRequired.false
else:

View File

@ -37,6 +37,7 @@ class ClientRAIDManagementTestCase(base.BaseTest):
self.drac_client = dracclient.client.DRACClient(
**test_utils.FAKE_ENDPOINT)
self.raid_controller_fqdd = "RAID.Integrated.1-1"
self.boss_controller_fqdd = "AHCI.Slot.3-1"
cntl_dict = {'RAID.Integrated.1-1':
['Disk.Bay.0:Enclosure.Internal.0-1:RAID.Integrated.1-1',
'Disk.Bay.1:Enclosure.Internal.0-1:RAID.Integrated.1-1'],
@ -669,6 +670,31 @@ class ClientRAIDManagementTestCase(base.BaseTest):
expected_selectors, expected_properties,
check_return_value=False)
@mock.patch.object(dracclient.client.WSManClient, 'invoke',
spec_set=True, autospec=True)
def test_clear_foreign_config_with_operation_not_supported(self,
mock_requests,
mock_invoke):
expected_selectors = {'SystemCreationClassName': 'DCIM_ComputerSystem',
'CreationClassName': 'DCIM_RAIDService',
'SystemName': 'DCIM:ComputerSystem',
'Name': 'DCIM:RAIDService'}
expected_properties = {'Target': self.boss_controller_fqdd}
mock_invoke.return_value = lxml.etree.fromstring(
test_utils.RAIDInvocations[uris.DCIM_RAIDService][
'ClearForeignConfig']['foreign_drive_operation_not_supported'])
result = self.drac_client.clear_foreign_config(
self.boss_controller_fqdd)
self.assertEqual({'is_commit_required': False,
'is_reboot_required':
constants.RebootRequired.false},
result)
mock_invoke.assert_called_once_with(
mock.ANY, uris.DCIM_RAIDService, 'ClearForeignConfig',
expected_selectors, expected_properties,
check_return_value=False)
@mock.patch.object(dracclient.client.WSManClient,
'wait_until_idrac_is_ready', spec_set=True,
autospec=True)

View File

@ -283,6 +283,8 @@ RAIDInvocations = {
'raid_service-invoke-clear_foreign_config-no_foreign_drive'),
'invalid_controller_id': load_wsman_xml(
'raid_service-invoke-clear_foreign_config-invalid_controller'),
'foreign_drive_operation_not_supported': load_wsman_xml(
'raid_service-invoke-clear_foreign_config-not_supported'),
}
}
}

View File

@ -0,0 +1,18 @@
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope"
xmlns:n1="http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_RAIDService"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<s:Header>
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
<wsa:Action>http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_RAIDService/ClearForeignConfigResponse</wsa:Action>
<wsa:RelatesTo>uuid:473f8ede-9a1a-441a-aaf6-699c1476aa97</wsa:RelatesTo>
<wsa:MessageID>uuid:55d91de0-90a1-10a1-8147-8c0c498fd94c</wsa:MessageID>
</s:Header>
<s:Body>
<n1:ClearForeignConfig_OUTPUT>
<n1:Message>The operation cannot be completed either because the operation is not supported on the target device,
or the RAIDType of "MD Software RAID" does not allow the operation.</n1:Message>
<n1:MessageID>STOR058</n1:MessageID>
<n1:ReturnValue>2</n1:ReturnValue>
</n1:ClearForeignConfig_OUTPUT>
</s:Body>
</s:Envelope>