Browse Source

Merge "Consider a BOSS card a RAID controller"

changes/27/655327/1
Zuul 2 years ago
committed by Gerrit Code Review
parent
commit
8fe209b491
3 changed files with 42 additions and 8 deletions
  1. +11
    -3
      dracclient/client.py
  2. +10
    -4
      dracclient/resources/raid.py
  3. +21
    -1
      dracclient/tests/test_raid.py

+ 11
- 3
dracclient/client.py View File

@ -1005,15 +1005,23 @@ class DRACClient(object):
"""
return self._raid_mgmt.is_jbod_capable(raid_controller_fqdd)
def is_raid_controller(self, raid_controller_fqdd):
"""Find out if object's fqdd is for a raid controller or not
def is_raid_controller(self, raid_controller_fqdd, raid_controllers=None):
"""Determine if the given controller is a RAID controller
Since a BOSS controller is a type of RAID controller, this method will
return True for both BOSS and RAID controllers.
:param raid_controller_fqdd: The object's fqdd we are testing to see
if it is a raid controller or not.
:param raid_controllers: A list of RAIDControllers used to check for
the presence of BOSS cards. If None, the
iDRAC will be queried for the list of
controllers.
:returns: boolean, True if the device is a RAID controller,
False if not.
"""
return self._raid_mgmt.is_raid_controller(raid_controller_fqdd)
return self._raid_mgmt.is_raid_controller(raid_controller_fqdd,
raid_controllers)
def is_boss_controller(self, raid_controller_fqdd, raid_controllers=None):
"""Find out if a RAID controller a BOSS card or not


+ 10
- 4
dracclient/resources/raid.py View File

@ -503,15 +503,20 @@ class RAIDManagement(object):
return is_jbod_capable
def is_raid_controller(self, raid_controller_fqdd):
def is_raid_controller(self, raid_controller_fqdd, raid_controllers=None):
"""Find out if object's fqdd is for a raid controller or not
:param raid_controller_fqdd: The object's fqdd we are testing to see
if it is a raid controller or not.
:param raid_controllers: A list of RAIDControllers used to check for
the presence of BOSS cards. If None, the
iDRAC will be queried for the list of
controllers.
:returns: boolean, True if the device is a RAID controller,
False if not.
"""
return raid_controller_fqdd.startswith('RAID.')
return raid_controller_fqdd.startswith('RAID.') or \
self.is_boss_controller(raid_controller_fqdd, raid_controllers)
def is_boss_controller(self, raid_controller_fqdd, raid_controllers=None):
"""Find out if a RAID controller a BOSS card or not
@ -656,10 +661,11 @@ class RAIDManagement(object):
if not controllers_to_physical_disk_ids:
controllers_to_physical_disk_ids = collections.defaultdict(list)
all_controllers = self.list_raid_controllers()
for physical_d in physical_disks:
# Weed out disks that are not attached to a RAID controller
if (self.is_raid_controller(physical_d.controller)
or self.is_boss_controller(physical_d.controller)):
if self.is_raid_controller(physical_d.controller,
all_controllers):
physical_disk_ids = controllers_to_physical_disk_ids[
physical_d.controller]


+ 21
- 1
dracclient/tests/test_raid.py View File

@ -870,9 +870,29 @@ class ClientRAIDManagementTestCase(base.BaseTest):
exceptions.DRACOperationFailed,
self.drac_client.is_jbod_capable, self.raid_controller_fqdd)
def test_is_raid_controller(self, mock_requests):
def test_is_raid_controller_raid(self, mock_requests):
self.assertTrue(self.drac_client
.is_raid_controller("RAID.Integrated.1-1"))
@mock.patch.object(dracclient.client.WSManClient,
'wait_until_idrac_is_ready', spec_set=True,
autospec=True)
def test_is_raid_controller_boss(self, mock_requests,
mock_wait_until_idrac_is_ready):
mock_requests.post(
'https://1.2.3.4:443/wsman',
text=test_utils.RAIDEnumerations[uris.DCIM_ControllerView]['ok'])
self.assertTrue(self.drac_client
.is_raid_controller("AHCI.Integrated.1-1"))
@mock.patch.object(dracclient.client.WSManClient,
'wait_until_idrac_is_ready', spec_set=True,
autospec=True)
def test_is_raid_controller_fail(self, mock_requests,
mock_wait_until_idrac_is_ready):
mock_requests.post(
'https://1.2.3.4:443/wsman',
text=test_utils.RAIDEnumerations[uris.DCIM_ControllerView]['ok'])
self.assertFalse(self.drac_client
.is_raid_controller("notRAID.Integrated.1-1"))


Loading…
Cancel
Save