Skip to content

Commit

Permalink
#24 change COMMAND_RESPONSE.code to integer
Browse files Browse the repository at this point in the history
  • Loading branch information
YiHuangDB committed Feb 27, 2023
1 parent bff43c7 commit 902b8a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions driver/ixsystems/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def _delete_volume(self, name):

# When deleting volume with dependent snapsnot clone, 422 error triggered. Throw VolumeIsBusy exception ensures
# upper stream cinder manager mark volume status available instead of error-deleting.
if ret['status'] == 'error' and ret['code'] == '422':
if ret['status'] == 'error' and ret['code'] == 422:
errorexception = exception.VolumeIsBusy(
_("Cannot delete volume when clone child volume or snapshot exists!"), volume_name=name)
raise errorexception
Expand Down Expand Up @@ -387,7 +387,7 @@ def _delete_snapshot(self, name, volume_name):
LOG.debug('_delete_snapshot response : %s', json.dumps(ret))
# When deleting volume with dependent snapsnot clone, 422 error triggered. Throw VolumeIsBusy exception ensures
# upper stream cinder manager mark volume status available instead of error-deleting.
if ret['status'] == 'error' and ret['code'] == '422':
if ret['status'] == 'error' and ret['code'] == 422:
errorexception = exception.VolumeIsBusy(
_("Cannot delete volume when clone child volume or snapshot exists!"), volume_name=name)
raise errorexception
Expand Down
4 changes: 2 additions & 2 deletions driver/ixsystems/freenasapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class FreeNASServer(object):
# Command response format
COMMAND_RESPONSE = {'status': '%s',
'response': '%s',
'code': ''}
'code': -1}

# Command status
STATUS_OK = 'ok'
Expand Down Expand Up @@ -182,7 +182,7 @@ def _get_error_info(self, err):
self.COMMAND_RESPONSE['status'] = self.STATUS_ERROR
if isinstance(err, urllib.error.HTTPError):
self.COMMAND_RESPONSE['response'] = '%d:%s' % (err.code, err.msg)
self.COMMAND_RESPONSE['code'] = '%d' % err.code
self.COMMAND_RESPONSE['code'] = err.code
elif isinstance(err, urllib.error.URLError):
self.COMMAND_RESPONSE['response'] = '%s:%s' % \
(str(err.reason.errno),
Expand Down

0 comments on commit 902b8a3

Please sign in to comment.