Merge "HPSSA: Fixes for issue found during functional testing"

This commit is contained in:
Jenkins
2015-02-28 05:28:38 +00:00
committed by Gerrit Code Review
4 changed files with 25 additions and 7 deletions

View File

@@ -156,7 +156,10 @@ def delete_configuration():
"""Delete a RAID configuration on this server."""
server = objects.Server()
for controller in server.controllers:
controller.delete_all_logical_drives()
# Trigger delete only if there is some RAID array, otherwise
# hpssacli will fail saying "no logical drives found."
if controller.raid_arrays:
controller.delete_all_logical_drives()
def get_configuration():

View File

@@ -383,9 +383,15 @@ class LogicalDrive(object):
# TODO(rameshg87): Check if size is always reported in GB
self.size_gb = int(float(self.properties['Size'].rstrip(' GB')))
self.raid_level = self.properties.get('Fault Tolerance')
self.wwn = self.properties.get('Unique Identifier')
self.volume_name = self.properties.get('Logical Drive Label')
# Trim down the WWN to 16 digits (8 bytes) so that it matches
# lsblk output in Linux.
wwn = self.properties.get('Unique Identifier')
if wwn:
wwn = '0x' + wwn[:16].lower()
self.wwn = wwn
def get_property(self, prop):
if not self.properties:
return None

View File

@@ -129,9 +129,9 @@ class ManagerTestCases(testtools.TestCase):
if x['raid_level'] == '1'][0]
ld2_ret = [x for x in current_config['logical_disks']
if x['raid_level'] == '5'][0]
self.assertEqual('600508B1001CC42CDF101F06E5563967',
self.assertEqual('0x600508b1001cc42c',
ld2_ret['root_device_hint']['wwn'])
self.assertEqual('600508B1001CE1E18302A8702C6AB008',
self.assertEqual('0x600508b1001ce1e1',
ld1_ret['root_device_hint']['wwn'])
@mock.patch.object(objects.Controller, 'execute_cmd')
@@ -165,6 +165,15 @@ class ManagerTestCases(testtools.TestCase):
"delete",
"forced")
@mock.patch.object(objects.Controller, 'execute_cmd')
def test_delete_configuration_no_arrays(
self, controller_exec_cmd_mock, get_all_details_mock):
get_all_details_mock.return_value = raid_constants.HPSSA_NO_DRIVES
manager.delete_configuration()
self.assertFalse(controller_exec_cmd_mock.called)
def test_get_configuration(self, get_all_details_mock):
get_all_details_mock.return_value = raid_constants.HPSSA_ONE_DRIVE
@@ -178,7 +187,7 @@ class ManagerTestCases(testtools.TestCase):
'5I:1:2'],
'volume_name': '01F42227PDVTF0BRH5T0MOAB64',
'root_device_hint': {
'wwn': '600508B1001C321CCA06EB7CD847939D'}}
'wwn': '0x600508b1001c321c'}}
# NOTE(rameshg87: Cannot directly compare because
# of 'physical_disks' key.

View File

@@ -130,7 +130,7 @@ class ServerTest(testtools.TestCase):
get_all_details_mock.return_value = two_drives
server = objects.Server()
wwn = '600508B1001CC42CDF101F06E5563967'
wwn = '0x600508b1001cc42c'
ld_ret = server.get_logical_drive_by_wwn(wwn)
raid_arrays = server.controllers[0].raid_arrays
ld_exp = [x.logical_drives[0] for x in raid_arrays
@@ -257,7 +257,7 @@ class LogicalDriveTest(testtools.TestCase):
ret = logical_drive.get_logical_drive_dict()
self.assertEqual(558, ret['size_gb'])
self.assertEqual('1', ret['raid_level'])
self.assertEqual('600508B1001C321CCA06EB7CD847939D',
self.assertEqual('0x600508b1001c321c',
ret['root_device_hint']['wwn'])
self.assertEqual('Smart Array P822 in Slot 2',
ret['controller'])