Inband disk erase support for SSD disk drives
This commits fixed the inband disk erase issue while passing SSD and HDD disk drives together and also implements support for SSD disk drives. Change-Id: I41858cb65df7a580b84e8d4528ef3398f9188a78 Bug-Id: 1815023
This commit is contained in:
parent
7286d7019c
commit
1ec0028037
|
@ -21,6 +21,10 @@ from oslo_utils import strutils
|
||||||
|
|
||||||
from proliantutils import exception
|
from proliantutils import exception
|
||||||
from proliantutils.hpssa import constants
|
from proliantutils.hpssa import constants
|
||||||
|
from proliantutils import log
|
||||||
|
|
||||||
|
|
||||||
|
LOG = log.get_logger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def _get_indentation(string):
|
def _get_indentation(string):
|
||||||
|
@ -447,26 +451,38 @@ class Controller(object):
|
||||||
def erase_devices(self, drives):
|
def erase_devices(self, drives):
|
||||||
"""Perform Erase on all the drives in the controller.
|
"""Perform Erase on all the drives in the controller.
|
||||||
|
|
||||||
This method erases all the drives in the controller by overwriting
|
This method erases all the hdd and ssd drives in the controller
|
||||||
the drives with the pattern. The drives will be unavailable until
|
by overwriting the drives with patterns for hdd and erasing storage
|
||||||
after successful completion or failure. The possible erase pattern
|
blocks for ssd drives. The drives would be unavailable until
|
||||||
available for sanitize erase are 'overwrite' and 'block' to perform
|
successful completion or failure of erase operation.
|
||||||
erase on HDD and SSD respectively.
|
|
||||||
|
|
||||||
If the sanitize erase is not supported on the controller it performs
|
If the sanitize erase is not supported on any disk it will try to
|
||||||
the disk erase by overwritting with zeros.
|
populate zeros on disk drives.
|
||||||
|
|
||||||
:param drives: A list of drive objects in the controller.
|
:param drives: A list of drive objects in the controller.
|
||||||
|
:raises: HPSSAOperationError, if sanitize erase is not supported.
|
||||||
"""
|
"""
|
||||||
# TODO(aparnav): Add Sanitize erase support for SSD
|
for drive in drives:
|
||||||
drive = ','.join([x.id for x in drives])
|
pattern = 'overwrite' if (
|
||||||
cmd_args = self._get_erase_command(drive, 'erasepattern=overwrite')
|
drive.disk_type == constants.DISK_TYPE_HDD) else 'block'
|
||||||
|
cmd_args = self._get_erase_command(
|
||||||
|
drive.id, 'erasepattern=%s' % pattern)
|
||||||
|
stdout = self.execute_cmd(*cmd_args)
|
||||||
|
LOG.debug("Sanitize disk erase invoked with erase pattern as "
|
||||||
|
"'%(pattern)s' on disk type: %(disk_type)s."
|
||||||
|
% {'pattern': pattern, 'disk_type': drive.disk_type})
|
||||||
|
|
||||||
stdout = self.execute_cmd(*cmd_args)
|
if "not supported" in str(stdout):
|
||||||
if "not supported" in str(stdout):
|
new_pattern = 'zero'
|
||||||
cmd_args = self._get_erase_command(drive,
|
cmd_args = self._get_erase_command(drive.id,
|
||||||
'erasepattern=zero')
|
'erasepattern=zero')
|
||||||
self.execute_cmd(*cmd_args)
|
self.execute_cmd(*cmd_args)
|
||||||
|
LOG.debug("Sanitize disk erase invoked with erase pattern as "
|
||||||
|
"'%(pattern)s' is not supported on disk type: "
|
||||||
|
"%(disk_type)s. Now its invoked with erase pattern "
|
||||||
|
"as %(new_pattern)s."
|
||||||
|
% {'pattern': pattern, 'disk_type': drive.disk_type,
|
||||||
|
'new_pattern': new_pattern})
|
||||||
|
|
||||||
|
|
||||||
class RaidArray(object):
|
class RaidArray(object):
|
||||||
|
|
|
@ -2391,6 +2391,27 @@ Smart Array P440 in Slot 2
|
||||||
Sanitize Estimated Max Erase Time: 0 hour(s)36 minute(s)
|
Sanitize Estimated Max Erase Time: 0 hour(s)36 minute(s)
|
||||||
Unrestricted Sanitize Supported: False
|
Unrestricted Sanitize Supported: False
|
||||||
Shingled Magnetic Recording Support: None
|
Shingled Magnetic Recording Support: None
|
||||||
|
|
||||||
|
physicaldrive 6I:1:7
|
||||||
|
Port: 6I
|
||||||
|
Box: 1
|
||||||
|
Bay: 7
|
||||||
|
Status: OK
|
||||||
|
Drive Type: Unassigned Drive
|
||||||
|
Interface Type: Solid State SAS
|
||||||
|
Size: 200 GB
|
||||||
|
Native Block Size: 512
|
||||||
|
Rotational Speed: 15000
|
||||||
|
Firmware Revision: HPD6
|
||||||
|
Serial Number: 6SL7G54Q0000N4180W34
|
||||||
|
Model: HP EF0600FARNA
|
||||||
|
Current Temperature (C): 31
|
||||||
|
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
|
||||||
'''
|
'''
|
||||||
|
|
||||||
SSA_ERASE_IN_PROGRESS = '''
|
SSA_ERASE_IN_PROGRESS = '''
|
||||||
|
|
|
@ -344,13 +344,16 @@ class ControllerTest(testtools.TestCase):
|
||||||
get_all_details_mock):
|
get_all_details_mock):
|
||||||
get_all_details_mock.return_value = raid_constants.SSA_ERASE_DRIVE
|
get_all_details_mock.return_value = raid_constants.SSA_ERASE_DRIVE
|
||||||
server = objects.Server()
|
server = objects.Server()
|
||||||
d = [x for x in server.controllers[0].unassigned_physical_drives]
|
drives = [x for x in server.controllers[0].unassigned_physical_drives]
|
||||||
controller = server.controllers[0]
|
controller = server.controllers[0]
|
||||||
controller.erase_devices(d)
|
execute_mock.return_value = ""
|
||||||
execute_mock.assert_called_once_with('pd 1I:2:1', 'modify', 'erase',
|
controller.erase_devices(drives)
|
||||||
'erasepattern=overwrite',
|
calls = [mock.call('pd 6I:1:7', 'modify', 'erase',
|
||||||
'unrestricted=off',
|
'erasepattern=block', 'unrestricted=off', 'forced'),
|
||||||
'forced')
|
mock.call('pd 1I:2:1', 'modify', 'erase',
|
||||||
|
'erasepattern=overwrite', 'unrestricted=off',
|
||||||
|
'forced')]
|
||||||
|
execute_mock.assert_has_calls(calls, any_order=True)
|
||||||
|
|
||||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||||
def test_erase_devices_sanitize_not_supported(self, execute_mock,
|
def test_erase_devices_sanitize_not_supported(self, execute_mock,
|
||||||
|
|
Loading…
Reference in New Issue