Merge "Remove the disk erase timeout"
This commit is contained in:
commit
03f526ee6d
|
@ -14,6 +14,7 @@
|
|||
|
||||
import json
|
||||
import os
|
||||
import time
|
||||
|
||||
import jsonschema
|
||||
from jsonschema import exceptions as json_schema_exc
|
||||
|
@ -22,7 +23,6 @@ from proliantutils import exception
|
|||
from proliantutils.hpssa import constants
|
||||
from proliantutils.hpssa import disk_allocator
|
||||
from proliantutils.hpssa import objects
|
||||
from proliantutils.ilo import common
|
||||
|
||||
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
RAID_CONFIG_SCHEMA = os.path.join(CURRENT_DIR, "raid_config_schema.json")
|
||||
|
@ -378,11 +378,8 @@ def erase_devices():
|
|||
if drives:
|
||||
controller.erase_devices(drives)
|
||||
|
||||
common.wait_for_operation_to_complete(
|
||||
has_erase_completed,
|
||||
delay_bw_retries=300,
|
||||
failover_msg='Disk erase failed.'
|
||||
)
|
||||
while not has_erase_completed():
|
||||
time.sleep(300)
|
||||
|
||||
server.refresh()
|
||||
|
||||
|
|
|
@ -2486,3 +2486,24 @@ Smart Array P440 in Slot 2
|
|||
Sanitize Estimated Max Erase Time: 0 hour(s)36 minute(s)
|
||||
Unrestricted Sanitize Supported: False
|
||||
'''
|
||||
|
||||
SSA_ERASE_IN_PROGRESS_NOT_SUPPORTED = '''
|
||||
Smart Array P440 in Slot 2
|
||||
Controller Mode: RAID
|
||||
Pending Controller Mode: RAID
|
||||
Sanitize Erase Supported: True
|
||||
Primary Boot Volume: None
|
||||
Secondary Boot Volume: None
|
||||
|
||||
unassigned
|
||||
|
||||
physicaldrive 1I:2:1
|
||||
Drive Type: Unassigned Drive
|
||||
Interface Type: SAS
|
||||
Size: 300 GB
|
||||
Status: Erase In Progress
|
||||
Drive Type: Unassigned Drive
|
||||
Sanitize Erase Supported: False
|
||||
Sanitize Estimated Max Erase Time: 0 hour(s)36 minute(s)
|
||||
Unrestricted Sanitize Supported: False
|
||||
'''
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
import mock
|
||||
import testtools
|
||||
import time
|
||||
|
||||
from proliantutils import exception
|
||||
from proliantutils.hpssa import manager
|
||||
|
@ -480,8 +481,10 @@ class ManagerTestCases(testtools.TestCase):
|
|||
'Raid enabled')
|
||||
self.assertEqual(ctrl_expected, server.controllers)
|
||||
|
||||
@mock.patch.object(time, 'sleep')
|
||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||
def test_erase_devices(self, controller_exec_cmd_mock,
|
||||
sleep_mock,
|
||||
get_all_details_mock):
|
||||
erase_drive = raid_constants.SSA_ERASE_DRIVE
|
||||
erase_complete = raid_constants.SSA_ERASE_COMPLETE
|
||||
|
@ -503,10 +506,15 @@ class ManagerTestCases(testtools.TestCase):
|
|||
self.assertTrue(controller_exec_cmd_mock.called)
|
||||
controller_exec_cmd_mock.assert_any_call(*cmd_args)
|
||||
self.assertEqual(expt_ret, ret)
|
||||
self.assertFalse(sleep_mock.called)
|
||||
|
||||
@mock.patch.object(time, 'sleep')
|
||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||
def test_erase_devices_in_progress(self, controller_exec_cmd_mock,
|
||||
sleep_mock,
|
||||
get_all_details_mock):
|
||||
|
||||
erase_drive = raid_constants.SSA_ERASE_DRIVE
|
||||
erase_progress = raid_constants.SSA_ERASE_IN_PROGRESS
|
||||
erase_complete = raid_constants.SSA_ERASE_COMPLETE
|
||||
|
||||
|
@ -515,19 +523,24 @@ class ManagerTestCases(testtools.TestCase):
|
|||
'1I:2:1': 'Erase Complete. Reenable Before Using.',
|
||||
'Summary': ('Sanitize Erase performed on the disks attached to'
|
||||
' the controller.')}}
|
||||
get_all_details_mock.side_effect = [erase_progress, erase_complete,
|
||||
erase_complete]
|
||||
get_all_details_mock.side_effect = [erase_drive, erase_progress,
|
||||
erase_complete, erase_complete]
|
||||
|
||||
ret = manager.erase_devices()
|
||||
self.assertFalse(controller_exec_cmd_mock.called)
|
||||
self.assertTrue(controller_exec_cmd_mock.called)
|
||||
self.assertEqual(expt_ret, ret)
|
||||
self.assertTrue(sleep_mock.called)
|
||||
|
||||
@mock.patch.object(time, 'sleep')
|
||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||
def test_erase_devices_not_supported(self, controller_exec_cmd_mock,
|
||||
sleep_mock,
|
||||
get_all_details_mock):
|
||||
erase_not_supported = raid_constants.SSA_ERASE_NOT_SUPPORTED
|
||||
erase_complete = raid_constants.SSA_ERASE_COMPLETE_NOT_SUPPORTED
|
||||
erase_progress = raid_constants.SSA_ERASE_IN_PROGRESS_NOT_SUPPORTED
|
||||
get_all_details_mock.side_effect = [erase_not_supported,
|
||||
erase_progress,
|
||||
erase_complete, erase_complete]
|
||||
value = ("Drive 1I:2:1: This operation is not supported in this "
|
||||
"physical drive")
|
||||
|
@ -542,6 +555,8 @@ class ManagerTestCases(testtools.TestCase):
|
|||
|
||||
ret = manager.erase_devices()
|
||||
self.assertEqual(expt_ret, ret)
|
||||
self.assertTrue(controller_exec_cmd_mock.called)
|
||||
self.assertTrue(sleep_mock.called)
|
||||
|
||||
|
||||
class RaidConfigValidationTestCases(testtools.TestCase):
|
||||
|
|
Loading…
Reference in New Issue