Failed to re-detach volume when volume detached.

When first request command detach the volume, but the back-end
storage state is in-processing or busy. Next retry command will
got the error code that describe the volume already detached.

Change-Id: If340980ab2dcc844398254ff368ca6b78ca40ff6
Closes-Bug: 1373317
This commit is contained in:
Rick Chen 2014-09-24 17:08:52 +08:00
parent d5d2744a70
commit 7a5383a70a
2 changed files with 26 additions and 1 deletions

View File

@ -12,10 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import errno
import httplib
import re
import mock
from cinder import exception
from cinder.openstack.common import units
from cinder import test
from cinder.volume import configuration as conf
@ -514,6 +517,24 @@ class TestProphetStorDPLDriver(test.TestCase):
self._conver_uuid2hex(DATA_IN_VOLUME['id']),
DATA_IN_CONNECTOR['initiator'])
def test_terminate_connection_volume_detached(self):
self.DPL_MOCK.unassign_vdev.return_value = errno.ENODATA, None
self.dpldriver.terminate_connection(DATA_IN_VOLUME, DATA_IN_CONNECTOR)
self.DPL_MOCK\
.unassign_vdev\
.assert_called_once_with(
self._conver_uuid2hex(DATA_IN_VOLUME['id']),
DATA_IN_CONNECTOR['initiator'])
def test_terminate_connection_failed(self):
self.DPL_MOCK.unassign_vdev.return_value = errno.EFAULT, None
ex = self.assertRaises(
exception.VolumeBackendAPIException,
self.dpldriver.terminate_connection,
volume=DATA_IN_VOLUME, connector=DATA_IN_CONNECTOR)
self.assertTrue(
re.match(r".*Flexvisor failed", ex.msg))
def test_get_pool_info(self):
self.DPL_MOCK.get_pool.return_value = DATA_POOLINFO
_, res = self.dpldriver._get_pool_info(POOLUUID)

View File

@ -134,8 +134,12 @@ class DPLISCSIDriver(dplcommon.DPLCOMMONDriver,
'%(id)s.') % {'id': volume['id']}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)
elif ret == errno.ENODATA:
msg = _('Flexvisor already unassigned volume '
'%(id)s.') % {'id': volume['id']}
LOG.info(msg)
elif ret != 0:
msg = _('Flexvisor unassign volume failed:%(id)s:'
msg = _('Flexvisor failed to unassign volume:%(id)s:'
'%(status)s.') % {'id': volume['id'], 'status': ret}
LOG.error(msg)
raise exception.VolumeBackendAPIException(data=msg)