Merge "Huawei: Manage volume fails due to lower array version"

This commit is contained in:
Jenkins 2016-03-03 01:35:46 +00:00 committed by Gerrit Code Review
commit 97b2df7ad7
2 changed files with 24 additions and 3 deletions

View File

@ -2415,6 +2415,28 @@ class HuaweiISCSIDriverTestCase(test.TestCase):
test_volume, external_ref)
self.assertIsNotNone(re.search('HyperMetroPair', ex.msg))
@mock.patch.object(rest_client.RestClient, 'get_hypermetro_pairs')
@mock.patch.object(rest_client.RestClient, 'rename_lun')
@mock.patch.object(rest_client.RestClient, 'get_lun_info',
return_value={'CAPACITY': 2097152,
'ID': 'ID1',
'PARENTNAME': 'StoragePool001',
'HEALTHSTATUS': constants.STATUS_HEALTH})
@mock.patch.object(rest_client.RestClient, 'get_lun_id_by_name',
return_value='ID1')
def test_manage_existing_with_lower_version(self, mock_get_by_name,
mock_get_info, mock_rename,
mock_get_hyper_pairs):
test_volume = {'host': 'ubuntu-204@v3r3#StoragePool001',
'id': '21ec7341-9256-497b-97d9-ef48edcf0635',
'name': 'volume-21ec7341-9256-497b-97d9-ef48edcf'}
mock_get_hyper_pairs.side_effect = (
exception.VolumeBackendAPIException(data='err'))
external_ref = {'source-name': 'LUN1'}
model_update = self.driver.manage_existing(test_volume,
external_ref)
self.assertEqual({'provider_location': 'ID1'}, model_update)
@ddt.data([[{'PRILUNID': 'ID1'}], []],
[[{'PRILUNID': 'ID2'}], ['ID1', 'ID2']])
@mock.patch.object(rest_client.RestClient, 'get_lun_info',

View File

@ -1081,9 +1081,8 @@ class HuaweiBaseDriver(driver.VolumeDriver):
try:
hypermetro_pairs = self.client.get_hypermetro_pairs()
except exception.VolumeBackendAPIException:
msg = _("Failed to get HyperMetroPair.")
raise exception.ManageExistingInvalidReference(
existing_ref=external_ref, reason=msg)
hypermetro_pairs = []
LOG.debug("Can't get hypermetro info, pass the check.")
for pair in hypermetro_pairs:
if pair.get('LOCALOBJID') == lun_id: