Merge "NetApp: Remove type checks from manage workflow"
This commit is contained in:
commit
4789ffc2e1
@ -17,7 +17,6 @@
|
||||
import itertools
|
||||
import os
|
||||
import shutil
|
||||
import unittest
|
||||
|
||||
from lxml import etree
|
||||
import mock
|
||||
@ -886,19 +885,6 @@ class NetAppCmodeNfsDriverTestCase(test.TestCase):
|
||||
configuration.nfs_shares_config = '/nfs'
|
||||
return configuration
|
||||
|
||||
@mock.patch.object(utils, 'get_volume_extra_specs')
|
||||
def test_check_volume_type_mismatch(self, get_specs):
|
||||
if not hasattr(self._driver, 'vserver'):
|
||||
return unittest.skip("Test only applies to cmode driver")
|
||||
get_specs.return_value = {'thin_volume': 'true'}
|
||||
self._driver._is_share_vol_type_match = mock.Mock(return_value=False)
|
||||
self.assertRaises(exception.ManageExistingVolumeTypeMismatch,
|
||||
self._driver._check_volume_type, 'vol',
|
||||
'share', 'file')
|
||||
get_specs.assert_called_once_with('vol')
|
||||
self._driver._is_share_vol_type_match.assert_called_once_with(
|
||||
'vol', 'share', 'file')
|
||||
|
||||
@mock.patch.object(client_base.Client, 'get_ontapi_version',
|
||||
mock.Mock(return_value=(1, 20)))
|
||||
@mock.patch.object(nfs_base.NetAppNfsDriver, 'do_setup', mock.Mock())
|
||||
|
@ -562,9 +562,9 @@ class NetAppBlockStorageLibraryTestCase(test.TestCase):
|
||||
self.assertEqual(1, log.call_count)
|
||||
|
||||
def test_check_vol_type_for_lun(self):
|
||||
self.assertRaises(NotImplementedError,
|
||||
self.library._check_volume_type_for_lun,
|
||||
'vol', 'lun', 'existing_ref', {})
|
||||
result = self.library._check_volume_type_for_lun(
|
||||
'vol', 'lun', 'existing_ref', {})
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_is_lun_valid_on_storage(self):
|
||||
self.assertTrue(self.library._is_lun_valid_on_storage('lun'))
|
||||
|
@ -283,22 +283,6 @@ class NetAppBlockStorageCmodeLibraryTestCase(test.TestCase):
|
||||
None)
|
||||
self.assertEqual(1, self.library._update_stale_vols.call_count)
|
||||
|
||||
@mock.patch.object(ssc_cmode, 'get_volumes_for_specs')
|
||||
@mock.patch.object(ssc_cmode, 'get_cluster_latest_ssc')
|
||||
def test_check_volume_type_for_lun_fail(self, get_ssc, get_vols):
|
||||
self.library.ssc_vols = ['vol']
|
||||
fake_extra_specs = {'specs': 's'}
|
||||
get_vols.return_value = [ssc_cmode.NetAppVolume(name='name',
|
||||
vserver='vs')]
|
||||
mock_lun = block_base.NetAppLun('handle', 'name', '1',
|
||||
{'Volume': 'fake', 'Path': '/vol/lun'})
|
||||
self.assertRaises(exception.ManageExistingVolumeTypeMismatch,
|
||||
self.library._check_volume_type_for_lun,
|
||||
{'vol': 'vol'}, mock_lun, {'ref': 'ref'},
|
||||
fake_extra_specs)
|
||||
get_vols.assert_called_with(['vol'], {'specs': 's'})
|
||||
self.assertEqual(1, get_ssc.call_count)
|
||||
|
||||
def test_get_preferred_target_from_list(self):
|
||||
target_details_list = fake.ISCSI_TARGET_DETAILS_LIST
|
||||
operational_addresses = [
|
||||
|
@ -638,8 +638,7 @@ class NetAppBlockStorageLibrary(object):
|
||||
|
||||
def _check_volume_type_for_lun(self, volume, lun, existing_ref,
|
||||
extra_specs):
|
||||
"""Checks if lun satifies the volume type."""
|
||||
raise NotImplementedError()
|
||||
"""Checks if LUN satisfies the volume type."""
|
||||
|
||||
def manage_existing(self, volume, existing_ref):
|
||||
"""Brings an existing storage object under Cinder management.
|
||||
|
@ -348,30 +348,6 @@ class NetAppBlockStorageCmodeLibrary(block_base.NetAppBlockStorageLibrary):
|
||||
self._update_stale_vols(
|
||||
volume=ssc_cmode.NetAppVolume(netapp_vol, self.vserver))
|
||||
|
||||
def _check_volume_type_for_lun(self, volume, lun, existing_ref,
|
||||
extra_specs):
|
||||
"""Check if LUN satisfies volume type."""
|
||||
def scan_ssc_data():
|
||||
volumes = ssc_cmode.get_volumes_for_specs(self.ssc_vols,
|
||||
extra_specs)
|
||||
for vol in volumes:
|
||||
if lun.get_metadata_property('Volume') == vol.id['name']:
|
||||
return True
|
||||
return False
|
||||
|
||||
match_read = scan_ssc_data()
|
||||
if not match_read:
|
||||
ssc_cmode.get_cluster_latest_ssc(
|
||||
self, self.zapi_client.get_connection(), self.vserver)
|
||||
match_read = scan_ssc_data()
|
||||
|
||||
if not match_read:
|
||||
raise exception.ManageExistingVolumeTypeMismatch(
|
||||
reason=(_("LUN with given ref %(ref)s does not satisfy volume"
|
||||
" type. Ensure LUN volume with ssc features is"
|
||||
" present on vserver %(vs)s.")
|
||||
% {'ref': existing_ref, 'vs': self.vserver}))
|
||||
|
||||
def _get_preferred_target_from_list(self, target_details_list,
|
||||
filter=None):
|
||||
# cDOT iSCSI LIFs do not migrate from controller to controller
|
||||
|
@ -817,7 +817,6 @@ class NetAppNfsDriver(driver.ManageableVD,
|
||||
|
||||
def _check_volume_type(self, volume, share, file_name, extra_specs):
|
||||
"""Match volume type for share file."""
|
||||
raise NotImplementedError()
|
||||
|
||||
def _convert_vol_ref_share_name_to_share_ip(self, vol_ref):
|
||||
"""Converts the share point name to an IP address
|
||||
|
@ -122,13 +122,6 @@ class NetAppCmodeNfsDriver(nfs_base.NetAppNfsDriver):
|
||||
qos_policy_group_name,
|
||||
target_path)
|
||||
|
||||
def _check_volume_type(self, volume, share, file_name, extra_specs):
|
||||
"""Match volume type for share file."""
|
||||
if not self._is_share_vol_type_match(volume, share):
|
||||
raise exception.ManageExistingVolumeTypeMismatch(
|
||||
reason=(_("Volume type does not match for share %s."),
|
||||
share))
|
||||
|
||||
def _clone_backing_file_for_volume(self, volume_name, clone_name,
|
||||
volume_id, share=None):
|
||||
"""Clone backing file for Cinder volume."""
|
||||
|
Loading…
Reference in New Issue
Block a user