From: Xing Yang Date: Thu, 5 Mar 2015 23:20:45 +0000 (-0500) Subject: Fixed the order of mock decorators in VMAX driver X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ce41647a8faa2e0d90d45d593d3fa7ae31f6f5db;p=openstack-build%2Fcinder-build.git Fixed the order of mock decorators in VMAX driver This patch fixed the order of the mock decorators in the unit tests of the VMAX driver. Change-Id: I17195120ec0645d1e343899d425b58f2811c2343 --- diff --git a/cinder/tests/test_emc_vmax.py b/cinder/tests/test_emc_vmax.py index 1a9506aed..233be0925 100644 --- a/cinder/tests/test_emc_vmax.py +++ b/cinder/tests/test_emc_vmax.py @@ -1985,24 +1985,24 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_storageSystem', - return_value=None) - @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'is_tiering_policy_enabled', + 'isArrayV3', return_value=False) - @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_pool_capacities', - return_value=(1234, 1200)) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'parse_array_name_from_file', return_value="123456789") @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'isArrayV3', + 'get_pool_capacities', + return_value=(1234, 1200)) + @mock.patch.object( + emc_vmax_fast.EMCVMAXFast, + 'is_tiering_policy_enabled', return_value=False) + @mock.patch.object( + emc_vmax_utils.EMCVMAXUtils, + 'find_storageSystem', + return_value=None) def test_get_volume_stats_no_fast(self, mock_storage_system, mock_is_fast_enabled, @@ -2011,51 +2011,51 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): mock_is_v3): self.driver.get_volume_stats(True) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_create_volume_no_fast_success( self, _mock_volume_type, mock_storage_system): self.driver.create_volume(self.data.test_volume_v2) + @mock.patch.object( + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'storagetype: stripedmetacount': '4', 'volume_backend_name': 'ISCSINoFAST'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) def test_create_volume_no_fast_striped_success( self, _mock_volume_type, mock_storage_system): self.driver.create_volume(self.data.test_volume_v2) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) - def test_create_volume_in_CG_no_fast_success( - self, _mock_volume_type, mock_storage_system): - self.driver.create_volume(self.data.test_volume_CG) - @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'ISCSINoFAST'}) + def test_create_volume_in_CG_no_fast_success( + self, _mock_volume_type, mock_storage_system): + self.driver.create_volume(self.data.test_volume_CG) + @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_delete_volume_no_fast_success( self, _mock_volume_type, mock_storage_system): self.driver.delete_volume(self.data.test_volume) @@ -2091,14 +2091,14 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): self.driver.delete_volume(notfound_delete_vol) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_delete_volume_failed( self, _mock_volume_type, mock_storage_system): self.driver.create_volume(self.data.failed_delete_vol) @@ -2107,35 +2107,31 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): self.data.failed_delete_vol) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) - @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) + emc_vmax_common.EMCVMAXCommon, + '_is_same_host', + return_value=True) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, 'find_device_number', return_value={'hostlunid': 1, 'storagesystem': EMCVMAXCommonData.storage_system}) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_is_same_host', - return_value=True) + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_already_mapped_no_fast_success( self, _mock_volume_type, mock_wrap_group, mock_wrap_device, mock_is_same_host): self.driver.initialize_connection(self.data.test_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', + '_check_adding_volume_to_storage_group', return_value=None) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, @@ -2143,8 +2139,12 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): return_value='value') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - '_check_adding_volume_to_storage_group', + '_wrap_get_storage_group_from_volume', return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_map_new_masking_view_no_fast_success( self, _mock_volume_type, mock_wrap_group, mock_storage_group, mock_add_volume): @@ -2186,17 +2186,9 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): self.driver.initialize_connection(self.data.test_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) - @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_find_masking_view', + '_get_initiator_group_from_masking_view', return_value='value') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, @@ -2204,72 +2196,80 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): return_value='value') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - '_get_initiator_group_from_masking_view', + '_find_masking_view', return_value='value') + @mock.patch.object( + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_map_existing_masking_view_no_fast_success( self, _mock_volume_type, mock_wrap_group, mock_storage_group, mock_initiator_group, mock_ig_from_mv): self.driver.initialize_connection(self.data.test_volume, self.data.connector) - @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, 'find_device_number', return_value={'storagesystem': EMCVMAXCommonData.storage_system}) + @mock.patch.object( + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) def test_map_no_fast_failed(self, mock_wrap_group, mock_wrap_device): self.assertRaises(exception.VolumeBackendAPIException, self.driver.initialize_connection, self.data.test_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) - @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_storage_masking_group', - return_value=EMCVMAXCommonData.storagegroupname) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - '_find_initiator_masking_group', + 'get_initiator_group_from_masking_view', return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_initiator_group_from_masking_view', + '_find_initiator_masking_group', return_value='myInitGroup') + @mock.patch.object( + emc_vmax_utils.EMCVMAXUtils, + 'find_storage_masking_group', + return_value=EMCVMAXCommonData.storagegroupname) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_detach_no_fast_success( self, mock_volume_type, mock_storage_group, mock_ig, mock_igc): self.driver.terminate_connection( self.data.test_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_size', return_value='2147483648') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_extend_volume_no_fast_success( self, _mock_volume_type, mock_volume_size): newSize = '2' self.driver.extend_volume(self.data.test_volume, newSize) + @mock.patch.object( + emc_vmax_utils.EMCVMAXUtils, + 'check_if_volume_is_extendable', + return_value='False') @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'storagetype: stripedmetacount': '4', 'volume_backend_name': 'ISCSINoFAST'}) - @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'check_if_volume_is_extendable', - return_value='False') def test_extend_volume_striped_no_fast_failed( self, _mock_volume_type, _mock_is_extendable): newSize = '2' @@ -2279,25 +2279,25 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): newSize) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) + emc_vmax_utils.EMCVMAXUtils, + 'get_meta_members_capacity_in_bit', + return_value=[1234567, 7654321]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_meta_head', return_value=[EMCVMAXCommonData.test_volume]) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_meta_members_capacity_in_bit', - return_value=[1234567, 7654321]) + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_create_snapshot_different_sizes_meta_no_fast_success( self, mock_volume_type, mock_volume, mock_meta, mock_size, mock_pool): @@ -2317,22 +2317,22 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): self.driver.create_snapshot, self.data.test_volume) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_sync_sv_by_target', - return_value=(None, None)) + 'get_meta_members_capacity_in_bit', + return_value=[1234567]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_meta_head', return_value=[EMCVMAXCommonData.test_volume]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'get_meta_members_capacity_in_bit', - return_value=[1234567]) + 'find_sync_sv_by_target', + return_value=(None, None)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_create_volume_from_same_size_meta_snapshot( self, mock_volume_type, mock_sync_sv, mock_meta, mock_size): self.data.test_volume['volume_name'] = "vmax-1234567" @@ -2347,21 +2347,21 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): self.data.test_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) + emc_vmax_utils.EMCVMAXUtils, + 'get_volume_meta_head', + return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_storage_sync_sv_sv', return_value=(None, None)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_volume_meta_head', - return_value=None) + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_create_clone_simple_volume_no_fast_success( self, mock_volume_type, mock_volume, mock_sync_sv, mock_simple_volume): @@ -2384,102 +2384,102 @@ class EMCVMAXISCSIDriverNoFastTestCase(test.TestCase): self.driver.migrate_volume(self.data.test_ctxt, self.data.test_volume, self.data.test_host) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'parse_pool_instance_id', return_value=('silver', 'SYMMETRIX+000195900551')) - def test_retype_volume_no_fast_success(self, _mock_volume_type, - mock_values): - self.driver.retype( - self.data.test_ctxt, self.data.test_volume, self.data.new_type, - self.data.diff, self.data.test_host) - @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'ISCSINoFAST'}) + def test_retype_volume_no_fast_success( + self, _mock_volume_type, mock_values): + self.driver.retype( + self.data.test_ctxt, self.data.test_volume, self.data.new_type, + self.data.diff, self.data.test_host) + @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_create_CG_no_fast_success( self, _mock_volume_type, _mock_storage_system): self.driver.create_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=None) @mock.patch.object( FakeDB, 'volume_get_all_by_group', return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=None) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_delete_CG_no_volumes_no_fast_success( self, _mock_volume_type, _mock_storage_system, _mock_db_volumes, _mock_members): self.driver.delete_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) - def test_delete_CG_with_volumes_no_fast_success( - self, _mock_volume_type, _mock_storage_system): - self.driver.delete_consistencygroup( - self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'ISCSINoFAST'}) + def test_delete_CG_with_volumes_no_fast_success( + self, _mock_volume_type, _mock_storage_system): + self.driver.delete_consistencygroup( + self.data.test_ctxt, self.data.test_CG) + + @mock.patch.object( + emc_vmax_utils.EMCVMAXUtils, + 'find_group_sync_rg_by_target', + return_value="") @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=()) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_consistency_group', return_value=(None, EMCVMAXCommonData.test_CG)) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=()) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_group_sync_rg_by_target', - return_value="") + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_create_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage, _mock_cg, _mock_members, _mock_rg): self.driver.create_cgsnapshot( self.data.test_ctxt, self.data.test_CG_snapshot) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSINoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSINoFAST'}) def test_delete_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage): self.driver.delete_cgsnapshot( @@ -2610,24 +2610,24 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_storageSystem', - return_value=None) + 'parse_array_name_from_file', + return_value="123456789") @mock.patch.object( emc_vmax_fast.EMCVMAXFast, - 'is_tiering_policy_enabled', - return_value=True) + 'get_capacities_associated_to_policy', + return_value=(1234, 1200)) @mock.patch.object( emc_vmax_fast.EMCVMAXFast, 'get_tier_policy_by_name', return_value=None) @mock.patch.object( emc_vmax_fast.EMCVMAXFast, - 'get_capacities_associated_to_policy', - return_value=(1234, 1200)) + 'is_tiering_policy_enabled', + return_value=True) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'parse_array_name_from_file', - return_value="123456789") + 'find_storageSystem', + return_value=None) def test_get_volume_stats_fast(self, mock_storage_system, mock_is_fast_enabled, @@ -2637,62 +2637,62 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.driver.get_volume_stats(True) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_volume_fast_success( self, _mock_volume_type, mock_storage_system, mock_pool_policy): self.driver.create_volume(self.data.test_volume_v2) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'storagetype: stripedmetacount': '4', - 'volume_backend_name': 'ISCSIFAST'}) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + volume_types, + 'get_volume_type_extra_specs', + return_value={'storagetype: stripedmetacount': '4', + 'volume_backend_name': 'ISCSIFAST'}) def test_create_volume_fast_striped_success( self, _mock_volume_type, mock_storage_system, mock_pool_policy): self.driver.create_volume(self.data.test_volume_v2) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_volume_in_CG_fast_success( self, _mock_volume_type, mock_storage_system, mock_pool_policy): self.driver.create_volume(self.data.test_volume_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, '_wrap_get_storage_group_from_volume', return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_delete_volume_fast_success( self, _mock_volume_type, mock_storage_group): self.driver.delete_volume(self.data.test_volume) @@ -2702,14 +2702,14 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.driver.create_volume, self.data.test_failed_volume) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, '_wrap_get_storage_group_from_volume', return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_delete_volume_fast_notfound( self, _mock_volume_type, mock_wrapper): notfound_delete_vol = {} @@ -2733,21 +2733,21 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.driver.delete_volume(notfound_delete_vol) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) - @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_delete_volume_fast_failed( self, _mock_volume_type, _mock_storage_group, mock_storage_system, mock_policy_pool): @@ -2757,85 +2757,85 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.data.failed_delete_vol) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) - @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) + emc_vmax_common.EMCVMAXCommon, + '_is_same_host', + return_value=True) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, 'find_device_number', return_value={'hostlunid': 1, 'storagesystem': EMCVMAXCommonData.storage_system}) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_is_same_host', - return_value=True) + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_already_mapped_fast_success( self, _mock_volume_type, mock_wrap_group, mock_wrap_device, mock_is_same_host): self.driver.initialize_connection(self.data.test_volume, self.data.connector) - @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, 'find_device_number', return_value={'storagesystem': EMCVMAXCommonData.storage_system}) + @mock.patch.object( + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) def test_map_fast_failed(self, mock_wrap_group, mock_wrap_device): self.assertRaises(exception.VolumeBackendAPIException, self.driver.initialize_connection, self.data.test_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) - @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_storage_masking_group', - return_value=EMCVMAXCommonData.storagegroupname) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - '_find_initiator_masking_group', + 'get_initiator_group_from_masking_view', return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_initiator_group_from_masking_view', + '_find_initiator_masking_group', return_value='myInitGroup') + @mock.patch.object( + emc_vmax_utils.EMCVMAXUtils, + 'find_storage_masking_group', + return_value=EMCVMAXCommonData.storagegroupname) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_detach_fast_success( self, mock_volume_type, mock_storage_group, mock_ig, mock_igc): self.driver.terminate_connection( self.data.test_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_size', return_value='2147483648') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_extend_volume_fast_success( self, _mock_volume_type, mock_volume_size): newSize = '2' self.driver.extend_volume(self.data.test_volume, newSize) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'check_if_volume_is_extendable', return_value='False') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_extend_volume_striped_fast_failed( self, _mock_volume_type, _mock_is_extendable): newSize = '2' @@ -2844,30 +2844,30 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.data.test_volume, newSize) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) @mock.patch.object( emc_vmax_fast.EMCVMAXFast, 'get_pool_associated_to_policy', return_value=1) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_volume_meta_head', - return_value=[EMCVMAXCommonData.test_volume]) + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_meta_members_capacity_in_bit', return_value=[1234567, 7654321]) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + emc_vmax_utils.EMCVMAXUtils, + 'get_volume_meta_head', + return_value=[EMCVMAXCommonData.test_volume]) + @mock.patch.object( + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_snapshot_different_sizes_meta_fast_success( self, mock_volume_type, mock_volume, mock_meta, mock_size, mock_pool, mock_policy): @@ -2890,22 +2890,22 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.driver.create_snapshot, self.data.test_volume) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_sync_sv_by_target', - return_value=(None, None)) + 'get_meta_members_capacity_in_bit', + return_value=[1234567]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_meta_head', return_value=[EMCVMAXCommonData.test_volume]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'get_meta_members_capacity_in_bit', - return_value=[1234567]) + 'find_sync_sv_by_target', + return_value=(None, None)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_volume_from_same_size_meta_snapshot( self, mock_volume_type, mock_sync_sv, mock_meta, mock_size): self.data.test_volume['volume_name'] = "vmax-1234567" @@ -2915,18 +2915,18 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.data.test_volume, self.data.test_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST', - 'FASTPOLICY': 'FC_GOLD1'}) + emc_vmax_utils.EMCVMAXUtils, + 'find_sync_sv_by_target', + return_value=(None, None)) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'find_replication_service', return_value=None) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_sync_sv_by_target', - return_value=(None, None)) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST', + 'FASTPOLICY': 'FC_GOLD1'}) def test_create_volume_from_snapshot_fast_failed( self, mock_volume_type, mock_rep_service, mock_sync_sv): @@ -2937,21 +2937,21 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): EMCVMAXCommonData.test_source_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) + emc_vmax_utils.EMCVMAXUtils, + 'get_volume_meta_head', + return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_storage_sync_sv_sv', return_value=(None, None)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_volume_meta_head', - return_value=None) + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_clone_simple_volume_fast_success( self, mock_volume_type, mock_volume, mock_sync_sv, mock_simple_volume): @@ -2962,29 +2962,29 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): EMCVMAXCommonData.test_source_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + emc_vmax_utils.EMCVMAXUtils, + 'get_meta_members_capacity_in_bit', + return_value=[1234567, 7654321]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_meta_head', return_value=[EMCVMAXCommonData.test_volume]) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_meta_members_capacity_in_bit', - return_value=[1234567, 7654321]) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_clone_fast_failed( self, mock_volume_type, mock_vol, mock_policy, mock_meta, mock_size, mock_pool): @@ -3005,105 +3005,105 @@ class EMCVMAXISCSIDriverFastTestCase(test.TestCase): self.data.test_host) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'parse_pool_instance_id', return_value=('silver', 'SYMMETRIX+000195900551')) @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_retype_volume_fast_success( self, _mock_volume_type, mock_values, mock_wrap): self.driver.retype( self.data.test_ctxt, self.data.test_volume, self.data.new_type, self.data.diff, self.data.test_host) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_CG_fast_success( self, _mock_volume_type, _mock_storage_system): self.driver.create_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=None) @mock.patch.object( FakeDB, 'volume_get_all_by_group', return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=None) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_delete_CG_no_volumes_fast_success( self, _mock_volume_type, _mock_storage_system, _mock_db_volumes, _mock_members): self.driver.delete_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_delete_CG_with_volumes_fast_success( self, _mock_volume_type, _mock_storage_system): self.driver.delete_consistencygroup( self.data.test_ctxt, self.data.test_CG) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) + emc_vmax_utils.EMCVMAXUtils, + 'find_group_sync_rg_by_target', + return_value="") @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=()) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_consistency_group', return_value=(None, EMCVMAXCommonData.test_CG)) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=()) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_group_sync_rg_by_target', - return_value="") + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_create_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage, _mock_cg, _mock_members, _mock_rg): self.driver.create_cgsnapshot( self.data.test_ctxt, self.data.test_CG_snapshot) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'ISCSIFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'ISCSIFAST'}) def test_delete_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage): self.driver.delete_cgsnapshot( @@ -3223,24 +3223,24 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase): @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_storageSystem', - return_value=None) - @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'is_tiering_policy_enabled', + 'isArrayV3', return_value=False) - @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_pool_capacities', - return_value=(1234, 1200)) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'parse_array_name_from_file', return_value="123456789") @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'isArrayV3', + 'get_pool_capacities', + return_value=(1234, 1200)) + @mock.patch.object( + emc_vmax_fast.EMCVMAXFast, + 'is_tiering_policy_enabled', return_value=False) + @mock.patch.object( + emc_vmax_utils.EMCVMAXUtils, + 'find_storageSystem', + return_value=None) def test_get_volume_stats_no_fast(self, mock_storage_system, mock_is_fast_enabled, @@ -3249,51 +3249,51 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase): mock_is_v3): self.driver.get_volume_stats(True) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_create_volume_no_fast_success( self, _mock_volume_type, mock_storage_system): self.driver.create_volume(self.data.test_volume_v2) + @mock.patch.object( + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'storagetype: stripedmetacount': '4', 'volume_backend_name': 'FCNoFAST'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) def test_create_volume_no_fast_striped_success( self, _mock_volume_type, mock_storage_system): self.driver.create_volume(self.data.test_volume_v2) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) - def test_create_volume_in_CG_no_fast_success( - self, _mock_volume_type, mock_storage_system): - self.driver.create_volume(self.data.test_volume_CG) - @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'FCNoFAST'}) + def test_create_volume_in_CG_no_fast_success( + self, _mock_volume_type, mock_storage_system): + self.driver.create_volume(self.data.test_volume_CG) + @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_delete_volume_no_fast_success( self, _mock_volume_type, mock_storage_system): self.driver.delete_volume(self.data.test_volume) @@ -3328,14 +3328,14 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase): notfound_delete_vol['provider_location'] = None self.driver.delete_volume(notfound_delete_vol) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_delete_volume_failed( self, _mock_volume_type, mock_storage_system): self.driver.create_volume(self.data.failed_delete_vol) @@ -3344,18 +3344,18 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase): self.data.failed_delete_vol) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST', - 'FASTPOLICY': 'FC_GOLD1'}) + emc_vmax_common.EMCVMAXCommon, + '_is_same_host', + return_value=True) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, 'get_masking_view_from_storage_group', return_value=EMCVMAXCommonData.lunmaskctrl_name) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_is_same_host', - return_value=True) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST', + 'FASTPOLICY': 'FC_GOLD1'}) def test_map_lookup_service_no_fast_success( self, _mock_volume_type, mock_maskingview, mock_is_same_host): self.data.test_volume['volume_name'] = "vmax-1234567" @@ -3378,63 +3378,63 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase): for init, target in data['data']['initiator_target_map'].items(): self.assertEqual(init, target[0][::-1]) + @mock.patch.object( + emc_vmax_common.EMCVMAXCommon, + 'find_device_number', + return_value={'Name': "0001"}) @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'FCNoFAST', 'FASTPOLICY': 'FC_GOLD1'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - 'find_device_number', - return_value={'Name': "0001"}) - def test_map_no_fast_failed(self, mock_wrap_group, mock_maskingview): + def test_map_no_fast_failed(self, _mock_volume_type, mock_wrap_device): self.assertRaises(exception.VolumeBackendAPIException, self.driver.initialize_connection, self.data.test_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_masking_view_by_volume', - return_value=EMCVMAXCommonData.lunmaskctrl_name) + 'get_initiator_group_from_masking_view', + return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, '_find_initiator_masking_group', return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_initiator_group_from_masking_view', - return_value='myInitGroup') + 'get_masking_view_by_volume', + return_value=EMCVMAXCommonData.lunmaskctrl_name) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_detach_no_fast_last_volume_success( self, mock_volume_type, mock_mv, mock_ig, mock_igc): self.driver.terminate_connection(self.data.test_source_volume, self.data.connector) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_size', return_value='2147483648') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_extend_volume_no_fast_success(self, _mock_volume_type, _mock_volume_size): newSize = '2' self.driver.extend_volume(self.data.test_volume, newSize) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'check_if_volume_is_extendable', return_value='False') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_extend_volume_striped_no_fast_failed( self, _mock_volume_type, _mock_is_extendable): newSize = '2' @@ -3451,102 +3451,102 @@ class EMCVMAXFCDriverNoFastTestCase(test.TestCase): self.driver.migrate_volume(self.data.test_ctxt, self.data.test_volume, self.data.test_host) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'parse_pool_instance_id', return_value=('silver', 'SYMMETRIX+000195900551')) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_retype_volume_no_fast_success( self, _mock_volume_type, mock_values): self.driver.retype( self.data.test_ctxt, self.data.test_volume, self.data.new_type, self.data.diff, self.data.test_host) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_create_CG_no_fast_success( self, _mock_volume_type, _mock_storage_system): self.driver.create_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=None) @mock.patch.object( FakeDB, 'volume_get_all_by_group', return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=None) - def test_delete_CG_no_volumes_no_fast_success( - self, _mock_volume_type, _mock_storage_system, - _mock_db_volumes, _mock_members): - self.driver.delete_consistencygroup( - self.data.test_ctxt, self.data.test_CG) - + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'FCNoFAST'}) + def test_delete_CG_no_volumes_no_fast_success( + self, _mock_volume_type, _mock_storage_system, + _mock_db_volumes, _mock_members): + self.driver.delete_consistencygroup( + self.data.test_ctxt, self.data.test_CG) + @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_delete_CG_with_volumes_no_fast_success( self, _mock_volume_type, _mock_storage_system): self.driver.delete_consistencygroup( self.data.test_ctxt, self.data.test_CG) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) + emc_vmax_utils.EMCVMAXUtils, + 'find_group_sync_rg_by_target', + return_value="") @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=()) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_consistency_group', return_value=(None, EMCVMAXCommonData.test_CG)) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=()) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_group_sync_rg_by_target', - return_value="") + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_create_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage, _mock_cg, _mock_members, _mock_rg): self.driver.create_cgsnapshot( self.data.test_ctxt, self.data.test_CG_snapshot) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCNoFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCNoFAST'}) def test_delete_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage): self.driver.delete_cgsnapshot( @@ -3700,24 +3700,24 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_storageSystem', - return_value=None) + 'parse_array_name_from_file', + return_value="123456789") @mock.patch.object( emc_vmax_fast.EMCVMAXFast, - 'is_tiering_policy_enabled', - return_value=True) + 'get_capacities_associated_to_policy', + return_value=(1234, 1200)) @mock.patch.object( emc_vmax_fast.EMCVMAXFast, 'get_tier_policy_by_name', return_value=None) @mock.patch.object( emc_vmax_fast.EMCVMAXFast, - 'get_capacities_associated_to_policy', - return_value=(1234, 1200)) + 'is_tiering_policy_enabled', + return_value=True) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'parse_array_name_from_file', - return_value="123456789") + 'find_storageSystem', + return_value=None) def test_get_volume_stats_fast(self, mock_storage_system, mock_is_fast_enabled, @@ -3727,62 +3727,62 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): self.driver.get_volume_stats(True) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_volume_fast_success( self, _mock_volume_type, mock_storage_system, mock_pool_policy): self.driver.create_volume(self.data.test_volume_v2) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'storagetype: stripedmetacount': '4', - 'volume_backend_name': 'FCFAST'}) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + volume_types, + 'get_volume_type_extra_specs', + return_value={'storagetype: stripedmetacount': '4', + 'volume_backend_name': 'FCFAST'}) def test_create_volume_fast_striped_success( self, _mock_volume_type, mock_storage_system, mock_pool_policy): self.driver.create_volume(self.data.test_volume_v2) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_volume_in_CG_fast_success( self, _mock_volume_type, mock_storage_system, mock_pool_policy): self.driver.create_volume(self.data.test_volume_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, '_wrap_get_storage_group_from_volume', return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_delete_volume_fast_success(self, _mock_volume_type, mock_storage_group): self.driver.delete_volume(self.data.test_volume) @@ -3821,21 +3821,21 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): self.driver.delete_volume(notfound_delete_vol) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) - @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_delete_volume_fast_failed( self, _mock_volume_type, mock_wrapper, mock_storage_system, mock_pool_policy): @@ -3845,18 +3845,18 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): self.data.failed_delete_vol) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST', - 'FASTPOLICY': 'FC_GOLD1'}) + emc_vmax_common.EMCVMAXCommon, + '_is_same_host', + return_value=True) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, 'get_masking_view_from_storage_group', return_value=EMCVMAXCommonData.lunmaskctrl_name) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_is_same_host', - return_value=True) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST', + 'FASTPOLICY': 'FC_GOLD1'}) def test_map_fast_success(self, _mock_volume_type, mock_maskingview, mock_is_same_host): common = self.driver.common @@ -3870,42 +3870,42 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): for init, target in data['data']['initiator_target_map'].items(): self.assertIn(init[::-1], target) + @mock.patch.object( + emc_vmax_common.EMCVMAXCommon, + 'find_device_number', + return_value={'Name': "0001"}) @mock.patch.object( volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'FCFAST', 'FASTPOLICY': 'FC_GOLD1'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - 'find_device_number', - return_value={'Name': "0001"}) - def test_map_fast_failed(self, mock_wrap_group, mock_maskingview): + def test_map_fast_failed(self, _mock_volume_type, mock_wrap_device): self.assertRaises(exception.VolumeBackendAPIException, self.driver.initialize_connection, self.data.test_volume, self.data.connector) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST', - 'FASTPOLICY': 'FC_GOLD1'}) + emc_vmax_common.EMCVMAXCommon, + 'get_masking_views_by_port_group', + return_value=[]) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_masking_view_by_volume', - return_value=EMCVMAXCommonData.lunmaskctrl_name) + 'get_initiator_group_from_masking_view', + return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, '_find_initiator_masking_group', return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_initiator_group_from_masking_view', - return_value='myInitGroup') + 'get_masking_view_by_volume', + return_value=EMCVMAXCommonData.lunmaskctrl_name) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - 'get_masking_views_by_port_group', - return_value=[]) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST', + 'FASTPOLICY': 'FC_GOLD1'}) def test_detach_fast_success(self, mock_volume_type, mock_maskingview, mock_ig, mock_igc, mock_mv): common = self.driver.common @@ -3918,27 +3918,27 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): numTargetWwns = len(EMCVMAXCommonData.target_wwns) self.assertEqual(numTargetWwns, len(data['data'])) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_size', return_value='2147483648') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_extend_volume_fast_success(self, _mock_volume_type, _mock_volume_size): newSize = '2' self.driver.extend_volume(self.data.test_volume, newSize) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'check_if_volume_is_extendable', return_value='False') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_extend_volume_striped_fast_failed(self, _mock_volume_type, _mock_is_extendable): @@ -3948,30 +3948,30 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): self.data.test_volume, newSize) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) @mock.patch.object( emc_vmax_fast.EMCVMAXFast, 'get_pool_associated_to_policy', return_value=1) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_volume_meta_head', - return_value=[EMCVMAXCommonData.test_volume]) + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_meta_members_capacity_in_bit', return_value=[1234567, 7654321]) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + emc_vmax_utils.EMCVMAXUtils, + 'get_volume_meta_head', + return_value=[EMCVMAXCommonData.test_volume]) + @mock.patch.object( + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_snapshot_different_sizes_meta_fast_success( self, mock_volume_type, mock_volume, mock_meta, mock_size, mock_pool, mock_policy): @@ -3994,22 +3994,22 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): self.driver.create_snapshot, self.data.test_volume) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_sync_sv_by_target', - return_value=(None, None)) + 'get_meta_members_capacity_in_bit', + return_value=[1234567]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_meta_head', return_value=[EMCVMAXCommonData.test_volume]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'get_meta_members_capacity_in_bit', - return_value=[1234567]) + 'find_sync_sv_by_target', + return_value=(None, None)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_volume_from_same_size_meta_snapshot( self, mock_volume_type, mock_sync_sv, mock_meta, mock_size): self.data.test_volume['volume_name'] = "vmax-1234567" @@ -4019,21 +4019,20 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): self.data.test_volume, self.data.test_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST', - 'FASTPOLICY': 'FC_GOLD1'}) + emc_vmax_utils.EMCVMAXUtils, + 'find_sync_sv_by_target', + return_value=(None, None)) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'find_replication_service', return_value=None) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_sync_sv_by_target', - return_value=(None, None)) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST', + 'FASTPOLICY': 'FC_GOLD1'}) def test_create_volume_from_snapshot_fast_failed( - self, mock_volume_type, - mock_rep_service, mock_sync_sv): + self, mock_volume_type, mock_rep_service, mock_sync_sv): self.data.test_volume['volume_name'] = "vmax-1234567" self.assertRaises(exception.VolumeBackendAPIException, self.driver.create_volume_from_snapshot, @@ -4041,21 +4040,21 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): EMCVMAXCommonData.test_source_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) + emc_vmax_utils.EMCVMAXUtils, + 'get_volume_meta_head', + return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_storage_sync_sv_sv', return_value=(None, None)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_volume_meta_head', - return_value=None) + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_clone_simple_volume_fast_success( self, mock_volume_type, mock_volume, mock_sync_sv, mock_simple_volume): @@ -4066,29 +4065,29 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): EMCVMAXCommonData.test_source_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_fast.EMCVMAXFast, - 'get_pool_associated_to_policy', - return_value=1) + emc_vmax_utils.EMCVMAXUtils, + 'get_meta_members_capacity_in_bit', + return_value=[1234567, 7654321]) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'get_volume_meta_head', return_value=[EMCVMAXCommonData.test_volume]) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'get_meta_members_capacity_in_bit', - return_value=[1234567, 7654321]) + emc_vmax_fast.EMCVMAXFast, + 'get_pool_associated_to_policy', + return_value=1) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_clone_fast_failed( self, mock_volume_type, mock_vol, mock_policy, mock_meta, mock_size, mock_pool): @@ -4109,105 +4108,105 @@ class EMCVMAXFCDriverFastTestCase(test.TestCase): self.data.test_host) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) + emc_vmax_masking.EMCVMAXMasking, + '_wrap_get_storage_group_from_volume', + return_value=None) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'parse_pool_instance_id', return_value=('silver', 'SYMMETRIX+000195900551')) @mock.patch.object( - emc_vmax_masking.EMCVMAXMasking, - '_wrap_get_storage_group_from_volume', - return_value=None) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_retype_volume_fast_success( self, _mock_volume_type, mock_values, mock_wrap): self.driver.retype( self.data.test_ctxt, self.data.test_volume, self.data.new_type, self.data.diff, self.data.test_host) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_CG_fast_success( self, _mock_volume_type, _mock_storage_system): self.driver.create_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=None) @mock.patch.object( FakeDB, 'volume_get_all_by_group', return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=None) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_delete_CG_no_volumes_fast_success( self, _mock_volume_type, _mock_storage_system, _mock_db_volumes, _mock_members): self.driver.delete_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_delete_CG_with_volumes_fast_success( self, _mock_volume_type, _mock_storage_system): self.driver.delete_consistencygroup( self.data.test_ctxt, self.data.test_CG) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) + emc_vmax_utils.EMCVMAXUtils, + 'find_group_sync_rg_by_target', + return_value="") @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=()) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_consistency_group', return_value=(None, EMCVMAXCommonData.test_CG)) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=()) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_group_sync_rg_by_target', - return_value="") + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_create_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage, _mock_cg, _mock_members, _mock_rg): self.driver.create_cgsnapshot( - self.data.test_ctxt, self.data.test_CG_snapshot) - - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'FCFAST'}) + self.data.test_ctxt, self.data.test_CG_snapshot) + @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'FCFAST'}) def test_delete_snapshot_for_CG_no_fast_success( self, _mock_volume_type, _mock_storage): self.driver.delete_cgsnapshot( @@ -4332,76 +4331,76 @@ class EMCV3DriverTestCase(test.TestCase): @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'find_storageSystem', - return_value=None) + 'isArrayV3', + return_value=True) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'parse_array_name_from_file', return_value="123456789") @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, - 'isArrayV3', - return_value=True) + 'find_storageSystem', + return_value=None) def test_get_volume_stats_v3( self, mock_storage_system, mock_array, mock_is_v3): self.driver.get_volume_stats(True) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) + emc_vmax_provision_v3.EMCVMAXProvisionV3, + '_get_supported_size_range_for_SLO', + return_value={'MaximumVolumeSize': '30000000000', + 'MinimumVolumeSize': '100000'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_provision_v3.EMCVMAXProvisionV3, - '_get_supported_size_range_for_SLO', - return_value={'MaximumVolumeSize': '30000000000', - 'MinimumVolumeSize': '100000'}) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_create_volume_v3_success( self, _mock_volume_type, mock_storage_system, mock_range): self.driver.create_volume(self.data.test_volume_v3) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + emc_vmax_utils.EMCVMAXUtils, + 'parse_slo_from_file', + return_value='NONE') @mock.patch.object( emc_vmax_provision_v3.EMCVMAXProvisionV3, '_get_supported_size_range_for_SLO', return_value={'MaximumVolumeSize': '30000000000', 'MinimumVolumeSize': '100000'}) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'parse_slo_from_file', - return_value='NONE') + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_create_volume_v3_no_slo_success( self, _mock_volume_type, mock_storage_system, mock_range, mock_slo): self.driver.create_volume(self.data.test_volume_v3) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + emc_vmax_utils.EMCVMAXUtils, + 'parse_slo_from_file', + return_value='Bogus') @mock.patch.object( emc_vmax_provision_v3.EMCVMAXProvisionV3, '_get_supported_size_range_for_SLO', return_value={'MaximumVolumeSize': '30000000000', 'MinimumVolumeSize': '100000'}) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'parse_slo_from_file', - return_value='Bogus') + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_create_volume_v3_invalid_slo_failed( self, _mock_volume_type, mock_storage_system, mock_range, mock_slo): @@ -4410,21 +4409,20 @@ class EMCV3DriverTestCase(test.TestCase): self.data.test_volume) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) + emc_vmax_provision_v3.EMCVMAXProvisionV3, + '_get_supported_size_range_for_SLO', + return_value={'MaximumVolumeSize': '30000000000', + 'MinimumVolumeSize': '100000'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_provision_v3.EMCVMAXProvisionV3, - '_get_supported_size_range_for_SLO', - return_value={'MaximumVolumeSize': '30000000000', - 'MinimumVolumeSize': '100000'}) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_create_volume_in_CG_v3_success( - self, _mock_volume_type, mock_storage_system, - mock_range): + self, _mock_volume_type, mock_storage_system, mock_range): self.driver.create_volume(self.data.test_volume_CG) @mock.patch.object( @@ -4434,28 +4432,15 @@ class EMCV3DriverTestCase(test.TestCase): def test_delete_volume_v3_success(self, _mock_volume_type): self.driver.delete_volume(self.data.test_volume) - @mock.patch.object( - FakeDB, - 'volume_get', - return_value=EMCVMAXCommonData.test_source_volume) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( emc_vmax_provision_v3.EMCVMAXProvisionV3, '_get_supported_size_range_for_SLO', return_value={'MaximumVolumeSize': '30000000000', 'MinimumVolumeSize': '100000'}) - def test_create_snapshot_v3_success( - self, mock_volume_db, mock_type, moke_pool, mock_siz): - self.data.test_volume['volume_name'] = "vmax-1234567" - self.driver.create_snapshot(self.data.test_volume) - + @mock.patch.object( + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( volume_types, 'get_volume_type_extra_specs', @@ -4464,10 +4449,10 @@ class EMCV3DriverTestCase(test.TestCase): FakeDB, 'volume_get', return_value=EMCVMAXCommonData.test_source_volume) - def test_delete_snapshot_v3_success( - self, mock_volume_type, mock_db): + def test_create_snapshot_v3_success( + self, mock_volume_db, mock_type, moke_pool, mock_siz): self.data.test_volume['volume_name'] = "vmax-1234567" - self.driver.delete_snapshot(self.data.test_volume) + self.driver.create_snapshot(self.data.test_volume) @mock.patch.object( FakeDB, @@ -4477,15 +4462,27 @@ class EMCV3DriverTestCase(test.TestCase): volume_types, 'get_volume_type_extra_specs', return_value={'volume_backend_name': 'V3_BE'}) - @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + def test_delete_snapshot_v3_success(self, mock_volume_type, mock_db): + self.data.test_volume['volume_name'] = "vmax-1234567" + self.driver.delete_snapshot(self.data.test_volume) + @mock.patch.object( emc_vmax_provision_v3.EMCVMAXProvisionV3, '_get_supported_size_range_for_SLO', return_value={'MaximumVolumeSize': '30000000000', 'MinimumVolumeSize': '100000'}) + @mock.patch.object( + emc_vmax_common.EMCVMAXCommon, + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) + @mock.patch.object( + FakeDB, + 'volume_get', + return_value=EMCVMAXCommonData.test_source_volume) def test_create_cloned_volume_v3_success( self, mock_volume_db, mock_type, moke_pool, mock_size): self.data.test_volume['volume_name'] = "vmax-1234567" @@ -4515,49 +4512,49 @@ class EMCV3DriverTestCase(test.TestCase): self.driver.create_cloned_volume(cloneVol, self.data.test_volume) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_create_CG_v3_success( self, _mock_volume_type, _mock_storage_system): self.driver.create_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=None) @mock.patch.object( FakeDB, 'volume_get_all_by_group', return_value=None) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=None) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_delete_CG_no_volumes_v3_success( self, _mock_volume_type, _mock_storage_system, _mock_db_volumes, _mock_members): self.driver.delete_consistencygroup( self.data.test_ctxt, self.data.test_CG) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_delete_CG_with_volumes_v3_success( self, _mock_volume_type, _mock_storage_system): self.driver.delete_consistencygroup( @@ -4572,21 +4569,21 @@ class EMCV3DriverTestCase(test.TestCase): self.data.test_host) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) - @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - '_get_fast_settings_from_storage_group', - return_value='Gold+DSS_REP') + emc_vmax_provision_v3.EMCVMAXProvisionV3, + '_find_new_storage_group', + return_value='Any') @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, 'wrap_get_storage_group_from_volume', return_value=None) @mock.patch.object( - emc_vmax_provision_v3.EMCVMAXProvisionV3, - '_find_new_storage_group', - return_value='Any') + emc_vmax_utils.EMCVMAXUtils, + '_get_fast_settings_from_storage_group', + return_value='Gold+DSS_REP') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_retype_volume_v3_success( self, _mock_volume_type, mock_fast_settings, mock_storage_group, mock_found_SG): @@ -4594,14 +4591,14 @@ class EMCV3DriverTestCase(test.TestCase): self.data.test_ctxt, self.data.test_volume, self.data.new_type, self.data.diff, self.data.test_host_v3)) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) @mock.patch.object( emc_vmax_utils.EMCVMAXUtils, '_get_fast_settings_from_storage_group', return_value='Bronze+DSS') + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_retype_volume_same_host_failure( self, _mock_volume_type, mock_fast_settings): self.assertFalse(self.driver.retype( @@ -4609,25 +4606,25 @@ class EMCV3DriverTestCase(test.TestCase): self.data.diff, self.data.test_host_v3)) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) + emc_vmax_utils.EMCVMAXUtils, + 'find_group_sync_rg_by_target', + return_value=1) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_pool_and_storage_system', - return_value=(None, EMCVMAXCommonData.storage_system)) + '_get_members_of_replication_group', + return_value=()) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_find_consistency_group', return_value=(None, EMCVMAXCommonData.test_CG)) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, - '_get_members_of_replication_group', - return_value=()) + '_get_pool_and_storage_system', + return_value=(None, EMCVMAXCommonData.storage_system)) @mock.patch.object( - emc_vmax_utils.EMCVMAXUtils, - 'find_group_sync_rg_by_target', - return_value=1) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_create_cgsnapshot_v3_success( self, _mock_volume_type, _mock_storage, _mock_cg, _mock_members, mock_rg): @@ -4642,31 +4639,31 @@ class EMCV3DriverTestCase(test.TestCase): (None, EMCVMAXCommonData.test_CG), '12de', EMCVMAXCommonData.extra_specs) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, '_get_pool_and_storage_system', return_value=(None, EMCVMAXCommonData.storage_system)) + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_delete_cgsnapshot_v3_success( self, _mock_volume_type, _mock_storage): self.driver.delete_cgsnapshot( self.data.test_ctxt, self.data.test_CG_snapshot) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) + emc_vmax_common.EMCVMAXCommon, + '_is_same_host', + return_value=True) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, 'get_masking_view_from_storage_group', return_value=EMCVMAXCommonData.lunmaskctrl_name) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - '_is_same_host', - return_value=True) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_map_v3_success( self, _mock_volume_type, mock_maskingview, mock_is_same_host): common = self.driver.common @@ -4680,40 +4677,40 @@ class EMCV3DriverTestCase(test.TestCase): for init, target in data['data']['initiator_target_map'].items(): self.assertIn(init[::-1], target) - @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) @mock.patch.object( emc_vmax_common.EMCVMAXCommon, 'find_device_number', return_value={'Name': "0001"}) - def test_map_v3_failed(self, mock_wrap_group, mock_maskingview): + @mock.patch.object( + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) + def test_map_v3_failed(self, _mock_volume_type, mock_wrap_device): self.assertRaises(exception.VolumeBackendAPIException, self.driver.initialize_connection, self.data.test_volume, self.data.connector) @mock.patch.object( - volume_types, - 'get_volume_type_extra_specs', - return_value={'volume_backend_name': 'V3_BE'}) + emc_vmax_common.EMCVMAXCommon, + 'get_masking_views_by_port_group', + return_value=[]) @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_masking_view_from_storage_group', - return_value=EMCVMAXCommonData.lunmaskctrl_name) + 'get_initiator_group_from_masking_view', + return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, '_find_initiator_masking_group', return_value='myInitGroup') @mock.patch.object( emc_vmax_masking.EMCVMAXMasking, - 'get_initiator_group_from_masking_view', - return_value='myInitGroup') + 'get_masking_view_from_storage_group', + return_value=EMCVMAXCommonData.lunmaskctrl_name) @mock.patch.object( - emc_vmax_common.EMCVMAXCommon, - 'get_masking_views_by_port_group', - return_value=[]) + volume_types, + 'get_volume_type_extra_specs', + return_value={'volume_backend_name': 'V3_BE'}) def test_detach_v3_success(self, mock_volume_type, mock_maskingview, mock_ig, mock_igc, mock_mv): common = self.driver.common