HPSSA: Handle all storage units
This commit fixes the issue that this module handles size only in GB. Uses oslo_utils.strutils.string_to_bytes for conversion. Implements: blueprint hpssa-support Change-Id: If182db6b78ca2444bb65897bc5f402e4d42de768
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from oslo.concurrency import processutils
|
from oslo.concurrency import processutils
|
||||||
|
from oslo.utils import strutils
|
||||||
|
|
||||||
from proliantutils import exception
|
from proliantutils import exception
|
||||||
from proliantutils.hpssa import constants
|
from proliantutils.hpssa import constants
|
||||||
@@ -385,8 +386,21 @@ class LogicalDrive(object):
|
|||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.properties = properties
|
self.properties = properties
|
||||||
|
|
||||||
# TODO(rameshg87): Check if size is always reported in GB
|
# 'string_to_bytes' takes care of converting any returned
|
||||||
self.size_gb = int(float(self.properties['Size'].rstrip(' GB')))
|
# (like 500MB, 25GB) unit of storage space to bytes (Integer value).
|
||||||
|
# It requires space to be stripped.
|
||||||
|
size = self.properties['Size'].replace(' ', '')
|
||||||
|
try:
|
||||||
|
self.size_gb = (strutils.string_to_bytes(size, return_int=True) /
|
||||||
|
(1024*1024*1024))
|
||||||
|
except ValueError:
|
||||||
|
msg = ("hpssacli returned unknown size '%(size)s' for logical "
|
||||||
|
"disk '%(logical_disk)s' of RAID array '%(array)s' in "
|
||||||
|
"controller '%(controller)s'." %
|
||||||
|
{'size': size, 'logical_disk': self.id,
|
||||||
|
'array': self.parent.id,
|
||||||
|
'controller': self.parent.parent.id})
|
||||||
|
raise exception.HPSSAOperationError(reason=msg)
|
||||||
|
|
||||||
self.raid_level = self.properties.get('Fault Tolerance')
|
self.raid_level = self.properties.get('Fault Tolerance')
|
||||||
# For RAID levels (like 5+0 and 6+0), HPSSA names them differently.
|
# For RAID levels (like 5+0 and 6+0), HPSSA names them differently.
|
||||||
@@ -432,8 +446,20 @@ class PhysicalDrive:
|
|||||||
# Strip off physicaldrive before storing it in id
|
# Strip off physicaldrive before storing it in id
|
||||||
self.id = id[14:]
|
self.id = id[14:]
|
||||||
|
|
||||||
# TODO(rameshg87): Check if size is always reported in GB
|
size = self.properties['Size'].replace(' ', '')
|
||||||
self.size_gb = int(float(self.properties['Size'].rstrip(' GB')))
|
# 'string_to_bytes' takes care of converting any returned
|
||||||
|
# (like 500MB, 25GB) unit of storage space to bytes (Integer value).
|
||||||
|
# It requires space to be stripped.
|
||||||
|
try:
|
||||||
|
self.size_gb = (strutils.string_to_bytes(size, return_int=True) /
|
||||||
|
(1024*1024*1024))
|
||||||
|
except ValueError:
|
||||||
|
msg = ("hpssacli returned unknown size '%(size)s' for physical "
|
||||||
|
"disk '%(physical_disk)s' of controller "
|
||||||
|
"'%(controller)s'." %
|
||||||
|
{'size': size, 'physical_disk': self.id,
|
||||||
|
'controller': self.parent.id})
|
||||||
|
raise exception.HPSSAOperationError(reason=msg)
|
||||||
|
|
||||||
ssa_interface = self.properties['Interface Type']
|
ssa_interface = self.properties['Interface Type']
|
||||||
self.interface_type = constants.get_interface_type(ssa_interface)
|
self.interface_type = constants.get_interface_type(ssa_interface)
|
||||||
|
|||||||
@@ -1174,3 +1174,240 @@ Smart Array P822 in Slot 2
|
|||||||
Vendor ID: PMCSIERA
|
Vendor ID: PMCSIERA
|
||||||
Model: SRCv24x6G
|
Model: SRCv24x6G
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
HPSSA_BAD_SIZE_PHYSICAL_DRIVE = '''
|
||||||
|
|
||||||
|
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
|
||||||
|
Wait for Cache Room: Disabled
|
||||||
|
Surface Analysis Inconsistency Notification: Disabled
|
||||||
|
Post Prompt Timeout: 15 secs
|
||||||
|
Cache Board Present: True
|
||||||
|
Cache Status: OK
|
||||||
|
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): 37
|
||||||
|
Capacitor Temperature (C): 21
|
||||||
|
Number of Ports: 6 (2 Internal / 4 External )
|
||||||
|
Driver Name: hpsa
|
||||||
|
Driver Version: 3.4.4
|
||||||
|
Driver Supports HP SSD Smart Path: True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
unassigned
|
||||||
|
|
||||||
|
physicaldrive 5I:1:1
|
||||||
|
Port: 5I
|
||||||
|
Box: 1
|
||||||
|
Bay: 1
|
||||||
|
Status: OK
|
||||||
|
Drive Type: Unassigned Drive
|
||||||
|
Interface Type: SAS
|
||||||
|
Size: 500foo
|
||||||
|
Native Block Size: 512
|
||||||
|
Rotational Speed: 15000
|
||||||
|
Firmware Revision: HPD6
|
||||||
|
Serial Number: 6SL7G55D0000N4173JLT
|
||||||
|
Model: HP EF0600FARNA
|
||||||
|
Current Temperature (C): 35
|
||||||
|
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
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
HPSSA_BAD_SIZE_LOGICAL_DRIVE = '''
|
||||||
|
|
||||||
|
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): 37
|
||||||
|
Capacitor Temperature (C): 22
|
||||||
|
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: 0 MB
|
||||||
|
Status: OK
|
||||||
|
MultiDomain Status: OK
|
||||||
|
Array Type: Data
|
||||||
|
HP SSD Smart Path: disable
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Logical Drive: 1
|
||||||
|
Size: 558.9foo
|
||||||
|
Fault Tolerance: 1
|
||||||
|
Heads: 255
|
||||||
|
Sectors Per Track: 32
|
||||||
|
Cylinders: 65535
|
||||||
|
Strip Size: 256 KB
|
||||||
|
Full Stripe Size: 256 KB
|
||||||
|
Status: OK
|
||||||
|
MultiDomain Status: OK
|
||||||
|
Caching: Enabled
|
||||||
|
Unique Identifier: 600508B1001C321CCA06EB7CD847939D
|
||||||
|
Disk Name: /dev/sda
|
||||||
|
Mount Points: None
|
||||||
|
Logical Drive Label: 01F42227PDVTF0BRH5T0MOAB64
|
||||||
|
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: 500 GB
|
||||||
|
Native Block Size: 512
|
||||||
|
Rotational Speed: 15000
|
||||||
|
Firmware Revision: HPD6
|
||||||
|
Serial Number: 6SL7G55D0000N4173JLT
|
||||||
|
Model: HP EF0600FARNA
|
||||||
|
Current Temperature (C): 35
|
||||||
|
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: 500 GB
|
||||||
|
Native Block Size: 512
|
||||||
|
Rotational Speed: 15000
|
||||||
|
Firmware Revision: HPD6
|
||||||
|
Serial Number: 6SL7H2DM0000B41800Y0
|
||||||
|
Model: HP EF0600FARNA
|
||||||
|
Current Temperature (C): 35
|
||||||
|
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
|
||||||
|
'''
|
||||||
|
|
||||||
|
HPSSA_SMALL_SIZE_PHYSICAL_DRIVE = '''
|
||||||
|
|
||||||
|
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
|
||||||
|
Wait for Cache Room: Disabled
|
||||||
|
Surface Analysis Inconsistency Notification: Disabled
|
||||||
|
Post Prompt Timeout: 15 secs
|
||||||
|
Cache Board Present: True
|
||||||
|
Cache Status: OK
|
||||||
|
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): 37
|
||||||
|
Capacitor Temperature (C): 21
|
||||||
|
Number of Ports: 6 (2 Internal / 4 External )
|
||||||
|
Driver Name: hpsa
|
||||||
|
Driver Version: 3.4.4
|
||||||
|
Driver Supports HP SSD Smart Path: True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
unassigned
|
||||||
|
|
||||||
|
physicaldrive 5I:1:1
|
||||||
|
Port: 5I
|
||||||
|
Box: 1
|
||||||
|
Bay: 1
|
||||||
|
Status: OK
|
||||||
|
Drive Type: Unassigned Drive
|
||||||
|
Interface Type: SAS
|
||||||
|
Size: 2048 MB
|
||||||
|
Native Block Size: 512
|
||||||
|
Rotational Speed: 15000
|
||||||
|
Firmware Revision: HPD6
|
||||||
|
Serial Number: 6SL7G55D0000N4173JLT
|
||||||
|
Model: HP EF0600FARNA
|
||||||
|
Current Temperature (C): 35
|
||||||
|
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
|
||||||
|
'''
|
||||||
|
|||||||
@@ -304,3 +304,35 @@ class LogicalDriveTest(testtools.TestCase):
|
|||||||
sorted(ret['physical_disks']))
|
sorted(ret['physical_disks']))
|
||||||
self.assertEqual('01F42227PDVTF0BRH5T0MOAB64',
|
self.assertEqual('01F42227PDVTF0BRH5T0MOAB64',
|
||||||
ret['volume_name'])
|
ret['volume_name'])
|
||||||
|
|
||||||
|
def test___init__bad_size_logical_drive(self, get_all_details_mock):
|
||||||
|
|
||||||
|
ret = raid_constants.HPSSA_BAD_SIZE_LOGICAL_DRIVE
|
||||||
|
get_all_details_mock.return_value = ret
|
||||||
|
ex = self.assertRaises(exception.HPSSAOperationError,
|
||||||
|
objects.Server)
|
||||||
|
msg = ("unknown size '558.9foo' for logical disk '1' of RAID array "
|
||||||
|
"'A' in controller 'Smart Array P822 in Slot 2'")
|
||||||
|
self.assertIn(msg, str(ex))
|
||||||
|
|
||||||
|
|
||||||
|
@mock.patch.object(objects.Server, '_get_all_details')
|
||||||
|
class PhysicalDriveTest(testtools.TestCase):
|
||||||
|
|
||||||
|
def test___init__bad_size_logical_drive(self, get_all_details_mock):
|
||||||
|
|
||||||
|
ret = raid_constants.HPSSA_BAD_SIZE_PHYSICAL_DRIVE
|
||||||
|
get_all_details_mock.return_value = ret
|
||||||
|
ex = self.assertRaises(exception.HPSSAOperationError,
|
||||||
|
objects.Server)
|
||||||
|
msg = ("unknown size '500foo' for physical disk '5I:1:1' of "
|
||||||
|
"controller 'Smart Array P822 in Slot 2'")
|
||||||
|
self.assertIn(msg, str(ex))
|
||||||
|
|
||||||
|
def test___init__physical_disk_size_mb(self, get_all_details_mock):
|
||||||
|
|
||||||
|
ret = raid_constants.HPSSA_SMALL_SIZE_PHYSICAL_DRIVE
|
||||||
|
get_all_details_mock.return_value = ret
|
||||||
|
server = objects.Server()
|
||||||
|
self.assertEqual(
|
||||||
|
2, server.controllers[0].unassigned_physical_drives[0].size_gb)
|
||||||
|
|||||||
Reference in New Issue
Block a user