]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Modify error code compatible with Mac OS.
authorRick Chen <rick.chen@prophetstor.com>
Tue, 19 Aug 2014 16:12:23 +0000 (00:12 +0800)
committerRick Chen <rick.chen@prophetstor.com>
Wed, 20 Aug 2014 04:23:02 +0000 (12:23 +0800)
Mac OS builtin python errno object has no
attribute 'ENAVAIL'.
Changed
  errno.ENAVAIL --> errno.ENODATA
Another when backend storage service not ready, the
error code "ENAVAIL" change to "ENOPROTOOPT".

Change-Id: I0c41dfe44a4dea02329ff21df881f4c133fe6099
Closes-Bug: 1357010

cinder/volume/drivers/prophetstor/dplcommon.py

index 7d491e185df6322e373ca7cc55aa33509e1590f4..a6f02165d1b42f5f71755279411db1e2ba0eea19 100644 (file)
@@ -138,7 +138,7 @@ class DPLCommand(object):
                         LOG.error(_('The Flexvisor service is unavailable.'))
                         time.sleep(1)
                         retry -= 1
-                        retcode = errno.ENAVAIL
+                        retcode = errno.ENOPROTOOPT
                         continue
                     else:
                         retcode = 0
@@ -156,7 +156,7 @@ class DPLCommand(object):
 
         if retcode == 0 and response.status in expected_status and\
                 response.status == httplib.NOT_FOUND:
-            retcode = errno.ENAVAIL
+            retcode = errno.ENODATA
         elif retcode == 0 and response.status not in expected_status:
             LOG.error(_('%(method)s %(url)s unexpected response status: '
                         '%(response)s (expects: %(expects)s).')
@@ -170,7 +170,7 @@ class DPLCommand(object):
             else:
                 retcode = errno.EIO
         elif retcode == 0 and response.status is httplib.NOT_FOUND:
-            retcode = errno.ENAVAIL
+            retcode = errno.ENODATA
         elif retcode == 0 and response.status is httplib.ACCEPTED:
             retcode = errno.EAGAIN
             try:
@@ -652,7 +652,7 @@ class DPLCOMMONDriver(driver.VolumeDriver):
                         nsleep = random.randint(0, 10)
                         value = round(float(nsleep) / 10, 2)
                         time.sleep(value)
-                elif ret == errno.ENAVAIL:
+                elif ret == errno.ENODATA:
                     status['state'] = 'deleted'
                     fExit = True
                 else:
@@ -852,7 +852,7 @@ class DPLCOMMONDriver(driver.VolumeDriver):
                         '%(status)s.') % {'id': volume['id'], 'status': ret}
                 LOG.error(msg)
                 raise exception.VolumeBackendAPIException(data=msg)
-        elif ret == errno.ENAVAIL:
+        elif ret == errno.ENODATA:
             ret = 0
             msg = _('Flexvisor volume %(id)s not '
                     'existed.') % {'id': volume['id']}
@@ -956,7 +956,7 @@ class DPLCOMMONDriver(driver.VolumeDriver):
                         'get event) %(id)s.') % {'id': snapshot['id']}
                 LOG.error(msg)
                 raise exception.VolumeBackendAPIException(data=msg)
-        elif ret == errno.ENAVAIL:
+        elif ret == errno.ENODATA:
             msg = _('Flexvisor snapshot %(id)s not existed.') % \
                 {'id': snapshot['id']}
             LOG.info(msg)