Merge "Failed to initialize connection"

This commit is contained in:
Jenkins 2014-08-19 20:38:55 +00:00 committed by Gerrit Code Review
commit d4a16f7641
3 changed files with 44 additions and 29 deletions

View File

@ -153,22 +153,27 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
LOG.error(msg)
ret = errno.EFAULT
if ret == 0:
ret, event_uuid = self._get_event_uuid(output)
if ret == errno.EAGAIN:
status = self._wait_event(
self.dpl.get_vdev_status,
self._conver_uuid2hex(volumeid), event_uuid)
if status['state'] == 'error':
ret, event_uuid = self._get_event_uuid(output)
if len(event_uuid):
ret = 0
status = self._wait_event(
self.dpl.get_vdev_status,
self._conver_uuid2hex(volumeid), event_uuid)
if status['state'] == 'error':
ret = errno.EFAULT
msg = _('Flexvisor failed to assign volume %(id)s: '
'%(status)s.') % {'id': volumeid,
'status': status}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
else:
ret = errno.EFAULT
msg = _('Flexvisor failed to assign volume %(id)s: '
'%(status)s.') % {'id': volumeid,
'status': status}
msg = _('Flexvisor failed to assign volume %(id)s due to '
'unable to query status by event '
'id.') % {'id': volumeid}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
else:
ret = 0
elif ret != 0:
msg = _('Flexvisor assign volume failed:%(id)s:'
'%(status)s.') % {'id': volumeid, 'status': ret}
@ -185,17 +190,16 @@ class DPLFCDriver(dplcommon.DPLCOMMONDriver,
targetwwpns, initiatorwwpns)
if ret == errno.EAGAIN:
ret, event_uuid = self._get_event_uuid(output)
if ret == 0:
if ret == 0 and len(event_uuid):
status = self._wait_event(
self.dpl.get_vdev_status, volumeid, event_uuid)
if status['state'] == 'error':
ret = errno.EFAULT
msg = _('Flexvisor failed to unassign volume %(id)s:'
' %(status)s.') % {'id': volumeid,
'status': status}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
else:
ret = 0
else:
msg = _('Flexvisor failed to unassign volume (get event) '
'%(id)s.') % {'id': volumeid}

View File

@ -44,18 +44,26 @@ class DPLISCSIDriver(dplcommon.DPLCOMMONDriver,
ret, output = self.dpl.assign_vdev(self._conver_uuid2hex(
volume['id']), connector['initiator'].lower(), volume['id'],
'%s:%d' % (dpl_server, dpl_iscsi_port), 0)
if ret == 0:
ret, event_uuid = self._get_event_uuid(output)
if ret == errno.EAGAIN:
status = self._wait_event(
self.dpl.get_vdev_status, self._conver_uuid2hex(
volume['id']), event_uuid)
if status['state'] == 'error':
ret, event_uuid = self._get_event_uuid(output)
if len(event_uuid):
ret = 0
status = self._wait_event(
self.dpl.get_vdev_status, self._conver_uuid2hex(
volume['id']), event_uuid)
if status['state'] == 'error':
ret = errno.EFAULT
msg = _('Flexvisor failed to assign volume %(id)s: '
'%(status)s.') % {'id': volume['id'],
'status': status}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
else:
ret = errno.EFAULT
msg = _('Flexvisor failed to assign volume %(id)s: '
'%(status)s.') % {'id': volume['id'],
'status': status}
msg = _('Flexvisor failed to assign volume %(id)s due to '
'unable to query status by event '
'id.') % {'id': volume['id']}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
elif ret != 0:

View File

@ -610,16 +610,19 @@ class DPLCOMMONDriver(driver.VolumeDriver):
return None
def _get_event_uuid(self, output):
ret = 0
event_uuid = ""
if type(output) is not dict:
return -1, event_uuid
if output.get("metadata") and output["metadata"]:
if type(output) is dict and \
output.get("metadata") and output["metadata"]:
if output["metadata"].get("event_uuid") and \
output["metadata"]["event_uuid"]:
event_uuid = output["metadata"]["event_uuid"]
return 0, event_uuid
return -1, event_uuid
else:
ret = errno.EINVAL
else:
ret = errno.EINVAL
return ret, event_uuid
def _wait_event(self, callFun, objuuid, eventid=None):
nRetry = 30