Merge "move solidfire driver exceptions"
This commit is contained in:
commit
eec04de2d9
@ -676,10 +676,6 @@ class ImageLimitExceeded(QuotaError):
|
|||||||
message = _("Image quota exceeded")
|
message = _("Image quota exceeded")
|
||||||
|
|
||||||
|
|
||||||
class DuplicateSfVolumeNames(Duplicate):
|
|
||||||
message = _("Detected more than one volume with name %(vol_name)s")
|
|
||||||
|
|
||||||
|
|
||||||
class VolumeTypeCreateFailed(CinderException):
|
class VolumeTypeCreateFailed(CinderException):
|
||||||
message = _("Cannot create volume_type with "
|
message = _("Cannot create volume_type with "
|
||||||
"name %(name)s and specs %(extra_specs)s")
|
"name %(name)s and specs %(extra_specs)s")
|
||||||
@ -976,28 +972,6 @@ class RBDDriverException(VolumeDriverException):
|
|||||||
message = _("RBD Cinder driver failure: %(reason)s")
|
message = _("RBD Cinder driver failure: %(reason)s")
|
||||||
|
|
||||||
|
|
||||||
# SolidFire
|
|
||||||
class SolidFireAPIException(VolumeBackendAPIException):
|
|
||||||
message = _("Bad response from SolidFire API")
|
|
||||||
|
|
||||||
|
|
||||||
class SolidFireDriverException(VolumeDriverException):
|
|
||||||
message = _("SolidFire Cinder Driver exception")
|
|
||||||
|
|
||||||
|
|
||||||
class SolidFireAPIDataException(SolidFireAPIException):
|
|
||||||
message = _("Error in SolidFire API response: data=%(data)s")
|
|
||||||
|
|
||||||
|
|
||||||
class SolidFireAccountNotFound(SolidFireDriverException):
|
|
||||||
message = _("Unable to locate account %(account_name)s on "
|
|
||||||
"Solidfire device")
|
|
||||||
|
|
||||||
|
|
||||||
class SolidFireRetryableException(VolumeBackendAPIException):
|
|
||||||
message = _("Retryable SolidFire Exception encountered")
|
|
||||||
|
|
||||||
|
|
||||||
# HP 3Par
|
# HP 3Par
|
||||||
class Invalid3PARDomain(VolumeDriverException):
|
class Invalid3PARDomain(VolumeDriverException):
|
||||||
message = _("Invalid 3PAR Domain: %(err)s")
|
message = _("Invalid 3PAR Domain: %(err)s")
|
||||||
|
@ -326,7 +326,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
'id': 1}
|
'id': 1}
|
||||||
msg = ('Error (%s) encountered during '
|
msg = ('Error (%s) encountered during '
|
||||||
'SolidFire API call.' % response['error']['name'])
|
'SolidFire API call.' % response['error']['name'])
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
def fake_set_qos_by_volume_type(self, type_id, ctxt):
|
def fake_set_qos_by_volume_type(self, type_id, ctxt):
|
||||||
return {'minIOPS': 500,
|
return {'minIOPS': 500,
|
||||||
@ -602,7 +602,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
self.mock_object(solidfire.SolidFireDriver,
|
self.mock_object(solidfire.SolidFireDriver,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
self.fake_issue_api_request_fails)
|
self.fake_issue_api_request_fails)
|
||||||
self.assertRaises(exception.SolidFireAPIException,
|
self.assertRaises(solidfire.SolidFireAPIException,
|
||||||
sfv._create_sfaccount, 'project-id')
|
sfv._create_sfaccount, 'project-id')
|
||||||
|
|
||||||
def test_get_sfaccounts_for_tenant(self):
|
def test_get_sfaccounts_for_tenant(self):
|
||||||
@ -618,7 +618,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
self.mock_object(solidfire.SolidFireDriver,
|
self.mock_object(solidfire.SolidFireDriver,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
self.fake_issue_api_request_fails)
|
self.fake_issue_api_request_fails)
|
||||||
self.assertRaises(exception.SolidFireAPIException,
|
self.assertRaises(solidfire.SolidFireAPIException,
|
||||||
sfv._get_sfaccounts_for_tenant, 'some-name')
|
sfv._get_sfaccounts_for_tenant, 'some-name')
|
||||||
|
|
||||||
def test_get_sfaccount_by_name(self):
|
def test_get_sfaccount_by_name(self):
|
||||||
@ -700,7 +700,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
'_get_volumes_for_account',
|
'_get_volumes_for_account',
|
||||||
return_value=get_vol_result):
|
return_value=get_vol_result):
|
||||||
sfaccount = sfv._get_account_create_availability(fake_sfaccounts)
|
sfaccount = sfv._get_account_create_availability(fake_sfaccounts)
|
||||||
self.assertRaises(exception.SolidFireDriverException,
|
self.assertRaises(solidfire.SolidFireDriverException,
|
||||||
sfv._get_create_account, sfaccount)
|
sfv._get_create_account, sfaccount)
|
||||||
|
|
||||||
def test_get_sfaccount_by_name_fails(self):
|
def test_get_sfaccount_by_name_fails(self):
|
||||||
@ -708,7 +708,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
self.mock_object(solidfire.SolidFireDriver,
|
self.mock_object(solidfire.SolidFireDriver,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
self.fake_issue_api_request_fails)
|
self.fake_issue_api_request_fails)
|
||||||
self.assertRaises(exception.SolidFireAPIException,
|
self.assertRaises(solidfire.SolidFireAPIException,
|
||||||
sfv._get_sfaccount_by_name, 'some-name')
|
sfv._get_sfaccount_by_name, 'some-name')
|
||||||
|
|
||||||
def test_get_sfvol_by_cinder_vref_no_provider_id(self):
|
def test_get_sfvol_by_cinder_vref_no_provider_id(self):
|
||||||
@ -984,7 +984,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
self.mock_object(solidfire.SolidFireDriver,
|
self.mock_object(solidfire.SolidFireDriver,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
self.fake_issue_api_request_fails)
|
self.fake_issue_api_request_fails)
|
||||||
self.assertRaises(exception.SolidFireAPIException,
|
self.assertRaises(solidfire.SolidFireAPIException,
|
||||||
sfv.extend_volume,
|
sfv.extend_volume,
|
||||||
testvol, 2)
|
testvol, 2)
|
||||||
|
|
||||||
@ -1429,7 +1429,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def _fake_issue_api_req(method, params, version=0):
|
def _fake_issue_api_req(method, params, version=0):
|
||||||
if 'GetAccountByName' in method:
|
if 'GetAccountByName' in method:
|
||||||
raise exception.SolidFireAPIException
|
raise solidfire.SolidFireAPIException
|
||||||
return {'result': {'accountID': 1}}
|
return {'result': {'accountID': 1}}
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
@ -1759,7 +1759,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xExceededLimit: {}'.format(params['initiators'][0])
|
msg = 'xExceededLimit: {}'.format(params['initiators'][0])
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1783,7 +1783,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xExceededLimit'
|
msg = 'xExceededLimit'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1806,7 +1806,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xAlreadyInVolumeAccessGroup'
|
msg = 'xAlreadyInVolumeAccessGroup'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1822,7 +1822,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xVolumeAccessGroupIDDoesNotExist'
|
msg = 'xVolumeAccessGroupIDDoesNotExist'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1843,7 +1843,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xAlreadyInVolumeAccessGroup'
|
msg = 'xAlreadyInVolumeAccessGroup'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1860,7 +1860,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xVolumeAccessGroupIDDoesNotExist'
|
msg = 'xVolumeAccessGroupIDDoesNotExist'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1880,7 +1880,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xNotInVolumeAccessGroup'
|
msg = 'xNotInVolumeAccessGroup'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1895,7 +1895,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xVolumeAccessGroupIDDoesNotExist'
|
msg = 'xVolumeAccessGroupIDDoesNotExist'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
@ -1910,12 +1910,12 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def throw_request(method, params, version):
|
def throw_request(method, params, version):
|
||||||
msg = 'xUnknownException'
|
msg = 'xUnknownException'
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise solidfire.SolidFireAPIException(message=msg)
|
||||||
|
|
||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_issue_api_request',
|
'_issue_api_request',
|
||||||
side_effect=throw_request):
|
side_effect=throw_request):
|
||||||
self.assertRaises(exception.SolidFireAPIException,
|
self.assertRaises(solidfire.SolidFireAPIException,
|
||||||
sfv._remove_volume_from_vag,
|
sfv._remove_volume_from_vag,
|
||||||
vol_id,
|
vol_id,
|
||||||
vag_id)
|
vag_id)
|
||||||
@ -2022,7 +2022,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
with mock.patch.object(sfv,
|
with mock.patch.object(sfv,
|
||||||
'_get_all_active_volumes',
|
'_get_all_active_volumes',
|
||||||
return_value=active_vols):
|
return_value=active_vols):
|
||||||
self.assertRaises(exception.SolidFireDriverException,
|
self.assertRaises(solidfire.SolidFireDriverException,
|
||||||
sfv._group_snapshot_creator,
|
sfv._group_snapshot_creator,
|
||||||
gsnap_name,
|
gsnap_name,
|
||||||
vol_uuids)
|
vol_uuids)
|
||||||
@ -2084,7 +2084,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
||||||
with mock.patch.object(sfv, '_get_group_snapshot_by_name',
|
with mock.patch.object(sfv, '_get_group_snapshot_by_name',
|
||||||
return_value=None):
|
return_value=None):
|
||||||
self.assertRaises(exception.SolidFireDriverException,
|
self.assertRaises(solidfire.SolidFireDriverException,
|
||||||
sfv._delete_cgsnapshot_by_name,
|
sfv._delete_cgsnapshot_by_name,
|
||||||
'does not matter')
|
'does not matter')
|
||||||
|
|
||||||
@ -2197,7 +2197,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
return_value=active_vols),\
|
return_value=active_vols),\
|
||||||
mock.patch.object(sfv,
|
mock.patch.object(sfv,
|
||||||
'_sf_create_group_snapshot'):
|
'_sf_create_group_snapshot'):
|
||||||
self.assertRaises(exception.SolidFireDriverException,
|
self.assertRaises(solidfire.SolidFireDriverException,
|
||||||
sfv._create_cgsnapshot,
|
sfv._create_cgsnapshot,
|
||||||
ctxt,
|
ctxt,
|
||||||
cgsnapshot,
|
cgsnapshot,
|
||||||
@ -2438,7 +2438,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
|
|
||||||
def test_pythons_try_except(self):
|
def test_pythons_try_except(self):
|
||||||
def _fake_retrieve_rep(vol):
|
def _fake_retrieve_rep(vol):
|
||||||
raise exception.SolidFireAPIException
|
raise solidfire.SolidFireAPIException
|
||||||
|
|
||||||
fake_type = {'extra_specs': {}}
|
fake_type = {'extra_specs': {}}
|
||||||
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
sfv = solidfire.SolidFireDriver(configuration=self.configuration)
|
||||||
@ -2457,7 +2457,7 @@ class SolidFireVolumeTestCase(test.TestCase):
|
|||||||
mock.patch.object(sfv,
|
mock.patch.object(sfv,
|
||||||
'_retrieve_replication_settings',
|
'_retrieve_replication_settings',
|
||||||
side_effect=_fake_retrieve_rep):
|
side_effect=_fake_retrieve_rep):
|
||||||
self.assertRaises(exception.SolidFireAPIException,
|
self.assertRaises(solidfire.SolidFireAPIException,
|
||||||
sfv.create_volume,
|
sfv.create_volume,
|
||||||
self.mock_volume)
|
self.mock_volume)
|
||||||
|
|
||||||
|
@ -115,6 +115,31 @@ xVolumeAccessGroupIDDoesNotExist = 'xVolumeAccessGroupIDDoesNotExist'
|
|||||||
xNotInVolumeAccessGroup = 'xNotInVolumeAccessGroup'
|
xNotInVolumeAccessGroup = 'xNotInVolumeAccessGroup'
|
||||||
|
|
||||||
|
|
||||||
|
class DuplicateSfVolumeNames(exception.Duplicate):
|
||||||
|
message = _("Detected more than one volume with name %(vol_name)s")
|
||||||
|
|
||||||
|
|
||||||
|
class SolidFireAPIException(exception.VolumeBackendAPIException):
|
||||||
|
message = _("Bad response from SolidFire API")
|
||||||
|
|
||||||
|
|
||||||
|
class SolidFireDriverException(exception.VolumeDriverException):
|
||||||
|
message = _("SolidFire Cinder Driver exception")
|
||||||
|
|
||||||
|
|
||||||
|
class SolidFireAPIDataException(SolidFireAPIException):
|
||||||
|
message = _("Error in SolidFire API response: data=%(data)s")
|
||||||
|
|
||||||
|
|
||||||
|
class SolidFireAccountNotFound(SolidFireDriverException):
|
||||||
|
message = _("Unable to locate account %(account_name)s on "
|
||||||
|
"Solidfire device")
|
||||||
|
|
||||||
|
|
||||||
|
class SolidFireRetryableException(exception.VolumeBackendAPIException):
|
||||||
|
message = _("Retryable SolidFire Exception encountered")
|
||||||
|
|
||||||
|
|
||||||
def retry(exc_tuple, tries=5, delay=1, backoff=2):
|
def retry(exc_tuple, tries=5, delay=1, backoff=2):
|
||||||
def retry_dec(f):
|
def retry_dec(f):
|
||||||
@six.wraps(f)
|
@six.wraps(f)
|
||||||
@ -137,7 +162,7 @@ def retry(exc_tuple, tries=5, delay=1, backoff=2):
|
|||||||
msg = (_('Retry count exceeded for command: %s') %
|
msg = (_('Retry count exceeded for command: %s') %
|
||||||
(args[1],))
|
(args[1],))
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.SolidFireAPIException(message=msg)
|
raise SolidFireAPIException(message=msg)
|
||||||
return func_retry
|
return func_retry
|
||||||
return retry_dec
|
return retry_dec
|
||||||
|
|
||||||
@ -237,7 +262,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
'maxIOPS': 200000,
|
'maxIOPS': 200000,
|
||||||
'burstIOPS': 200000}
|
'burstIOPS': 200000}
|
||||||
cluster_stats = {}
|
cluster_stats = {}
|
||||||
retry_exc_tuple = (exception.SolidFireRetryableException,
|
retry_exc_tuple = (SolidFireRetryableException,
|
||||||
requests.exceptions.ConnectionError)
|
requests.exceptions.ConnectionError)
|
||||||
retryable_errors = ['xDBVersionMismatch',
|
retryable_errors = ['xDBVersionMismatch',
|
||||||
'xMaxSnapshotsPerVolumeExceeded',
|
'xMaxSnapshotsPerVolumeExceeded',
|
||||||
@ -283,7 +308,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
# an endpoint to issue_api_request if needed
|
# an endpoint to issue_api_request if needed
|
||||||
try:
|
try:
|
||||||
self._update_cluster_status()
|
self._update_cluster_status()
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if self.configuration.sf_allow_template_caching:
|
if self.configuration.sf_allow_template_caching:
|
||||||
@ -324,7 +349,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
{'clusterPairingKey': pairing_info['clusterPairingKey']},
|
{'clusterPairingKey': pairing_info['clusterPairingKey']},
|
||||||
version='8.0',
|
version='8.0',
|
||||||
endpoint=remote_device['endpoint'])['result']['clusterPairID']
|
endpoint=remote_device['endpoint'])['result']['clusterPairID']
|
||||||
except exception.SolidFireAPIException as ex:
|
except SolidFireAPIException as ex:
|
||||||
if 'xPairingAlreadExists' in ex.msg:
|
if 'xPairingAlreadExists' in ex.msg:
|
||||||
LOG.debug('Pairing already exists during init.')
|
LOG.debug('Pairing already exists during init.')
|
||||||
else:
|
else:
|
||||||
@ -483,7 +508,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
id = self._issue_api_request(
|
id = self._issue_api_request(
|
||||||
'GetAccountByName',
|
'GetAccountByName',
|
||||||
{'username': account_name})['result']['account']['accountID']
|
{'username': account_name})['result']['account']['accountID']
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
chap_secret = self._generate_random_string(12)
|
chap_secret = self._generate_random_string(12)
|
||||||
params = {'username': account_name,
|
params = {'username': account_name,
|
||||||
'initiatorSecret': chap_secret,
|
'initiatorSecret': chap_secret,
|
||||||
@ -538,11 +563,11 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
'SolidFire API call.' % response['error']['name'])
|
'SolidFire API call.' % response['error']['name'])
|
||||||
LOG.debug(msg)
|
LOG.debug(msg)
|
||||||
LOG.debug("API response: %s", response)
|
LOG.debug("API response: %s", response)
|
||||||
raise exception.SolidFireRetryableException(message=msg)
|
raise SolidFireRetryableException(message=msg)
|
||||||
|
|
||||||
if 'error' in response:
|
if 'error' in response:
|
||||||
msg = _('API response: %s') % response
|
msg = _('API response: %s') % response
|
||||||
raise exception.SolidFireAPIException(msg)
|
raise SolidFireAPIException(msg)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@ -624,7 +649,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
if 'result' in data and 'account' in data['result']:
|
if 'result' in data and 'account' in data['result']:
|
||||||
LOG.debug('Found solidfire account: %s', sf_account_name)
|
LOG.debug('Found solidfire account: %s', sf_account_name)
|
||||||
sfaccount = data['result']['account']
|
sfaccount = data['result']['account']
|
||||||
except exception.SolidFireAPIException as ex:
|
except SolidFireAPIException as ex:
|
||||||
if 'xUnknownAccount' in ex.msg:
|
if 'xUnknownAccount' in ex.msg:
|
||||||
return sfaccount
|
return sfaccount
|
||||||
else:
|
else:
|
||||||
@ -642,7 +667,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
sf_account_name = self._get_sf_account_name(project_id)
|
sf_account_name = self._get_sf_account_name(project_id)
|
||||||
sfaccount = self._get_sfaccount_by_name(sf_account_name)
|
sfaccount = self._get_sfaccount_by_name(sf_account_name)
|
||||||
if sfaccount is None:
|
if sfaccount is None:
|
||||||
raise exception.SolidFireAccountNotFound(
|
raise SolidFireAccountNotFound(
|
||||||
account_name=sf_account_name)
|
account_name=sf_account_name)
|
||||||
|
|
||||||
return sfaccount
|
return sfaccount
|
||||||
@ -770,7 +795,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
data = self._issue_api_request('CloneVolume', params, version='6.0')
|
data = self._issue_api_request('CloneVolume', params, version='6.0')
|
||||||
if (('result' not in data) or ('volumeID' not in data['result'])):
|
if (('result' not in data) or ('volumeID' not in data['result'])):
|
||||||
msg = _("API response: %s") % data
|
msg = _("API response: %s") % data
|
||||||
raise exception.SolidFireAPIException(msg)
|
raise SolidFireAPIException(msg)
|
||||||
|
|
||||||
sf_volume_id = data['result']['volumeID']
|
sf_volume_id = data['result']['volumeID']
|
||||||
|
|
||||||
@ -792,7 +817,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
model_update = self._get_model_info(sf_account, sf_volume_id)
|
model_update = self._get_model_info(sf_account, sf_volume_id)
|
||||||
if model_update is None:
|
if model_update is None:
|
||||||
mesg = _('Failed to get model update from clone')
|
mesg = _('Failed to get model update from clone')
|
||||||
raise exception.SolidFireAPIException(mesg)
|
raise SolidFireAPIException(mesg)
|
||||||
|
|
||||||
# Increment the usage count, just for data collection
|
# Increment the usage count, just for data collection
|
||||||
# We're only doing this for clones, not create_from snaps
|
# We're only doing this for clones, not create_from snaps
|
||||||
@ -965,7 +990,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
LOG.error("Found %(count)s volumes mapped to id: %(uuid)s.",
|
LOG.error("Found %(count)s volumes mapped to id: %(uuid)s.",
|
||||||
{'count': found_count,
|
{'count': found_count,
|
||||||
'uuid': uuid})
|
'uuid': uuid})
|
||||||
raise exception.DuplicateSfVolumeNames(vol_name=uuid)
|
raise DuplicateSfVolumeNames(vol_name=uuid)
|
||||||
|
|
||||||
return sf_volref
|
return sf_volref
|
||||||
|
|
||||||
@ -1153,7 +1178,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
if not sf_account:
|
if not sf_account:
|
||||||
msg = _('Volumes/account exceeded on both primary and '
|
msg = _('Volumes/account exceeded on both primary and '
|
||||||
'secondary SolidFire accounts.')
|
'secondary SolidFire accounts.')
|
||||||
raise exception.SolidFireDriverException(msg)
|
raise SolidFireDriverException(msg)
|
||||||
return sf_account
|
return sf_account
|
||||||
|
|
||||||
def _create_vag(self, iqn, vol_id=None):
|
def _create_vag(self, iqn, vol_id=None):
|
||||||
@ -1171,7 +1196,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
params,
|
params,
|
||||||
version='7.0')
|
version='7.0')
|
||||||
return result['result']['volumeAccessGroupID']
|
return result['result']['volumeAccessGroupID']
|
||||||
except exception.SolidFireAPIException as error:
|
except SolidFireAPIException as error:
|
||||||
if xExceededLimit in error.msg:
|
if xExceededLimit in error.msg:
|
||||||
if iqn in error.msg:
|
if iqn in error.msg:
|
||||||
# Initiator double registered.
|
# Initiator double registered.
|
||||||
@ -1236,7 +1261,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
params,
|
params,
|
||||||
version='7.0')
|
version='7.0')
|
||||||
return vag_id
|
return vag_id
|
||||||
except exception.SolidFireAPIException as error:
|
except SolidFireAPIException as error:
|
||||||
if xAlreadyInVolumeAccessGroup in error.msg:
|
if xAlreadyInVolumeAccessGroup in error.msg:
|
||||||
return vag_id
|
return vag_id
|
||||||
elif xVolumeAccessGroupIDDoesNotExist in error.msg:
|
elif xVolumeAccessGroupIDDoesNotExist in error.msg:
|
||||||
@ -1257,7 +1282,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
version='7.0')
|
version='7.0')
|
||||||
return vag_id
|
return vag_id
|
||||||
|
|
||||||
except exception.SolidFireAPIException as error:
|
except SolidFireAPIException as error:
|
||||||
if xAlreadyInVolumeAccessGroup in error.msg:
|
if xAlreadyInVolumeAccessGroup in error.msg:
|
||||||
return vag_id
|
return vag_id
|
||||||
elif xVolumeAccessGroupIDDoesNotExist in error.msg:
|
elif xVolumeAccessGroupIDDoesNotExist in error.msg:
|
||||||
@ -1272,7 +1297,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
self._issue_api_request('RemoveVolumesFromVolumeAccessGroup',
|
self._issue_api_request('RemoveVolumesFromVolumeAccessGroup',
|
||||||
params,
|
params,
|
||||||
version='7.0')
|
version='7.0')
|
||||||
except exception.SolidFireAPIException as error:
|
except SolidFireAPIException as error:
|
||||||
if xNotInVolumeAccessGroup in error.msg:
|
if xNotInVolumeAccessGroup in error.msg:
|
||||||
pass
|
pass
|
||||||
elif xVolumeAccessGroupIDDoesNotExist in error.msg:
|
elif xVolumeAccessGroupIDDoesNotExist in error.msg:
|
||||||
@ -1293,7 +1318,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
self._issue_api_request('DeleteVolumeAccessGroup',
|
self._issue_api_request('DeleteVolumeAccessGroup',
|
||||||
params,
|
params,
|
||||||
version='7.0')
|
version='7.0')
|
||||||
except exception.SolidFireAPIException as error:
|
except SolidFireAPIException as error:
|
||||||
if xVolumeAccessGroupIDDoesNotExist not in error.msg:
|
if xVolumeAccessGroupIDDoesNotExist not in error.msg:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -1343,7 +1368,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
self._verify_image_volume(context,
|
self._verify_image_volume(context,
|
||||||
image_meta,
|
image_meta,
|
||||||
image_service)
|
image_service)
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
return None, False
|
return None, False
|
||||||
|
|
||||||
# Ok, should be good to go now, try it again
|
# Ok, should be good to go now, try it again
|
||||||
@ -1423,7 +1448,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
int(model_update['provider_id'].split()[0]))
|
int(model_update['provider_id'].split()[0]))
|
||||||
self._replicate_volume(volume, params,
|
self._replicate_volume(volume, params,
|
||||||
sf_account, rep_settings)
|
sf_account, rep_settings)
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
# NOTE(jdg): Something went wrong after the source create, due to
|
# NOTE(jdg): Something went wrong after the source create, due to
|
||||||
# the way TFLOW works and it's insistence on retrying the same
|
# the way TFLOW works and it's insistence on retrying the same
|
||||||
# command over and over coupled with the fact that the introduction
|
# command over and over coupled with the fact that the introduction
|
||||||
@ -1479,7 +1504,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
'AddAccount',
|
'AddAccount',
|
||||||
params,
|
params,
|
||||||
endpoint=tgt_endpoint)['result']['accountID']
|
endpoint=tgt_endpoint)['result']['accountID']
|
||||||
except exception.SolidFireAPIException as ex:
|
except SolidFireAPIException as ex:
|
||||||
if 'xDuplicateUsername' not in ex.msg:
|
if 'xDuplicateUsername' not in ex.msg:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@ -1655,7 +1680,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
"the provided Cinder volumes. Retrieved: %(ret)s "
|
"the provided Cinder volumes. Retrieved: %(ret)s "
|
||||||
"Desired: %(des)s") % {"ret": len(target_vols),
|
"Desired: %(des)s") % {"ret": len(target_vols),
|
||||||
"des": len(src_vol_ids)})
|
"des": len(src_vol_ids)})
|
||||||
raise exception.SolidFireDriverException(msg)
|
raise SolidFireDriverException(msg)
|
||||||
|
|
||||||
result = self._sf_create_group_snapshot(gsnap_name, target_vols)
|
result = self._sf_create_group_snapshot(gsnap_name, target_vols)
|
||||||
return result
|
return result
|
||||||
@ -1693,7 +1718,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
target = self._get_group_snapshot_by_name(snap_name)
|
target = self._get_group_snapshot_by_name(snap_name)
|
||||||
if not target:
|
if not target:
|
||||||
msg = _("Failed to find group snapshot named: %s") % snap_name
|
msg = _("Failed to find group snapshot named: %s") % snap_name
|
||||||
raise exception.SolidFireDriverException(msg)
|
raise SolidFireDriverException(msg)
|
||||||
self._delete_group_snapshot(target['groupSnapshotID'])
|
self._delete_group_snapshot(target['groupSnapshotID'])
|
||||||
|
|
||||||
def _find_linked_snapshot(self, target_uuid, group_snap):
|
def _find_linked_snapshot(self, target_uuid, group_snap):
|
||||||
@ -1844,7 +1869,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
"the provided Cinder snapshots. Retrieved: %(ret)s "
|
"the provided Cinder snapshots. Retrieved: %(ret)s "
|
||||||
"Desired: %(des)s") % {"ret": len(target_vols),
|
"Desired: %(des)s") % {"ret": len(target_vols),
|
||||||
"des": len(snapshots)})
|
"des": len(snapshots)})
|
||||||
raise exception.SolidFireDriverException(msg)
|
raise SolidFireDriverException(msg)
|
||||||
snap_name = self.configuration.sf_volume_prefix + cgsnapshot['id']
|
snap_name = self.configuration.sf_volume_prefix + cgsnapshot['id']
|
||||||
self._sf_create_group_snapshot(snap_name, target_vols)
|
self._sf_create_group_snapshot(snap_name, target_vols)
|
||||||
return None, None
|
return None, None
|
||||||
@ -1886,7 +1911,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
if refresh:
|
if refresh:
|
||||||
try:
|
try:
|
||||||
self._update_cluster_status()
|
self._update_cluster_status()
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
LOG.debug("SolidFire cluster_stats: %s", self.cluster_stats)
|
LOG.debug("SolidFire cluster_stats: %s", self.cluster_stats)
|
||||||
@ -1945,7 +1970,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
results = self._issue_api_request('GetClusterCapacity', params)
|
results = self._issue_api_request('GetClusterCapacity', params)
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
data['total_capacity_gb'] = 0
|
data['total_capacity_gb'] = 0
|
||||||
data['free_capacity_gb'] = 0
|
data['free_capacity_gb'] = 0
|
||||||
self.cluster_stats = data
|
self.cluster_stats = data
|
||||||
@ -2110,7 +2135,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
sfid = external_ref.get('source-id', None)
|
sfid = external_ref.get('source-id', None)
|
||||||
sfname = external_ref.get('name', None)
|
sfname = external_ref.get('name', None)
|
||||||
if sfid is None:
|
if sfid is None:
|
||||||
raise exception.SolidFireAPIException(_("Manage existing volume "
|
raise SolidFireAPIException(_("Manage existing volume "
|
||||||
"requires 'source-id'."))
|
"requires 'source-id'."))
|
||||||
|
|
||||||
# First get the volume on the SF cluster (MUST be active)
|
# First get the volume on the SF cluster (MUST be active)
|
||||||
@ -2151,7 +2176,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
"""
|
"""
|
||||||
sfid = external_ref.get('source-id', None)
|
sfid = external_ref.get('source-id', None)
|
||||||
if sfid is None:
|
if sfid is None:
|
||||||
raise exception.SolidFireAPIException(_("Manage existing get size "
|
raise SolidFireAPIException(_("Manage existing get size "
|
||||||
"requires 'id'."))
|
"requires 'id'."))
|
||||||
|
|
||||||
params = {'startVolumeID': int(sfid),
|
params = {'startVolumeID': int(sfid),
|
||||||
@ -2167,7 +2192,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
LOG.error("Account for Volume ID %s was not found on "
|
LOG.error("Account for Volume ID %s was not found on "
|
||||||
"the SolidFire Cluster while attempting "
|
"the SolidFire Cluster while attempting "
|
||||||
"unmanage operation!", volume['id'])
|
"unmanage operation!", volume['id'])
|
||||||
raise exception.SolidFireAPIException(_("Failed to find account "
|
raise SolidFireAPIException(_("Failed to find account "
|
||||||
"for volume."))
|
"for volume."))
|
||||||
|
|
||||||
params = {'accountID': sfaccount['accountID']}
|
params = {'accountID': sfaccount['accountID']}
|
||||||
@ -2193,7 +2218,7 @@ class SolidFireDriver(san.SanISCSIDriver):
|
|||||||
'access': 'replicationTarget'}
|
'access': 'replicationTarget'}
|
||||||
try:
|
try:
|
||||||
self._issue_api_request('ModifyVolume', params)
|
self._issue_api_request('ModifyVolume', params)
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
# FIXME
|
# FIXME
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -2389,7 +2414,7 @@ class SolidFireISCSI(iscsi_driver.SanISCSITarget):
|
|||||||
def ensure_export(self, context, volume, volume_path):
|
def ensure_export(self, context, volume, volume_path):
|
||||||
try:
|
try:
|
||||||
return self._do_iscsi_export(volume)
|
return self._do_iscsi_export(volume)
|
||||||
except exception.SolidFireAPIException:
|
except SolidFireAPIException:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Following are abc's that we make sure are caught and
|
# Following are abc's that we make sure are caught and
|
||||||
|
Loading…
x
Reference in New Issue
Block a user