Merge "Fixes the storage capabilities"

This commit is contained in:
Zuul
2019-08-23 04:23:23 +00:00
committed by Gerrit Code Review
3 changed files with 84 additions and 44 deletions

View File

@@ -4714,6 +4714,30 @@ ArrayControllers/0/DiskDrives"
}
}
"""
DISK_COLLECTION_NO_DISK = """
{
"@odata.context": "/redfish/v1/$metadata#Systems/Members/1\
/SmartStorage/ArrayControllers/Members/2/DiskDrives",
"@odata.id": "/redfish/v1/Systems/1/SmartStorage/ArrayControllers\
/2/DiskDrives/",
"@odata.type": "\
#HpSmartStorageDiskDriveCollection.HpSmartStorageDiskDriveCollection",
"Description": "HP Smart Storage Disk Drives View",
"MemberType": "HpSmartStorageDiskDrive.1",
"Members@odata.count": 0,
"Name": "HpSmartStorageDiskDrives",
"Total": 0,
"Type": "Collection.1.0.0",
"links": {
"self": {
"href": "/rest/v1/Systems/1/SmartStorage/ArrayControllers/0\
/DiskDrives"
}
}
}
"""
DISK_DETAILS_LIST = """
[{
"@odata.context": "/redfish/v1/$metadata#Systems/Members/1\
@@ -4784,6 +4808,29 @@ ArrayControllers/Members/0/LogicalDrives",
}
}
"""
LOGICAL_COLLECTION_NO_DRIVE = """
{
"@odata.context": "/redfish/v1/$metadata#Systems/Members/1/SmartStorage/\
ArrayControllers/Members/0/LogicalDrives",
"@odata.id": "/redfish/v1/Systems/1/SmartStorage/ArrayControllers/\
0/LogicalDrives/",
"@odata.type": "\
#HpSmartStorageLogicalDriveCollection.HpSmartStorageLogicalDriveCollection",
"Description": "HP Smart Storage Logical Drives View",
"MemberType": "HpSmartStorageLogicalDrive.1",
"Members@odata.count": 0,
"Name": "HpSmartStorageLogicalDrives",
"Total": 0,
"Type": "Collection.1.0.0",
"links": {
"self": {
"href": "/rest/v1/Systems/1/SmartStorage/ArrayControllers/0\
/LogicalDrives"
}
}
}
"""
LOGICAL_DETAILS = """
[{

View File

@@ -2323,19 +2323,6 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
self.client._get_array_controller_resource)
get_mock.assert_called_once_with(array_uri)
@mock.patch.object(ris.RISOperations, '_get_storage_resource')
def test__get_array_controller_resource_not_supported(self,
storage_mock):
storage_data = json.loads(ris_outputs.STORAGE_SETTINGS)
storage_uri = '/rest/v1/Systems/1/SmartStorage'
del storage_data['links']['ArrayControllers']
storage_mock.return_value = (ris_outputs.GET_HEADERS,
storage_uri,
storage_data)
self.assertRaises(exception.IloCommandNotSupportedError,
self.client._get_array_controller_resource)
storage_mock.assert_called_once_with()
@mock.patch.object(ris.RISOperations, '_get_array_controller_resource')
def test__create_list_of_array_controllers(self, array_mock):
array_data = json.loads(ris_outputs.ARRAY_SETTINGS)
@@ -2349,18 +2336,6 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
self.assertEqual(expected_uri_links, uri_links)
array_mock.assert_called_once_with()
@mock.patch.object(ris.RISOperations, '_get_array_controller_resource')
def test__create_list_of_array_controllers_fail(self, array_mock):
array_data = json.loads(ris_outputs.ARRAY_SETTINGS)
array_uri = '/rest/v1/Systems/1/SmartStorage/ArrayControllers'
del array_data['links']['Member']
array_mock.return_value = (ris_outputs.GET_HEADERS,
array_uri,
array_data)
self.assertRaises(exception.IloCommandNotSupportedError,
self.client._create_list_of_array_controllers)
array_mock.assert_called_once_with()
@mock.patch.object(ris.RISOperations, '_get_physical_drive_resource')
def test__get_drive_type_and_speed(self, disk_details_mock):
disk_details_mock.return_value = (
@@ -2405,6 +2380,34 @@ class TestRISOperationsPrivateMethods(testtools.TestCase):
self.assertEqual(expected_out, out)
array_mock.assert_called_once_with()
@mock.patch.object(ris.RISOperations, '_create_list_of_array_controllers')
@mock.patch.object(ris.RISOperations, '_rest_get')
def test__get_drive_resource_no_physical_disk(self, get_mock, array_mock):
array_mock.return_value = (
[{u'href': u'/rest/v1/Systems/1/SmartStorage/ArrayControllers/0'}])
disk_col_no_disk = json.loads(ris_outputs.DISK_COLLECTION_NO_DISK)
get_mock.side_effect = [(ris_outputs.GET_HEADERS, 'xyz',
json.loads(ris_outputs.ARRAY_MEM_SETTINGS)),
(ris_outputs.GET_HEADERS, 'xyz',
disk_col_no_disk)]
out = self.client._get_physical_drive_resource()
self.assertIsNone(out)
array_mock.assert_called_once_with()
@mock.patch.object(ris.RISOperations, '_create_list_of_array_controllers')
@mock.patch.object(ris.RISOperations, '_rest_get')
def test__get_drive_resource_no_logical_drive(self, get_mock, array_mock):
array_mock.return_value = (
[{u'href': u'/rest/v1/Systems/1/SmartStorage/ArrayControllers/0'}])
log_col_no_drive = json.loads(ris_outputs.LOGICAL_COLLECTION_NO_DRIVE)
get_mock.side_effect = [(ris_outputs.GET_HEADERS, 'xyz',
json.loads(ris_outputs.ARRAY_MEM_SETTINGS)),
(ris_outputs.GET_HEADERS, 'xyz',
log_col_no_drive)]
out = self.client._get_physical_drive_resource()
self.assertIsNone(out)
array_mock.assert_called_once_with()
@mock.patch.object(ris.RISOperations, '_get_pci_devices')
def test__get_gpu_pci_devices(self, pci_mock):
pci_mock.return_value = json.loads(ris_outputs.PCI_DEVICE_DETAILS)