Merge "PowerMax Driver - Create Volume from SG Payload Change"

This commit is contained in:
Zuul 2019-08-07 20:39:49 +00:00 committed by Gerrit Code Review
commit 3f243bc7eb
3 changed files with 59 additions and 11 deletions

View File

@ -1004,6 +1004,28 @@ class PowerMaxData(object):
'workload': 'DSS',
'child_storage_group': 'OS-HostX-SRP_1-DiamondDSS-OS-fibre-PG'}
add_volume_sg_info_dict = {
"storageGroupId": defaultstoragegroup_name,
"slo": "Optimized",
"service_level": "Optimized",
"base_slo_name": "Optimized",
"srp": "SRP_1",
"slo_compliance": "NONE",
"num_of_vols": 39,
"num_of_child_sgs": 0,
"num_of_parent_sgs": 0,
"num_of_masking_views": 0,
"num_of_snapshots": 0,
"cap_gb": 109.06,
"device_emulation": "FBA",
"type": "Standalone",
"unprotected": "true",
"compression": "true",
"compressionRatio": "1.0:1",
"compression_ratio_to_one": 1,
"vp_saved_percent": 99.9
}
data_dict = {volume_id: volume_info_dict}
platform = 'Linux-4.4.0-104-generic-x86_64-with-Ubuntu-16.04-xenial'
unisphere_version = u'V9.1.0.1'

View File

@ -362,13 +362,36 @@ class PowerMaxRestTest(test.TestCase):
def test_modify_storage_group(self):
array = self.data.array
storagegroup = self.data.defaultstoragegroup_name
payload = {'someKey': 'someValue'}
return_message = self.data.add_volume_sg_info_dict
payload = (
{"executionOption": "ASYNCHRONOUS",
"editStorageGroupActionParam": {
"expandStorageGroupParam": {
"addVolumeParam": {
"emulation": "FBA",
"create_new_volumes": "False",
"volumeAttributes": [
{
"num_of_vols": 1,
"volumeIdentifier": {
"identifier_name": "os-123-456",
"volumeIdentifierChoice":
"identifier_name"
},
"volume_size": 1,
"capacityUnit": "GB"}]}}}})
version = self.data.u4v_version
with mock.patch.object(self.rest, 'modify_resource') as mock_modify:
self.rest.modify_storage_group(array, storagegroup, payload)
with mock.patch.object(self.rest, 'modify_resource',
return_value=(200,
return_message)) as mock_modify:
status_code, message = self.rest.modify_storage_group(
array, storagegroup, payload)
mock_modify.assert_called_once_with(
self.data.array, 'sloprovisioning', 'storagegroup',
payload, version, resource_name=storagegroup)
self.assertEqual(1, mock_modify.call_count)
self.assertEqual(200, status_code)
self.assertEqual(return_message, message)
def test_create_volume_from_sg_success(self):
volume_name = self.data.volume_details[0]['volume_identifier']

View File

@ -868,16 +868,19 @@ class PowerMaxRest(object):
{"executionOption": "ASYNCHRONOUS",
"editStorageGroupActionParam": {
"expandStorageGroupParam": {
"addVolumeParam": [{
"num_of_vols": 1,
"addVolumeParam": {
"emulation": "FBA",
"create_new_volumes": "False",
"volumeIdentifier": {
"identifier_name": volume_name,
"volumeIdentifierChoice": "identifier_name"},
"volumeAttribute": {
"volume_size": volume_size,
"capacityUnit": "GB"}}]}}})
"volumeAttributes": [
{
"num_of_vols": 1,
"volumeIdentifier": {
"identifier_name": volume_name,
"volumeIdentifierChoice":
"identifier_name"
},
"volume_size": volume_size,
"capacityUnit": "GB"}]}}}})
status_code, job = self.modify_storage_group(
array, storagegroup_name, payload)