Merge "PowerMax Driver - allow for None values in metadata"
This commit is contained in:
commit
71cf8996e7
@ -412,6 +412,14 @@ class PowerMaxData(object):
|
|||||||
'array': array,
|
'array': array,
|
||||||
'interval': 3,
|
'interval': 3,
|
||||||
'retries': 120}
|
'retries': 120}
|
||||||
|
extra_specs_no_workload = {
|
||||||
|
'pool_name': u'Diamond+NONE+SRP_1+000197800123',
|
||||||
|
'slo': slo,
|
||||||
|
'srp': srp,
|
||||||
|
'workload': 'NONE',
|
||||||
|
'array': array,
|
||||||
|
'interval': 3,
|
||||||
|
'retries': 120}
|
||||||
extra_specs_optimized = {
|
extra_specs_optimized = {
|
||||||
'pool_name': u'Optimized+None+SRP_1+000197800123',
|
'pool_name': u'Optimized+None+SRP_1+000197800123',
|
||||||
'slo': 'Optimized', 'workload': 'None',
|
'slo': 'Optimized', 'workload': 'None',
|
||||||
|
@ -13,7 +13,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from datetime import datetime
|
||||||
import platform
|
import platform
|
||||||
|
import time
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from cinder.objects import fields
|
from cinder.objects import fields
|
||||||
@ -25,6 +27,9 @@ from cinder.volume.drivers.dell_emc.powermax import metadata
|
|||||||
from cinder.volume.drivers.dell_emc.powermax import rest
|
from cinder.volume.drivers.dell_emc.powermax import rest
|
||||||
from cinder.volume.drivers.dell_emc.powermax import utils
|
from cinder.volume.drivers.dell_emc.powermax import utils
|
||||||
|
|
||||||
|
mock_time = mock.MagicMock()
|
||||||
|
mock_time.return_value = time.mktime(datetime(1970, 1, 1).timetuple())
|
||||||
|
|
||||||
|
|
||||||
class PowerMaxVolumeMetadataNoDebugTest(test.TestCase):
|
class PowerMaxVolumeMetadataNoDebugTest(test.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -106,6 +111,32 @@ class PowerMaxVolumeMetadataDebugTest(test.TestCase):
|
|||||||
self.data.extra_specs)
|
self.data.extra_specs)
|
||||||
mock_uvim.assert_called_once()
|
mock_uvim.assert_called_once()
|
||||||
|
|
||||||
|
@mock.patch.object(
|
||||||
|
metadata.PowerMaxVolumeMetadata, 'update_volume_info_metadata',
|
||||||
|
return_value={})
|
||||||
|
@mock.patch('time.time', mock_time)
|
||||||
|
def test_capture_manage_existing_no_backup_id(self, mock_uvim):
|
||||||
|
manage_existing_metadata = (
|
||||||
|
{'1e5177e7-95e5-4a0f-b170-e45f4b469f6a': {
|
||||||
|
'volume_id': '1e5177e7-95e5-4a0f-b170-e45f4b469f6a',
|
||||||
|
'successful_operation': 'manage_existing_volume',
|
||||||
|
'volume_size': 2, 'device_id': '00001',
|
||||||
|
'default_sg_name': 'OS-SRP_1-Diamond-NONE-SG',
|
||||||
|
'serial_number': '000197800123', 'service_level': 'Diamond',
|
||||||
|
'workload': 'None', 'srp': 'SRP_1',
|
||||||
|
'identifier_name': 'OS-1e5177e7-95e5-4a0f-b170-e45f4b469f6a',
|
||||||
|
'rdf_group_no': '70', 'target_name': 'test_vol',
|
||||||
|
'remote_array': '000197800124', 'target_device_id': '00002',
|
||||||
|
'rep_mode': 'Metro', 'replication_status': 'Enabled',
|
||||||
|
'rdf_group_label': '23_24_007',
|
||||||
|
'volume_updated_time': '1970-01-01 00:00:00'}})
|
||||||
|
|
||||||
|
self.volume_metadata.capture_manage_existing(
|
||||||
|
self.data.test_volume, self.data.rep_info_dict,
|
||||||
|
self.data.device_id,
|
||||||
|
self.data.extra_specs_no_workload)
|
||||||
|
mock_uvim.assert_called_with(manage_existing_metadata, {})
|
||||||
|
|
||||||
@mock.patch.object(
|
@mock.patch.object(
|
||||||
metadata.PowerMaxVolumeMetadata, 'update_volume_info_metadata',
|
metadata.PowerMaxVolumeMetadata, 'update_volume_info_metadata',
|
||||||
return_value={})
|
return_value={})
|
||||||
|
@ -606,14 +606,14 @@ class PowerMaxVolumeMetadata(object):
|
|||||||
rep_mode, replication_status, rdf_group_label, backend_id = (
|
rep_mode, replication_status, rdf_group_label, backend_id = (
|
||||||
None, None, None, None)
|
None, None, None, None)
|
||||||
if rep_info_dict:
|
if rep_info_dict:
|
||||||
rdf_group_no = rep_info_dict['rdf_group_no']
|
rdf_group_no = rep_info_dict.get('rdf_group_no')
|
||||||
target_name = rep_info_dict['target_name']
|
target_name = rep_info_dict.get('target_name')
|
||||||
remote_array = rep_info_dict['remote_array']
|
remote_array = rep_info_dict.get('remote_array')
|
||||||
target_device_id = rep_info_dict['target_device_id']
|
target_device_id = rep_info_dict.get('target_device_id')
|
||||||
rep_mode = rep_info_dict['rep_mode']
|
rep_mode = rep_info_dict.get('rep_mode')
|
||||||
replication_status = rep_info_dict['replication_status']
|
replication_status = rep_info_dict.get('replication_status')
|
||||||
rdf_group_label = rep_info_dict['rdf_group_label']
|
rdf_group_label = rep_info_dict.get('rdf_group_label')
|
||||||
backend_id = rep_info_dict['backend_id']
|
backend_id = rep_info_dict.get('backend_id')
|
||||||
|
|
||||||
default_sg = self.utils.derive_default_sg_from_extra_specs(
|
default_sg = self.utils.derive_default_sg_from_extra_specs(
|
||||||
extra_specs, rep_mode)
|
extra_specs, rep_mode)
|
||||||
|
Loading…
Reference in New Issue
Block a user