Browse Source

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
(cherry picked from commit 8394938d2f)
tags/1.7.0
Rachit7194 10 months ago
committed by Christopher Dearborn
parent
commit
ed47ad96fb
4 changed files with 52 additions and 3 deletions
  1. +6
    -3
      dracclient/resources/raid.py
  2. +26
    -0
      dracclient/tests/test_raid.py
  3. +2
    -0
      dracclient/tests/utils.py
  4. +18
    -0
      dracclient/tests/wsman_mocks/raid_service-invoke-clear_foreign_config-not_supported.xml

+ 6
- 3
dracclient/resources/raid.py View File

@@ -125,7 +125,8 @@ VirtualDiskTuple = collections.namedtuple(
'status', 'raid_status', 'span_depth', 'span_length',
'pending_operations', 'physical_disks'])

NO_FOREIGN_DRIVE = "STOR018"

NO_FOREIGN_DRIVES = ["STOR058", "STOR018"]


class VirtualDisk(VirtualDiskTuple):
@@ -909,10 +910,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:


+ 26
- 0
dracclient/tests/test_raid.py 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'],
@@ -676,6 +677,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)


+ 2
- 0
dracclient/tests/utils.py 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'),
}
}
}


+ 18
- 0
dracclient/tests/wsman_mocks/raid_service-invoke-clear_foreign_config-not_supported.xml 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>

Loading…
Cancel
Save