[NetApp] Consider last transfer size and error for replica state
In order to determine replica state from snapmirror, in addition to existing check of last-transfer-end-timestamp', also add new checks of `last-transfer-size` and `last-transfer-error`. New config option `netapp_snapmirror_last_transfer_size_limit` added with default value of 1MB. The last-transfer-size above this value or presence of any last-transfer-error is considered as replica is out_of_sync. Closes-bug: #1989175 Change-Id: I6d038244493583cc943063b50d731b8c1ef5ed28
This commit is contained in:
parent
3f431ef9eb
commit
6e8ed59a91
@ -164,7 +164,9 @@ class DataMotionSession(object):
|
|||||||
'mirror-state',
|
'mirror-state',
|
||||||
'source-vserver',
|
'source-vserver',
|
||||||
'source-volume',
|
'source-volume',
|
||||||
'last-transfer-end-timestamp'])
|
'last-transfer-end-timestamp',
|
||||||
|
'last-transfer-size',
|
||||||
|
'last-transfer-error'])
|
||||||
return snapmirrors
|
return snapmirrors
|
||||||
|
|
||||||
def create_snapmirror(self, source_share_obj, dest_share_obj,
|
def create_snapmirror(self, source_share_obj, dest_share_obj,
|
||||||
|
@ -2650,6 +2650,22 @@ class NetAppCmodeFileStorageLibrary(object):
|
|||||||
.isoformat(), 3600))):
|
.isoformat(), 3600))):
|
||||||
return constants.REPLICA_STATE_OUT_OF_SYNC
|
return constants.REPLICA_STATE_OUT_OF_SYNC
|
||||||
|
|
||||||
|
replica_backend = share_utils.extract_host(replica['host'],
|
||||||
|
level='backend_name')
|
||||||
|
config = data_motion.get_backend_configuration(replica_backend)
|
||||||
|
config_size = (int(config.safe_get(
|
||||||
|
'netapp_snapmirror_last_transfer_size_limit')) * units.Ki)
|
||||||
|
last_transfer_size = int(snapmirror.get('last-transfer-size', 0))
|
||||||
|
if last_transfer_size > config_size:
|
||||||
|
return constants.REPLICA_STATE_OUT_OF_SYNC
|
||||||
|
|
||||||
|
last_transfer_error = snapmirror.get('last-transfer-error', None)
|
||||||
|
if last_transfer_error:
|
||||||
|
LOG.debug('Found last-transfer-error: %(error)s for replica: '
|
||||||
|
'%(replica)s.', {'replica': replica['id'],
|
||||||
|
'error': last_transfer_error})
|
||||||
|
return constants.REPLICA_STATE_OUT_OF_SYNC
|
||||||
|
|
||||||
# Check all snapshots exist
|
# Check all snapshots exist
|
||||||
snapshots = [snap['share_replica_snapshot']
|
snapshots = [snap['share_replica_snapshot']
|
||||||
for snap in share_snapshots]
|
for snap in share_snapshots]
|
||||||
|
@ -215,6 +215,12 @@ netapp_data_motion_opts = [
|
|||||||
default=3600, # One Hour
|
default=3600, # One Hour
|
||||||
help='The maximum time in seconds to wait for a snapmirror '
|
help='The maximum time in seconds to wait for a snapmirror '
|
||||||
'release when breaking snapmirror relationships.'),
|
'release when breaking snapmirror relationships.'),
|
||||||
|
cfg.IntOpt('netapp_snapmirror_last_transfer_size_limit',
|
||||||
|
min=512,
|
||||||
|
default=1024, # One MB
|
||||||
|
help='This option set the last transfer size limit (in KB) '
|
||||||
|
'of snapmirror to decide whether replica is in sync or '
|
||||||
|
'out of sync.'),
|
||||||
cfg.IntOpt('netapp_volume_move_cutover_timeout',
|
cfg.IntOpt('netapp_volume_move_cutover_timeout',
|
||||||
min=0,
|
min=0,
|
||||||
default=3600, # One Hour,
|
default=3600, # One Hour,
|
||||||
|
@ -765,7 +765,9 @@ class NetAppCDOTDataMotionSessionTestCase(test.TestCase):
|
|||||||
'mirror-state',
|
'mirror-state',
|
||||||
'source-vserver',
|
'source-vserver',
|
||||||
'source-volume',
|
'source-volume',
|
||||||
'last-transfer-end-timestamp']
|
'last-transfer-end-timestamp',
|
||||||
|
'last-transfer-size',
|
||||||
|
'last-transfer-error']
|
||||||
)
|
)
|
||||||
self.assertEqual(1, self.mock_dest_client.get_snapmirrors.call_count)
|
self.assertEqual(1, self.mock_dest_client.get_snapmirrors.call_count)
|
||||||
|
|
||||||
|
@ -4303,6 +4303,9 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||||||
self.mock_object(self.library,
|
self.mock_object(self.library,
|
||||||
'_is_readable_replica',
|
'_is_readable_replica',
|
||||||
mock.Mock(return_value=False))
|
mock.Mock(return_value=False))
|
||||||
|
mock_backend_config = fake.get_config_cmode()
|
||||||
|
self.mock_object(data_motion, 'get_backend_configuration',
|
||||||
|
mock.Mock(return_value=mock_backend_config))
|
||||||
|
|
||||||
result = self.library.update_replica_state(None, [fake.SHARE],
|
result = self.library.update_replica_state(None, [fake.SHARE],
|
||||||
fake.SHARE, None, [],
|
fake.SHARE, None, [],
|
||||||
@ -4346,6 +4349,9 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||||||
self.mock_object(self.library,
|
self.mock_object(self.library,
|
||||||
'_is_readable_replica',
|
'_is_readable_replica',
|
||||||
mock.Mock(return_value=False))
|
mock.Mock(return_value=False))
|
||||||
|
mock_backend_config = fake.get_config_cmode()
|
||||||
|
self.mock_object(data_motion, 'get_backend_configuration',
|
||||||
|
mock.Mock(return_value=mock_backend_config))
|
||||||
|
|
||||||
result = self.library.update_replica_state(None, [fake.SHARE],
|
result = self.library.update_replica_state(None, [fake.SHARE],
|
||||||
fake.SHARE, None, snapshots,
|
fake.SHARE, None, snapshots,
|
||||||
@ -4374,6 +4380,9 @@ class NetAppFileStorageLibraryTestCase(test.TestCase):
|
|||||||
self.mock_object(self.library,
|
self.mock_object(self.library,
|
||||||
'_is_readable_replica',
|
'_is_readable_replica',
|
||||||
mock.Mock(return_value=False))
|
mock.Mock(return_value=False))
|
||||||
|
mock_backend_config = fake.get_config_cmode()
|
||||||
|
self.mock_object(data_motion, 'get_backend_configuration',
|
||||||
|
mock.Mock(return_value=mock_backend_config))
|
||||||
|
|
||||||
result = self.library.update_replica_state(None, [fake.SHARE],
|
result = self.library.update_replica_state(None, [fake.SHARE],
|
||||||
fake.SHARE, None, snapshots,
|
fake.SHARE, None, snapshots,
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
NetApp driver now considers ``last-transfer-size`` and
|
||||||
|
``last-transfer-error`` fields of the snapmirror in addition to existing
|
||||||
|
``last-transfer-end-timestamp`` to decide whether replica is in_sync or
|
||||||
|
out_of_sync. Added new config option
|
||||||
|
`netapp_snapmirror_last_transfer_size_limit` (default 1MB). If value of
|
||||||
|
`last-transfer-size` field is greater than config value or if
|
||||||
|
`last-transfer-error` field is present, then replica is out_of_sync.
|
Loading…
Reference in New Issue
Block a user