Merge "Fixes problem in is_boss_controller function"
This commit is contained in:
commit
82480155bf
@ -956,14 +956,23 @@ class DRACClient(object):
|
|||||||
"""
|
"""
|
||||||
return self._raid_mgmt.is_raid_controller(raid_controller_fqdd)
|
return self._raid_mgmt.is_raid_controller(raid_controller_fqdd)
|
||||||
|
|
||||||
def is_boss_controller(self, raid_controller_fqdd):
|
def is_boss_controller(self, raid_controller_fqdd, raid_controllers=None):
|
||||||
"""Find out if a RAID controller a BOSS card or not
|
"""Find out if a RAID controller a BOSS card or not
|
||||||
|
|
||||||
:param raid_controller_fqdd: The object's fqdd we are testing to see
|
:param raid_controller_fqdd: The object's fqdd we are testing to see
|
||||||
if it is a BOSS card or not.
|
if it is a BOSS card or not.
|
||||||
|
:param raid_controllers: A list of RAIDController to scan for presence
|
||||||
|
of BOSS card, if None the drac will be queried
|
||||||
|
for the list of controllers which will then be
|
||||||
|
scanned.
|
||||||
:returns: boolean, True if the device is a BOSS card, False if not.
|
:returns: boolean, True if the device is a BOSS card, False if not.
|
||||||
|
:raises: WSManRequestFailure on request failures
|
||||||
|
:raises: WSManInvalidResponse when receiving invalid response
|
||||||
|
:raises: DRACOperationFailed on error reported back by the DRAC
|
||||||
|
interface
|
||||||
"""
|
"""
|
||||||
return self._raid_mgmt.is_boss_controller(raid_controller_fqdd)
|
return self._raid_mgmt.is_boss_controller(raid_controller_fqdd,
|
||||||
|
raid_controllers)
|
||||||
|
|
||||||
def change_physical_disk_state(self, mode,
|
def change_physical_disk_state(self, mode,
|
||||||
controllers_to_physical_disk_ids=None):
|
controllers_to_physical_disk_ids=None):
|
||||||
|
@ -504,14 +504,26 @@ class RAIDManagement(object):
|
|||||||
"""
|
"""
|
||||||
return raid_controller_fqdd.startswith('RAID.')
|
return raid_controller_fqdd.startswith('RAID.')
|
||||||
|
|
||||||
def is_boss_controller(self, raid_controller_fqdd):
|
def is_boss_controller(self, raid_controller_fqdd, raid_controllers=None):
|
||||||
"""Find out if a RAID controller a BOSS card or not
|
"""Find out if a RAID controller a BOSS card or not
|
||||||
|
|
||||||
:param raid_controller_fqdd: The object's fqdd we are testing to see
|
:param raid_controller_fqdd: The object's fqdd we are testing to see
|
||||||
if it is a BOSS card or not.
|
if it is a BOSS card or not.
|
||||||
|
:param raid_controllers: A list of RAIDController to scan for presence
|
||||||
|
of BOSS card, if None the drac will be queried
|
||||||
|
for the list of controllers which will then be
|
||||||
|
scanned.
|
||||||
:returns: boolean, True if the device is a BOSS card, False if not.
|
:returns: boolean, True if the device is a BOSS card, False if not.
|
||||||
|
:raises: WSManRequestFailure on request failures
|
||||||
|
:raises: WSManInvalidResponse when receiving invalid response
|
||||||
|
:raises: DRACOperationFailed on error reported back by the DRAC
|
||||||
|
interface
|
||||||
"""
|
"""
|
||||||
return raid_controller_fqdd.startswith('AHCI.')
|
if raid_controllers is None:
|
||||||
|
raid_controllers = self.list_raid_controllers()
|
||||||
|
boss_raid_controllers = [
|
||||||
|
c.id for c in raid_controllers if c.model.startswith('BOSS')]
|
||||||
|
return raid_controller_fqdd in boss_raid_controllers
|
||||||
|
|
||||||
def _check_disks_status(self, mode, physical_disks,
|
def _check_disks_status(self, mode, physical_disks,
|
||||||
controllers_to_physical_disk_ids):
|
controllers_to_physical_disk_ids):
|
||||||
|
@ -772,11 +772,41 @@ class ClientRAIDManagementTestCase(base.BaseTest):
|
|||||||
self.assertFalse(self.drac_client
|
self.assertFalse(self.drac_client
|
||||||
.is_raid_controller("notRAID.Integrated.1-1"))
|
.is_raid_controller("notRAID.Integrated.1-1"))
|
||||||
|
|
||||||
def test_is_boss_controller(self, mock_requests):
|
@mock.patch.object(dracclient.client.WSManClient,
|
||||||
|
'wait_until_idrac_is_ready', spec_set=True,
|
||||||
|
autospec=True)
|
||||||
|
def test_is_boss_controller(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
|
self.assertTrue(self.drac_client
|
||||||
.is_boss_controller("AHCI.Integrated.1-1"))
|
.is_boss_controller("AHCI.Integrated.1-1"))
|
||||||
|
|
||||||
|
@mock.patch.object(dracclient.client.WSManClient,
|
||||||
|
'wait_until_idrac_is_ready', spec_set=True,
|
||||||
|
autospec=True)
|
||||||
|
def test_is_not_boss_controller(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
|
self.assertFalse(self.drac_client
|
||||||
.is_boss_controller("notAHCI.Integrated.1-1"))
|
.is_boss_controller("notAHCI.Integrated.1-1"),
|
||||||
|
None)
|
||||||
|
|
||||||
|
@mock.patch.object(dracclient.client.WSManClient,
|
||||||
|
'wait_until_idrac_is_ready', spec_set=True,
|
||||||
|
autospec=True)
|
||||||
|
def test_is_boss_controller_with_cntl_list(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'])
|
||||||
|
controllers = self.drac_client.list_raid_controllers()
|
||||||
|
self.assertTrue(self.drac_client
|
||||||
|
.is_boss_controller("AHCI.Integrated.1-1",
|
||||||
|
controllers))
|
||||||
|
|
||||||
def test_check_disks_status_no_controllers(self, mock_requests):
|
def test_check_disks_status_no_controllers(self, mock_requests):
|
||||||
physical_disks = [self.disk_1, self.disk_2, self.disk_3, self.disk_4]
|
physical_disks = [self.disk_1, self.disk_2, self.disk_3, self.disk_4]
|
||||||
|
Loading…
Reference in New Issue
Block a user