Passing 'process_input' to the running hpssacli process
This commit adds support to pass 'process_input' param of processutils to the running hpssacli process while executing hpssacli commands. The hpssacli process waits for the input as 'y' or 'n' to proceed further which leads to 'OutofMemory Error' if not provided with the input. Closes-Bug: #1589373 Change-Id: Ie3b1a2a42552a347aa0ab548b37d467577440d8b
This commit is contained in:
@@ -392,7 +392,7 @@ class Controller(object):
|
|||||||
size_mb = logical_drive_info['size_gb'] * 1024
|
size_mb = logical_drive_info['size_gb'] * 1024
|
||||||
cmd_args.append("size=%s" % size_mb)
|
cmd_args.append("size=%s" % size_mb)
|
||||||
|
|
||||||
self.execute_cmd(*cmd_args)
|
self.execute_cmd(*cmd_args, process_input='y')
|
||||||
|
|
||||||
def delete_all_logical_drives(self):
|
def delete_all_logical_drives(self):
|
||||||
"""Deletes all logical drives on trh controller.
|
"""Deletes all logical drives on trh controller.
|
||||||
|
|||||||
@@ -49,13 +49,15 @@ class ManagerTestCases(testtools.TestCase):
|
|||||||
"type=logicaldrive",
|
"type=logicaldrive",
|
||||||
"drives=%s" % ld2_drives,
|
"drives=%s" % ld2_drives,
|
||||||
"raid=5",
|
"raid=5",
|
||||||
"size=%d" % (100*1024))
|
"size=%d" % (100*1024),
|
||||||
|
process_input='y')
|
||||||
# Verify that we created the 50GB disk the last.
|
# Verify that we created the 50GB disk the last.
|
||||||
controller_exec_cmd_mock.assert_called_with("create",
|
controller_exec_cmd_mock.assert_called_with("create",
|
||||||
"type=logicaldrive",
|
"type=logicaldrive",
|
||||||
"drives=%s" % ld1_drives,
|
"drives=%s" % ld1_drives,
|
||||||
"raid=1",
|
"raid=1",
|
||||||
"size=%d" % (50*1024))
|
"size=%d" % (50*1024),
|
||||||
|
process_input='y')
|
||||||
|
|
||||||
ld1_ret = [x for x in current_config['logical_disks']
|
ld1_ret = [x for x in current_config['logical_disks']
|
||||||
if x['raid_level'] == '1'][0]
|
if x['raid_level'] == '1'][0]
|
||||||
@@ -128,13 +130,15 @@ class ManagerTestCases(testtools.TestCase):
|
|||||||
"type=logicaldrive",
|
"type=logicaldrive",
|
||||||
mock.ANY,
|
mock.ANY,
|
||||||
"raid=5",
|
"raid=5",
|
||||||
"size=%d" % (100*1024))
|
"size=%d" % (100*1024),
|
||||||
|
process_input='y')
|
||||||
# Verify that we created the 50GB disk the last.
|
# Verify that we created the 50GB disk the last.
|
||||||
controller_exec_cmd_mock.assert_called_with("create",
|
controller_exec_cmd_mock.assert_called_with("create",
|
||||||
"type=logicaldrive",
|
"type=logicaldrive",
|
||||||
mock.ANY,
|
mock.ANY,
|
||||||
"raid=1",
|
"raid=1",
|
||||||
"size=%d" % (50*1024))
|
"size=%d" % (50*1024),
|
||||||
|
process_input='y')
|
||||||
|
|
||||||
ld1_ret = [x for x in current_config['logical_disks']
|
ld1_ret = [x for x in current_config['logical_disks']
|
||||||
if x['raid_level'] == '1'][0]
|
if x['raid_level'] == '1'][0]
|
||||||
@@ -193,13 +197,13 @@ class ManagerTestCases(testtools.TestCase):
|
|||||||
sorted(ld2['physical_disks']))
|
sorted(ld2['physical_disks']))
|
||||||
controller_exec_cmd_mock.assert_any_call(
|
controller_exec_cmd_mock.assert_any_call(
|
||||||
'create', 'type=logicaldrive', 'drives=5I:1:1,5I:1:2',
|
'create', 'type=logicaldrive', 'drives=5I:1:1,5I:1:2',
|
||||||
'raid=1', 'size=51200')
|
'raid=1', 'size=51200', process_input='y')
|
||||||
controller_exec_cmd_mock.assert_any_call(
|
controller_exec_cmd_mock.assert_any_call(
|
||||||
'array', 'A', 'create', 'type=logicaldrive', 'raid=1', 'size=?',
|
'array', 'A', 'create', 'type=logicaldrive', 'raid=1', 'size=?',
|
||||||
dont_transform_to_hpssa_exception=True)
|
dont_transform_to_hpssa_exception=True)
|
||||||
controller_exec_cmd_mock.assert_any_call(
|
controller_exec_cmd_mock.assert_any_call(
|
||||||
'array', 'A', 'create', 'type=logicaldrive', 'raid=1',
|
'array', 'A', 'create', 'type=logicaldrive', 'raid=1',
|
||||||
'size=51200')
|
'size=51200', process_input='y')
|
||||||
|
|
||||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||||
def test_create_configuration_max_as_size_gb(
|
def test_create_configuration_max_as_size_gb(
|
||||||
@@ -225,10 +229,10 @@ class ManagerTestCases(testtools.TestCase):
|
|||||||
sorted(ld2['physical_disks']))
|
sorted(ld2['physical_disks']))
|
||||||
controller_exec_cmd_mock.assert_any_call(
|
controller_exec_cmd_mock.assert_any_call(
|
||||||
'create', 'type=logicaldrive', 'drives=5I:1:1,5I:1:2',
|
'create', 'type=logicaldrive', 'drives=5I:1:1,5I:1:2',
|
||||||
'raid=1', 'size=51200')
|
'raid=1', 'size=51200', process_input='y')
|
||||||
controller_exec_cmd_mock.assert_any_call(
|
controller_exec_cmd_mock.assert_any_call(
|
||||||
'create', 'type=logicaldrive', 'drives=5I:1:3,5I:1:4,6I:1:5',
|
'create', 'type=logicaldrive', 'drives=5I:1:3,5I:1:4,6I:1:5',
|
||||||
'raid=5')
|
'raid=5', process_input='y')
|
||||||
|
|
||||||
@mock.patch.object(manager, 'get_configuration')
|
@mock.patch.object(manager, 'get_configuration')
|
||||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class ControllerTest(testtools.TestCase):
|
|||||||
"type=logicaldrive",
|
"type=logicaldrive",
|
||||||
"drives=5I:1:1,5I:1:2,5I:1:3",
|
"drives=5I:1:1,5I:1:2,5I:1:3",
|
||||||
"raid=1",
|
"raid=1",
|
||||||
"size=51200")
|
"size=51200", process_input='y')
|
||||||
|
|
||||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||||
def test_create_logical_drive_max_size_gb(self, execute_mock,
|
def test_create_logical_drive_max_size_gb(self, execute_mock,
|
||||||
@@ -252,7 +252,7 @@ class ControllerTest(testtools.TestCase):
|
|||||||
execute_mock.assert_called_once_with("create",
|
execute_mock.assert_called_once_with("create",
|
||||||
"type=logicaldrive",
|
"type=logicaldrive",
|
||||||
"drives=5I:1:1,5I:1:2,5I:1:3",
|
"drives=5I:1:1,5I:1:2,5I:1:3",
|
||||||
"raid=1")
|
"raid=1", process_input='y')
|
||||||
|
|
||||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||||
def test_create_logical_drive_with_raid_array(self, execute_mock,
|
def test_create_logical_drive_with_raid_array(self, execute_mock,
|
||||||
@@ -275,7 +275,7 @@ class ControllerTest(testtools.TestCase):
|
|||||||
"create",
|
"create",
|
||||||
"type=logicaldrive",
|
"type=logicaldrive",
|
||||||
"raid=1",
|
"raid=1",
|
||||||
"size=51200")
|
"size=51200", process_input='y')
|
||||||
|
|
||||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||||
def test_create_logical_drive_raid_level_mapping(self, execute_mock,
|
def test_create_logical_drive_raid_level_mapping(self, execute_mock,
|
||||||
@@ -302,7 +302,7 @@ class ControllerTest(testtools.TestCase):
|
|||||||
execute_mock.assert_called_once_with(
|
execute_mock.assert_called_once_with(
|
||||||
"create", "type=logicaldrive",
|
"create", "type=logicaldrive",
|
||||||
"drives=5I:1:1,5I:1:2,5I:1:3,5I:1:4,5I:1:5,6I:1:6",
|
"drives=5I:1:1,5I:1:2,5I:1:3,5I:1:4,5I:1:5,6I:1:6",
|
||||||
"raid=50", "size=51200")
|
"raid=50", "size=51200", process_input='y')
|
||||||
|
|
||||||
@mock.patch.object(objects.Controller, 'execute_cmd')
|
@mock.patch.object(objects.Controller, 'execute_cmd')
|
||||||
def test_delete_all_logical_drives(self, execute_mock,
|
def test_delete_all_logical_drives(self, execute_mock,
|
||||||
|
|||||||
Reference in New Issue
Block a user