Merge "VNX: Handle error during volume deletion"

This commit is contained in:
Jenkins 2017-02-13 07:12:01 +00:00 committed by Gerrit Code Review
commit a45d5c7751
4 changed files with 30 additions and 2 deletions

View File

@ -64,6 +64,10 @@ class VNXLunNotMigratingError(VNXException):
pass
class VNXLunSyncCompletedError(VNXMigrationError):
error_code = 0x714a8021
class VNXTargetNotReadyError(VNXMigrationError):
message = 'The destination LUN is not available for migration'

View File

@ -373,6 +373,8 @@ test_cleanup_migration:
lun: &lun_cancel_migrate
_methods:
cancel_migrate:
_properties:
dest_lu_id: 2
vnx:
_methods:
get_migration_session: *session_cancel
@ -389,6 +391,20 @@ test_cleanup_migration_not_migrating:
get_migration_session: *session_cancel
get_lun: *lun_cancel_migrate_not_migrating
test_cleanup_migration_cancel_failed:
lun: &lun_cancel_migrate_cancle_failed
_methods:
cancel_migrate:
_raise:
VNXLunSyncCompletedError: The LUN is not migrating
_properties:
wwn: test
vnx:
_methods:
get_migration_session:
_side_effect: [*session_cancel, *session_verify]
get_lun: *lun_cancel_migrate_not_migrating
test_get_lun_by_name:
lun: &lun_test_get_lun_by_name
_properties:

View File

@ -163,6 +163,10 @@ class TestClient(test.TestCase):
def test_cleanup_migration_not_migrating(self, client, mocked):
client.cleanup_migration(1, 2)
@res_mock.patch_client
def test_cleanup_migration_cancel_failed(self, client, mocked):
client.cleanup_migration(1, 2)
@res_mock.patch_client
def test_get_lun_by_name(self, client, mocked):
lun = client.get_lun(name='lun_name_test_get_lun_by_name')

View File

@ -250,8 +250,12 @@ class Client(object):
try:
src_lun.cancel_migrate()
except storops_ex.VNXLunNotMigratingError:
LOG.info(_LI('The LUN is not migrating, this message can be'
' safely ignored'))
LOG.info(_LI('The LUN is not migrating or completed, '
'this message can be safely ignored'))
except (storops_ex.VNXLunSyncCompletedError,
storops_ex.VNXMigrationError):
# Wait until session finishes
self.verify_migration(src_id, session.dest_lu_id, None)
def create_snapshot(self, lun_id, snap_name, keep_for=None):
"""Creates a snapshot."""