Redfish: Adds create_raid_configuration API to create raid.

This commit adds functionality to create logical drives in a
SmartStorageConfig redfish systems.

Co-Authored-By: Paresh Sao <paresh.sao@hpe.com>
Change-Id: I679deac7e6b15d7a0de980fb16c9e283780fca80
Closes-Bug: 1716329
This commit is contained in:
Anshul Jain
2017-12-17 22:01:54 -06:00
committed by paresh-sao
parent 87a311cfa4
commit 8bda342451
15 changed files with 498 additions and 2 deletions

View File

@@ -779,6 +779,38 @@ class IloClientTestCase(testtools.TestCase):
'on ProLiant DL380 G8',
self.client.delete_raid_configuration)
@mock.patch.object(client.IloClient, '_call_method')
def test_create_raid_configuration(self, call_mock):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]}
self.client.create_raid_configuration(raid_config)
call_mock.assert_called_once_with('create_raid_configuration',
raid_config)
@mock.patch.object(ris.RISOperations, 'get_product_name')
def test_create_raid_configuration_gen9(self, get_product_mock):
self.client.model = 'Gen9'
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported '
'on ProLiant BL460c Gen9',
self.client.create_raid_configuration,
raid_config)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_create_raid_configuration_gen8(self, get_product_mock):
self.client.model = 'Gen8'
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]}
get_product_mock.return_value = 'ProLiant DL380 G8'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'`create_raid_configuration` is not supported '
'on ProLiant DL380 G8',
self.client.create_raid_configuration,
raid_config)
@mock.patch.object(ris.RISOperations, 'eject_virtual_media')
def test_eject_virtual_media_gen9(self, eject_virtual_media_mock):
self.client.model = 'Gen9'

View File

@@ -1062,6 +1062,15 @@ class IloRibclTestCaseBeforeRisSupport(unittest.TestCase):
'ProLiant DL380 G7',
self.ilo.delete_raid_configuration)
@mock.patch.object(ribcl.RIBCLOperations, 'get_product_name')
def test_create_raid_configuration(self, product_name_mock):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]}
product_name_mock.return_value = constants.GET_PRODUCT_NAME
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'ProLiant DL380 G7',
self.ilo.create_raid_configuration,
raid_config)
if __name__ == '__main__':
unittest.main()

View File

@@ -2558,3 +2558,13 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'ProLiant BL460c Gen9',
self.client.delete_raid_configuration)
@mock.patch.object(ris.RISOperations, 'get_product_name')
def test_create_raid_configuration(self, product_name_mock):
ld1 = {"size_gb": 150, "raid_level": '0', "is_root_volume": True}
raid_config = {"logical_disks": [ld1]}
product_name_mock.return_value = 'ProLiant BL460c Gen9'
self.assertRaisesRegexp(exception.IloCommandNotSupportedError,
'ProLiant BL460c Gen9',
self.client.create_raid_configuration,
raid_config)