HPSSA: RAID creation should return current config
This commit adds support in manager.create_configuration() to probe the current configuration and return it back. Implements: blueprint hpssa-support Change-Id: I37e0251db3011dfd3468071839287d6974a66436
This commit is contained in:
@@ -57,6 +57,10 @@ def create_configuration(raid_config):
|
||||
raid_config = {'logical_disks': [{'raid_level': 1, 'size_gb': 100},
|
||||
<info-for-logical-disk-2>
|
||||
]}
|
||||
:returns: the current raid configuration. This is same as raid_config
|
||||
with some extra properties like root_device_hint, volume_name,
|
||||
controller, physical_disks, etc filled for each logical disk
|
||||
after its creation.
|
||||
:raises exception.InvalidInputError, if input is invalid.
|
||||
"""
|
||||
validate(raid_config)
|
||||
@@ -76,6 +80,12 @@ def create_configuration(raid_config):
|
||||
key=lambda x: int(x['size_gb']),
|
||||
reverse=True)
|
||||
|
||||
# We figure out the new disk created by recording the wwns
|
||||
# before and after the create, and then figuring out the
|
||||
# newly found wwn from it.
|
||||
wwns_before_create = set([x.wwn for x in
|
||||
server.get_logical_drives()])
|
||||
|
||||
for logical_disk in logical_disks_sorted:
|
||||
|
||||
if 'physical_disks' not in logical_disk:
|
||||
@@ -102,12 +112,33 @@ def create_configuration(raid_config):
|
||||
"on '%(controller)s'" %
|
||||
{'physical_disk': physical_disk,
|
||||
'controller': controller_id})
|
||||
raise exception.InvalidInputError(reason=msg)
|
||||
raise exception.InvalidInputError(msg)
|
||||
|
||||
physical_drive_ids = logical_disk['physical_disks']
|
||||
|
||||
controller.create_logical_drive(logical_disk, physical_drive_ids)
|
||||
|
||||
# Now find the new logical drive created.
|
||||
server.refresh()
|
||||
wwns_after_create = set([x.wwn for x in
|
||||
server.get_logical_drives()])
|
||||
|
||||
new_wwn = wwns_after_create - wwns_before_create
|
||||
|
||||
if not new_wwn:
|
||||
reason = ("Newly created logical disk with raid_level "
|
||||
"'%(raid_level)s' and size %(size_gb)s GB not "
|
||||
"found." % {'raid_level': logical_disk['raid_level'],
|
||||
'size_gb': logical_disk['size_gb']})
|
||||
raise exception.HPSSAOperationError(reason=reason)
|
||||
|
||||
new_logical_disk = server.get_logical_drive_by_wwn(new_wwn.pop())
|
||||
new_log_drive_properties = new_logical_disk.get_logical_drive_dict()
|
||||
logical_disk.update(new_log_drive_properties)
|
||||
|
||||
wwns_before_create = wwns_after_create.copy()
|
||||
|
||||
return raid_config
|
||||
|
||||
|
||||
def delete_configuration():
|
||||
|
||||
@@ -241,6 +241,20 @@ class Server(object):
|
||||
logical_drives.append(logical_drive)
|
||||
return logical_drives
|
||||
|
||||
def get_logical_drive_by_wwn(self, wwn):
|
||||
"""Get the logical drive object given the wwn.
|
||||
|
||||
This method returns the logical drive object with the given wwn.
|
||||
|
||||
:param wwn: wwn of the logical drive
|
||||
:returns: LogicalDrive object which has the wwn or None if
|
||||
logical drive is not found.
|
||||
"""
|
||||
disk = [x for x in self.get_logical_drives() if x.wwn == wwn]
|
||||
if disk:
|
||||
return disk[0]
|
||||
return None
|
||||
|
||||
|
||||
class Controller(object):
|
||||
"""This is the class for RAID controller."""
|
||||
@@ -368,13 +382,26 @@ 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['Fault Tolerance']
|
||||
self.raid_level = self.properties.get('Fault Tolerance')
|
||||
self.wwn = self.properties.get('Unique Identifier')
|
||||
self.volume_name = self.properties.get('Logical Drive Label')
|
||||
|
||||
def get_property(self, prop):
|
||||
if not self.properties:
|
||||
return None
|
||||
return self.properties.get(prop)
|
||||
|
||||
def get_logical_drive_dict(self):
|
||||
|
||||
physical_disk_ids = [x.id for x in self.parent.physical_drives]
|
||||
|
||||
return {'size_gb': self.size_gb,
|
||||
'raid_level': self.raid_level,
|
||||
'root_device_hint': {'wwn': self.wwn},
|
||||
'controller': self.parent.parent.id,
|
||||
'physical_disks': physical_disk_ids,
|
||||
'volume_name': self.volume_name}
|
||||
|
||||
|
||||
class PhysicalDrive:
|
||||
"""Class for PhysicalDrive object."""
|
||||
|
||||
@@ -436,3 +436,499 @@ Smart Array P822 in Slot 2
|
||||
Vendor ID: PMCSIERA
|
||||
Model: SRCv24x6G
|
||||
'''
|
||||
|
||||
HPSSA_ONE_DRIVE_100GB_RAID_5 = '''
|
||||
|
||||
Smart Array P822 in Slot 2
|
||||
Bus Interface: PCI
|
||||
Slot: 2
|
||||
Serial Number: PDVTF0BRH5T0MO
|
||||
Cache Serial Number: PBKUD0BRH5T3I6
|
||||
RAID 6 (ADG) Status: Enabled
|
||||
Controller Status: OK
|
||||
Hardware Revision: B
|
||||
Firmware Version: 4.68
|
||||
Rebuild Priority: Medium
|
||||
Expand Priority: Medium
|
||||
Surface Scan Delay: 3 secs
|
||||
Surface Scan Mode: Idle
|
||||
Queue Depth: Automatic
|
||||
Monitor and Performance Delay: 60 min
|
||||
Elevator Sort: Enabled
|
||||
Degraded Performance Optimization: Disabled
|
||||
Inconsistency Repair Policy: Disabled
|
||||
Wait for Cache Room: Disabled
|
||||
Surface Analysis Inconsistency Notification: Disabled
|
||||
Post Prompt Timeout: 15 secs
|
||||
Cache Board Present: True
|
||||
Cache Status: OK
|
||||
Cache Ratio: 10% Read / 90% Write
|
||||
Drive Write Cache: Disabled
|
||||
Total Cache Size: 2.0 GB
|
||||
Total Cache Memory Available: 1.8 GB
|
||||
No-Battery Write Cache: Disabled
|
||||
Cache Backup Power Source: Capacitors
|
||||
Battery/Capacitor Count: 1
|
||||
Battery/Capacitor Status: OK
|
||||
SATA NCQ Supported: True
|
||||
Spare Activation Mode: Activate on physical drive failure (default)
|
||||
Controller Temperature (C): 88
|
||||
Cache Module Temperature (C): 38
|
||||
Capacitor Temperature (C): 23
|
||||
Number of Ports: 6 (2 Internal / 4 External )
|
||||
Driver Name: hpsa
|
||||
Driver Version: 3.4.4
|
||||
Driver Supports HP SSD Smart Path: True
|
||||
|
||||
Array: A
|
||||
Interface Type: SAS
|
||||
Unused Space: 1563284 MB
|
||||
Status: OK
|
||||
MultiDomain Status: OK
|
||||
Array Type: Data
|
||||
HP SSD Smart Path: disable
|
||||
|
||||
|
||||
|
||||
Logical Drive: 1
|
||||
Size: 100.0 GB
|
||||
Fault Tolerance: 5
|
||||
Heads: 255
|
||||
Sectors Per Track: 32
|
||||
Cylinders: 25700
|
||||
Strip Size: 256 KB
|
||||
Full Stripe Size: 512 KB
|
||||
Status: OK
|
||||
MultiDomain Status: OK
|
||||
Caching: Enabled
|
||||
Parity Initialization Status: Queued
|
||||
Unique Identifier: 600508B1001CC42CDF101F06E5563967
|
||||
Disk Name: /dev/sda
|
||||
Mount Points: None
|
||||
Logical Drive Label: 02715627PDVTF0BRH5T0MO154D
|
||||
Drive Type: Data
|
||||
LD Acceleration Method: Controller Cache
|
||||
|
||||
physicaldrive 5I:1:3
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 3
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G4ZN0000B41707PD
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 35
|
||||
Maximum Temperature (C): 42
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 5I:1:4
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 4
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7H27F0000B41800S0
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 38
|
||||
Maximum Temperature (C): 45
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 6I:1:5
|
||||
Port: 6I
|
||||
Box: 1
|
||||
Bay: 5
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7H2BR0000B41800V8
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 34
|
||||
Maximum Temperature (C): 41
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
|
||||
unassigned
|
||||
|
||||
physicaldrive 5I:1:1
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 1
|
||||
Status: OK
|
||||
Drive Type: Unassigned Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G55D0000N4173JLT
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 36
|
||||
Maximum Temperature (C): 43
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 5I:1:2
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 2
|
||||
Status: OK
|
||||
Drive Type: Unassigned Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7H2DM0000B41800Y0
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 37
|
||||
Maximum Temperature (C): 44
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 6I:1:6
|
||||
Port: 6I
|
||||
Box: 1
|
||||
Bay: 6
|
||||
Status: OK
|
||||
Drive Type: Unassigned Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G4WD0000N4180GEJ
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 36
|
||||
Maximum Temperature (C): 44
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 6I:1:7
|
||||
Port: 6I
|
||||
Box: 1
|
||||
Bay: 7
|
||||
Status: OK
|
||||
Drive Type: Unassigned Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G54Q0000N4180W34
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 33
|
||||
Maximum Temperature (C): 39
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
|
||||
SEP (Vendor ID PMCSIERA, Model SRCv24x6G) 380
|
||||
Device Number: 380
|
||||
Firmware Version: RevB
|
||||
WWID: 5001438028842E1F
|
||||
Vendor ID: PMCSIERA
|
||||
Model: SRCv24x6G
|
||||
'''
|
||||
|
||||
|
||||
HPSSA_TWO_DRIVES_100GB_RAID5_50GB_RAID1 = '''
|
||||
|
||||
Smart Array P822 in Slot 2
|
||||
Bus Interface: PCI
|
||||
Slot: 2
|
||||
Serial Number: PDVTF0BRH5T0MO
|
||||
Cache Serial Number: PBKUD0BRH5T3I6
|
||||
RAID 6 (ADG) Status: Enabled
|
||||
Controller Status: OK
|
||||
Hardware Revision: B
|
||||
Firmware Version: 4.68
|
||||
Rebuild Priority: Medium
|
||||
Expand Priority: Medium
|
||||
Surface Scan Delay: 3 secs
|
||||
Surface Scan Mode: Idle
|
||||
Queue Depth: Automatic
|
||||
Monitor and Performance Delay: 60 min
|
||||
Elevator Sort: Enabled
|
||||
Degraded Performance Optimization: Disabled
|
||||
Inconsistency Repair Policy: Disabled
|
||||
Wait for Cache Room: Disabled
|
||||
Surface Analysis Inconsistency Notification: Disabled
|
||||
Post Prompt Timeout: 15 secs
|
||||
Cache Board Present: True
|
||||
Cache Status: OK
|
||||
Cache Ratio: 10% Read / 90% Write
|
||||
Drive Write Cache: Disabled
|
||||
Total Cache Size: 2.0 GB
|
||||
Total Cache Memory Available: 1.8 GB
|
||||
No-Battery Write Cache: Disabled
|
||||
Cache Backup Power Source: Capacitors
|
||||
Battery/Capacitor Count: 1
|
||||
Battery/Capacitor Status: OK
|
||||
SATA NCQ Supported: True
|
||||
Spare Activation Mode: Activate on physical drive failure (default)
|
||||
Controller Temperature (C): 88
|
||||
Cache Module Temperature (C): 38
|
||||
Capacitor Temperature (C): 23
|
||||
Number of Ports: 6 (2 Internal / 4 External )
|
||||
Driver Name: hpsa
|
||||
Driver Version: 3.4.4
|
||||
Driver Supports HP SSD Smart Path: True
|
||||
|
||||
Array: A
|
||||
Interface Type: SAS
|
||||
Unused Space: 1563284 MB
|
||||
Status: OK
|
||||
MultiDomain Status: OK
|
||||
Array Type: Data
|
||||
HP SSD Smart Path: disable
|
||||
|
||||
|
||||
|
||||
Logical Drive: 1
|
||||
Size: 100.0 GB
|
||||
Fault Tolerance: 5
|
||||
Heads: 255
|
||||
Sectors Per Track: 32
|
||||
Cylinders: 25700
|
||||
Strip Size: 256 KB
|
||||
Full Stripe Size: 512 KB
|
||||
Status: OK
|
||||
MultiDomain Status: OK
|
||||
Caching: Enabled
|
||||
Parity Initialization Status: Queued
|
||||
Unique Identifier: 600508B1001CC42CDF101F06E5563967
|
||||
Disk Name: /dev/sda
|
||||
Mount Points: None
|
||||
Logical Drive Label: 02715627PDVTF0BRH5T0MO154D
|
||||
Drive Type: Data
|
||||
LD Acceleration Method: Controller Cache
|
||||
|
||||
physicaldrive 5I:1:3
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 3
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G4ZN0000B41707PD
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 35
|
||||
Maximum Temperature (C): 42
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 5I:1:4
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 4
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7H27F0000B41800S0
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 38
|
||||
Maximum Temperature (C): 45
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 6I:1:5
|
||||
Port: 6I
|
||||
Box: 1
|
||||
Bay: 5
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7H2BR0000B41800V8
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 34
|
||||
Maximum Temperature (C): 41
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
|
||||
Array: B
|
||||
Interface Type: SAS
|
||||
Unused Space: 1042189 MB
|
||||
Status: OK
|
||||
MultiDomain Status: OK
|
||||
Array Type: Data
|
||||
HP SSD Smart Path: disable
|
||||
|
||||
|
||||
|
||||
Logical Drive: 2
|
||||
Size: 50.0 GB
|
||||
Fault Tolerance: 1
|
||||
Heads: 255
|
||||
Sectors Per Track: 32
|
||||
Cylinders: 12850
|
||||
Strip Size: 256 KB
|
||||
Full Stripe Size: 256 KB
|
||||
Status: OK
|
||||
MultiDomain Status: OK
|
||||
Caching: Enabled
|
||||
Unique Identifier: 600508B1001CE1E18302A8702C6AB008
|
||||
Disk Name: /dev/sdb
|
||||
Mount Points: None
|
||||
Logical Drive Label: 06715654PDVTF0BRH5T0MOACF0
|
||||
Mirror Group 0:
|
||||
physicaldrive 5I:1:1 (port 5I:box 1:bay 1, SAS, 600 GB, OK)
|
||||
Mirror Group 1:
|
||||
physicaldrive 5I:1:2 (port 5I:box 1:bay 2, SAS, 600 GB, OK)
|
||||
Drive Type: Data
|
||||
LD Acceleration Method: Controller Cache
|
||||
|
||||
physicaldrive 5I:1:1
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 1
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G55D0000N4173JLT
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 36
|
||||
Maximum Temperature (C): 43
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 5I:1:2
|
||||
Port: 5I
|
||||
Box: 1
|
||||
Bay: 2
|
||||
Status: OK
|
||||
Drive Type: Data Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7H2DM0000B41800Y0
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 37
|
||||
Maximum Temperature (C): 44
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
|
||||
unassigned
|
||||
|
||||
physicaldrive 6I:1:6
|
||||
Port: 6I
|
||||
Box: 1
|
||||
Bay: 6
|
||||
Status: OK
|
||||
Drive Type: Unassigned Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G4WD0000N4180GEJ
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 36
|
||||
Maximum Temperature (C): 44
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
physicaldrive 6I:1:7
|
||||
Port: 6I
|
||||
Box: 1
|
||||
Bay: 7
|
||||
Status: OK
|
||||
Drive Type: Unassigned Drive
|
||||
Interface Type: SAS
|
||||
Size: 600 GB
|
||||
Native Block Size: 512
|
||||
Rotational Speed: 15000
|
||||
Firmware Revision: HPD6
|
||||
Serial Number: 6SL7G54Q0000N4180W34
|
||||
Model: HP EF0600FARNA
|
||||
Current Temperature (C): 33
|
||||
Maximum Temperature (C): 39
|
||||
PHY Count: 2
|
||||
PHY Transfer Rate: 6.0Gbps, Unknown
|
||||
Drive Authentication Status: OK
|
||||
Carrier Application Version: 11
|
||||
Carrier Bootloader Version: 6
|
||||
|
||||
|
||||
SEP (Vendor ID PMCSIERA, Model SRCv24x6G) 380
|
||||
Device Number: 380
|
||||
Firmware Version: RevB
|
||||
WWID: 5001438028842E1F
|
||||
Vendor ID: PMCSIERA
|
||||
Model: SRCv24x6G
|
||||
'''
|
||||
|
||||
@@ -24,12 +24,9 @@ from proliantutils.tests.hpssa import raid_constants
|
||||
@mock.patch.object(objects.Server, '_get_all_details')
|
||||
class ManagerTestCases(testtools.TestCase):
|
||||
|
||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||
def test_create_configuration(self, controller_exec_cmd_mock,
|
||||
get_all_details_mock):
|
||||
|
||||
get_all_details_mock.return_value = raid_constants.HPSSA_NO_DRIVES
|
||||
|
||||
def _test_create_configuration_with_disk_input(self,
|
||||
controller_exec_cmd_mock,
|
||||
get_all_details_mock):
|
||||
ld1 = {'size_gb': 50,
|
||||
'raid_level': '1',
|
||||
'controller': 'Smart Array P822 in Slot 2',
|
||||
@@ -44,7 +41,7 @@ class ManagerTestCases(testtools.TestCase):
|
||||
|
||||
raid_info = {'logical_disks': [ld1, ld2]}
|
||||
|
||||
manager.create_configuration(raid_info)
|
||||
current_config = manager.create_configuration(raid_info)
|
||||
|
||||
ld1_drives = '5I:1:1,5I:1:2'
|
||||
ld2_drives = '5I:1:3,5I:1:4,6I:1:5'
|
||||
@@ -60,6 +57,37 @@ class ManagerTestCases(testtools.TestCase):
|
||||
"raid=1",
|
||||
"size=%d" % (50*1024))
|
||||
|
||||
ld1_ret = [x for x in current_config['logical_disks']
|
||||
if x['raid_level'] == '1'][0]
|
||||
ld2_ret = [x for x in current_config['logical_disks']
|
||||
if x['raid_level'] == '5'][0]
|
||||
|
||||
self.assertIsNotNone(ld1_ret['root_device_hint']['wwn'])
|
||||
self.assertIsNotNone(ld2_ret['root_device_hint']['wwn'])
|
||||
self.assertIsNotNone(ld1_ret['volume_name'])
|
||||
self.assertIsNotNone(ld2_ret['volume_name'])
|
||||
|
||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||
def test_create_configuration_with_disk_input_create_succeeds(
|
||||
self, controller_exec_cmd_mock, get_all_details_mock):
|
||||
no_drives = raid_constants.HPSSA_NO_DRIVES
|
||||
one_drive = raid_constants.HPSSA_ONE_DRIVE_100GB_RAID_5
|
||||
two_drives = raid_constants.HPSSA_TWO_DRIVES_100GB_RAID5_50GB_RAID1
|
||||
get_all_details_mock.side_effect = [no_drives, one_drive, two_drives]
|
||||
self._test_create_configuration_with_disk_input(
|
||||
controller_exec_cmd_mock, get_all_details_mock)
|
||||
|
||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||
def test_create_configuration_with_disk_input_create_fails(
|
||||
self, controller_exec_cmd_mock, get_all_details_mock):
|
||||
no_drives = raid_constants.HPSSA_NO_DRIVES
|
||||
one_drive = raid_constants.HPSSA_ONE_DRIVE_100GB_RAID_5
|
||||
get_all_details_mock.side_effect = [no_drives, one_drive, one_drive]
|
||||
ex = self.assertRaises(exception.HPSSAOperationError,
|
||||
self._test_create_configuration_with_disk_input,
|
||||
controller_exec_cmd_mock, get_all_details_mock)
|
||||
self.assertIn("raid_level '1' and size 50 GB not found", str(ex))
|
||||
|
||||
def test_create_configuration_invalid_logical_disks(self,
|
||||
get_all_details_mock):
|
||||
|
||||
|
||||
@@ -124,6 +124,29 @@ class ServerTest(testtools.TestCase):
|
||||
server = objects.Server()
|
||||
self.assertFalse(server.get_logical_drives())
|
||||
|
||||
def test_get_logical_drive_by_wwn(self, get_all_details_mock):
|
||||
|
||||
two_drives = raid_constants.HPSSA_TWO_DRIVES_100GB_RAID5_50GB_RAID1
|
||||
get_all_details_mock.return_value = two_drives
|
||||
server = objects.Server()
|
||||
|
||||
wwn = '600508B1001CC42CDF101F06E5563967'
|
||||
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
|
||||
if x.logical_drives[0].raid_level == '5'][0]
|
||||
self.assertEqual(ld_exp, ld_ret)
|
||||
|
||||
def test_get_logical_drive_by_wwn_not_exist(self, get_all_details_mock):
|
||||
|
||||
two_drives = raid_constants.HPSSA_TWO_DRIVES_100GB_RAID5_50GB_RAID1
|
||||
get_all_details_mock.return_value = two_drives
|
||||
server = objects.Server()
|
||||
|
||||
wwn = 'foo'
|
||||
ld_ret = server.get_logical_drive_by_wwn(wwn)
|
||||
self.assertIsNone(ld_ret)
|
||||
|
||||
|
||||
@mock.patch.object(objects.Server, '_get_all_details')
|
||||
class ControllerTest(testtools.TestCase):
|
||||
@@ -221,3 +244,24 @@ class ControllerTest(testtools.TestCase):
|
||||
controller.get_physical_drive_by_id('5I:1:3'))
|
||||
|
||||
self.assertIsNone(controller.get_physical_drive_by_id('foo'))
|
||||
|
||||
|
||||
@mock.patch.object(objects.Server, '_get_all_details')
|
||||
class LogicalDriveTest(testtools.TestCase):
|
||||
|
||||
def test_get_logical_drive_dict(self, get_all_details_mock):
|
||||
|
||||
get_all_details_mock.return_value = raid_constants.HPSSA_ONE_DRIVE
|
||||
server = objects.Server()
|
||||
logical_drive = server.controllers[0].raid_arrays[0].logical_drives[0]
|
||||
ret = logical_drive.get_logical_drive_dict()
|
||||
self.assertEqual(558, ret['size_gb'])
|
||||
self.assertEqual('1', ret['raid_level'])
|
||||
self.assertEqual('600508B1001C321CCA06EB7CD847939D',
|
||||
ret['root_device_hint']['wwn'])
|
||||
self.assertEqual('Smart Array P822 in Slot 2',
|
||||
ret['controller'])
|
||||
self.assertEqual(sorted(['5I:1:1', '5I:1:2']),
|
||||
sorted(ret['physical_disks']))
|
||||
self.assertEqual('01F42227PDVTF0BRH5T0MOAB64',
|
||||
ret['volume_name'])
|
||||
|
||||
Reference in New Issue
Block a user