3PAR: Monitor task of promoting a virtual copy
In case of replicated, bootable or large volume, promoting a virtual copy takes some time to promote it. rcopygroup cannot be started when promoting is still in progress. This patch will monitor a task of promoting a virtual copy. Change-Id: If8a03e6aace393e86fc41ddf69bb724d963954e1 Closes-Bug: #1749642
This commit is contained in:
parent
0841b40789
commit
949309e06b
@ -3106,6 +3106,9 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
|
||||
|
||||
mock_client = self.setup_driver()
|
||||
mock_client.isOnlinePhysicalCopy.return_value = False
|
||||
mock_client.promoteVirtualCopy.return_value = {'taskid': 1}
|
||||
mock_client.getTask.return_value = {'status': 1}
|
||||
|
||||
with mock.patch.object(hpecommon.HPE3PARCommon,
|
||||
'_create_client') as mock_create_client:
|
||||
mock_create_client.return_value = mock_client
|
||||
@ -3114,7 +3117,8 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
|
||||
expected = [
|
||||
mock.call.isOnlinePhysicalCopy('osv-dh-F5VGRTseuujPjbeRBVg'),
|
||||
mock.call.promoteVirtualCopy('oss-L4I73ONuTci9Fd4ceij-MQ',
|
||||
optional={})
|
||||
optional={}),
|
||||
mock.call.getTask(1)
|
||||
]
|
||||
|
||||
mock_client.assert_has_calls(
|
||||
@ -3134,6 +3138,8 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
|
||||
mock_client = self.setup_driver()
|
||||
mock_client.isOnlinePhysicalCopy.return_value = True
|
||||
mock_client.getStorageSystemInfo.return_value = mock.ANY
|
||||
mock_client.promoteVirtualCopy.return_value = {'taskid': 1}
|
||||
mock_client.getTask.return_value = {'status': 1}
|
||||
|
||||
with mock.patch.object(hpecommon.HPE3PARCommon,
|
||||
'_create_client') as mock_create_client:
|
||||
@ -3148,6 +3154,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
|
||||
mock.call.promoteVirtualCopy(
|
||||
'oss-L4I73ONuTci9Fd4ceij-MQ',
|
||||
optional={'online': True, 'allowRemoteCopyParent': True}),
|
||||
mock.call.getTask(1),
|
||||
mock.call.startRemoteCopy('rcg-0DM4qZEVSKON-DXN-N')
|
||||
]
|
||||
mock_client.assert_has_calls(
|
||||
@ -5440,6 +5447,8 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
|
||||
mock_client = self.setup_driver()
|
||||
mock_client.isOnlinePhysicalCopy.return_value = False
|
||||
mock_client.getStorageSystemInfo.return_value = mock.ANY
|
||||
mock_client.promoteVirtualCopy.return_value = {'taskid': 1}
|
||||
mock_client.getTask.return_value = {'status': 1}
|
||||
|
||||
with mock.patch.object(hpecommon.HPE3PARCommon,
|
||||
'_create_client') as mock_create_client:
|
||||
@ -5463,6 +5472,7 @@ class TestHPE3PARDriverBase(HPE3PARBaseDriver):
|
||||
mock.call.promoteVirtualCopy(
|
||||
'oss-L4I73ONuTci9Fd4ceij-MQ',
|
||||
optional={'allowRemoteCopyParent': True}),
|
||||
mock.call.getTask(1),
|
||||
mock.call.startRemoteCopy(self.RCG_3PAR_GROUP_NAME)
|
||||
]
|
||||
mock_client.assert_has_calls(
|
||||
|
@ -264,11 +264,12 @@ class HPE3PARCommon(object):
|
||||
4.0.5 - Fixed volume created and added in cloned group,
|
||||
differs from volume present in the source group in terms of
|
||||
extra-specs. bug #1744025
|
||||
4.0.6 - Monitor task of promoting a virtual copy. bug #1749642
|
||||
|
||||
|
||||
"""
|
||||
|
||||
VERSION = "4.0.5"
|
||||
VERSION = "4.0.6"
|
||||
|
||||
stats = {}
|
||||
|
||||
@ -3319,7 +3320,19 @@ class HPE3PARCommon(object):
|
||||
{'volume': volume_name})
|
||||
optional['online'] = True
|
||||
|
||||
self.client.promoteVirtualCopy(snapshot_name, optional=optional)
|
||||
body = self.client.promoteVirtualCopy(snapshot_name, optional=optional)
|
||||
|
||||
task_id = body.get('taskid')
|
||||
|
||||
task_status = self._wait_for_task_completion(task_id)
|
||||
if task_status['status'] is not self.client.TASK_DONE:
|
||||
dbg = {'status': task_status, 'id': volume['id']}
|
||||
msg = _('Promote virtual copy failed: '
|
||||
'id=%(id)s, status=%(status)s.') % dbg
|
||||
raise exception.CinderException(msg)
|
||||
else:
|
||||
LOG.debug('Promote virtual copy completed: '
|
||||
'id=%s.', volume['id'])
|
||||
|
||||
if replication_flag or volume_part_of_group:
|
||||
try:
|
||||
|
Loading…
x
Reference in New Issue
Block a user