"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "manila/tests/share/drivers/netapp/dataontap/cluster_mode/test_lib_base.py" between
manila-8.1.3.tar.gz and manila-8.1.4.tar.gz

About: OpenStack Manila provides “Shared Filesystems as a service”.
The "Stein" series (maintained release).

test_lib_base.py  (manila-8.1.3):test_lib_base.py  (manila-8.1.4)
skipping to change at line 3029 skipping to change at line 3029
fake.SHARE, None, snapshots, fake.SHARE, None, snapshots,
share_server=None) share_server=None)
self.assertEqual(constants.REPLICA_STATE_OUT_OF_SYNC, result) self.assertEqual(constants.REPLICA_STATE_OUT_OF_SYNC, result)
def test_promote_replica(self): def test_promote_replica(self):
self.mock_object(self.library, self.mock_object(self.library,
'_get_vserver', '_get_vserver',
mock.Mock(return_value=(fake.VSERVER1, mock.Mock(return_value=(fake.VSERVER1,
mock.Mock()))) mock.Mock())))
protocol_helper = mock.Mock()
self.mock_object(self.library, self.mock_object(self.library,
'_get_helper', '_get_helper',
mock.Mock(return_value=mock.Mock())) mock.Mock(return_value=protocol_helper))
self.mock_object(self.library, '_create_export', self.mock_object(self.library, '_create_export',
mock.Mock(return_value='fake_export_location')) mock.Mock(return_value='fake_export_location'))
self.mock_object(self.library, '_unmount_orig_active_replica') self.mock_object(self.library, '_unmount_orig_active_replica')
self.mock_object(self.library, '_handle_qos_on_replication_change') self.mock_object(self.library, '_handle_qos_on_replication_change')
mock_dm_session = mock.Mock() mock_dm_session = mock.Mock()
self.mock_object(data_motion, "DataMotionSession", self.mock_object(data_motion, "DataMotionSession",
mock.Mock(return_value=mock_dm_session)) mock.Mock(return_value=mock_dm_session))
self.mock_object(mock_dm_session, 'get_vserver_from_share', self.mock_object(mock_dm_session, 'get_vserver_from_share',
mock.Mock(return_value=fake.VSERVER1)) mock.Mock(return_value=fake.VSERVER1))
self.mock_object(self.client, 'cleanup_demoted_replica')
replicas = self.library.promote_replica( replicas = self.library.promote_replica(
None, [self.fake_replica, self.fake_replica_2], None, [self.fake_replica, self.fake_replica_2],
self.fake_replica_2, [], share_server=None) self.fake_replica_2, [], share_server=None)
mock_dm_session.change_snapmirror_source.assert_called_once_with( mock_dm_session.change_snapmirror_source.assert_called_once_with(
self.fake_replica, self.fake_replica, self.fake_replica_2, self.fake_replica, self.fake_replica, self.fake_replica_2,
mock.ANY mock.ANY
) )
self.assertEqual(2, len(replicas)) self.assertEqual(2, len(replicas))
skipping to change at line 3067 skipping to change at line 3069
lambda x: x['id'] == self.fake_replica_2['id'], replicas))[0] lambda x: x['id'] == self.fake_replica_2['id'], replicas))[0]
self.assertEqual(constants.REPLICA_STATE_ACTIVE, self.assertEqual(constants.REPLICA_STATE_ACTIVE,
actual_replica_2['replica_state']) actual_replica_2['replica_state'])
self.assertEqual('fake_export_location', self.assertEqual('fake_export_location',
actual_replica_2['export_locations']) actual_replica_2['export_locations'])
self.assertEqual(constants.STATUS_ACTIVE, self.assertEqual(constants.STATUS_ACTIVE,
actual_replica_2['access_rules_status']) actual_replica_2['access_rules_status'])
self.library._unmount_orig_active_replica.assert_called_once_with( self.library._unmount_orig_active_replica.assert_called_once_with(
self.fake_replica, fake.VSERVER1) self.fake_replica, fake.VSERVER1)
self.library._handle_qos_on_replication_change.assert_called_once() self.library._handle_qos_on_replication_change.assert_called_once()
protocol_helper.cleanup_demoted_replica.assert_called_once_with(
self.fake_replica, fake.SHARE['name'])
def test_promote_replica_cleanup_demoted_storage_error(self):
self.mock_object(self.library,
'_get_vserver',
mock.Mock(return_value=(fake.VSERVER1,
mock.Mock())))
protocol_helper = mock.Mock()
self.mock_object(self.library,
'_get_helper',
mock.Mock(return_value=protocol_helper))
self.mock_object(self.library, '_create_export',
mock.Mock(return_value='fake_export_location'))
self.mock_object(self.library, '_unmount_orig_active_replica')
self.mock_object(self.library, '_handle_qos_on_replication_change')
mock_dm_session = mock.Mock()
self.mock_object(data_motion, "DataMotionSession",
mock.Mock(return_value=mock_dm_session))
self.mock_object(mock_dm_session, 'get_vserver_from_share',
mock.Mock(return_value=fake.VSERVER1))
self.mock_object(
protocol_helper, 'cleanup_demoted_replica',
mock.Mock(side_effect=exception.StorageCommunicationException))
mock_log = self.mock_object(lib_base.LOG, 'exception')
self.library.promote_replica(
None, [self.fake_replica, self.fake_replica_2],
self.fake_replica_2, [], share_server=None)
mock_dm_session.change_snapmirror_source.assert_called_once_with(
self.fake_replica, self.fake_replica, self.fake_replica_2,
mock.ANY
)
protocol_helper.cleanup_demoted_replica.assert_called_once_with(
self.fake_replica, fake.SHARE['name'])
mock_log.assert_called_once()
def test_promote_replica_destination_unreachable(self): def test_promote_replica_destination_unreachable(self):
self.mock_object(self.library, self.mock_object(self.library,
'_get_vserver', '_get_vserver',
mock.Mock(return_value=(fake.VSERVER1, mock.Mock(return_value=(fake.VSERVER1,
mock.Mock()))) mock.Mock())))
self.mock_object(self.library, self.mock_object(self.library,
'_get_helper', '_get_helper',
mock.Mock(return_value=mock.Mock())) mock.Mock(return_value=mock.Mock()))
self.mock_object(self.library, '_unmount_orig_active_replica') self.mock_object(self.library, '_unmount_orig_active_replica')
skipping to change at line 4726 skipping to change at line 4766
expected_progress = { expected_progress = {
'total_progress': 100 if phase.startswith('cutover') else 80, 'total_progress': 100 if phase.startswith('cutover') else 80,
'state': 'healthy', 'state': 'healthy',
'estimated_completion_time': '1481919246', 'estimated_completion_time': '1481919246',
'details': '%s:: Volume move job in progress' % phase, 'details': '%s:: Volume move job in progress' % phase,
'phase': phase, 'phase': phase,
} }
self.assertDictMatch(expected_progress, migration_progress) self.assertDictMatch(expected_progress, migration_progress)
mock_info_log.assert_called_once() mock_info_log.assert_called_once()
@ddt.data(utils.annotated('already_canceled', (True, )), @ddt.data({'state': 'failed'},
utils.annotated('not_canceled_yet', (False, ))) {'state': 'healthy'})
def test_migration_cancel(self, already_canceled): @ddt.unpack
def test_migration_cancel(self, state):
source_snapshots = mock.Mock() source_snapshots = mock.Mock()
snapshot_mappings = mock.Mock() snapshot_mappings = mock.Mock()
already_canceled = already_canceled[0] self.library.configuration.netapp_migration_cancel_timeout = 15
mock_exception_log = self.mock_object(lib_base.LOG, 'exception')
mock_info_log = self.mock_object(lib_base.LOG, 'info') mock_info_log = self.mock_object(lib_base.LOG, 'info')
vol_move_side_effect = (exception.NetAppException
if already_canceled else None)
self.mock_object(self.library, '_get_vserver', self.mock_object(self.library, '_get_vserver',
mock.Mock(return_value=(fake.VSERVER1, mock.Mock()))) mock.Mock(return_value=(fake.VSERVER1, mock.Mock())))
self.mock_object(self.library, '_get_backend_share_name', self.mock_object(self.library, '_get_backend_share_name',
mock.Mock(return_value=fake.SHARE_NAME)) mock.Mock(return_value=fake.SHARE_NAME))
self.mock_object(self.client, 'abort_volume_move') self.mock_object(self.client, 'abort_volume_move')
self.mock_object(self.client, 'get_volume_move_status', self.mock_object(self.client, 'get_volume_move_status',
mock.Mock(side_effect=vol_move_side_effect)) mock.Mock(return_value={'state': state}))
retval = self.library.migration_cancel( if state == 'failed':
retval = self.library.migration_cancel(
self.context, fake_share.fake_share_instance(),
fake_share.fake_share_instance(), source_snapshots,
snapshot_mappings, share_server=fake.SHARE_SERVER,
destination_share_server='dst_srv')
self.assertIsNone(retval)
mock_info_log.assert_called_once()
else:
self.assertRaises(
(exception.NetAppException),
self.library.migration_cancel, self.context,
fake_share.fake_share_instance(),
fake_share.fake_share_instance, source_snapshots,
snapshot_mappings, share_server=fake.SHARE_SERVER,
destination_share_server='dst_srv')
@ddt.data({'already_canceled': True, 'effect': exception.NetAppException},
{'already_canceled': False, 'effect':
(None, exception.NetAppException)})
@ddt.unpack
def test_migration_cancel_exception_volume_status(self, already_canceled,
effect):
source_snapshots = mock.Mock()
snapshot_mappings = mock.Mock()
self.library.configuration.netapp_migration_cancel_timeout = 1
mock_exception_log = self.mock_object(lib_base.LOG, 'exception')
mock_info_log = self.mock_object(lib_base.LOG, 'info')
self.mock_object(self.library, '_get_vserver',
mock.Mock(return_value=(fake.VSERVER1, mock.Mock())))
self.mock_object(self.library, '_get_backend_share_name',
mock.Mock(return_value=fake.SHARE_NAME))
self.mock_object(self.client, 'abort_volume_move')
self.mock_object(self.client, 'get_volume_move_status',
mock.Mock(side_effect=effect))
self.library.migration_cancel(
self.context, fake_share.fake_share_instance(), self.context, fake_share.fake_share_instance(),
fake_share.fake_share_instance(), source_snapshots, fake_share.fake_share_instance(), source_snapshots,
snapshot_mappings, share_server=fake.SHARE_SERVER, snapshot_mappings, share_server=fake.SHARE_SERVER,
destination_share_server='dst_srv') destination_share_server='dst_srv')
self.assertIsNone(retval) mock_exception_log.assert_called_once()
if already_canceled: if not already_canceled:
mock_exception_log.assert_called_once()
else:
mock_info_log.assert_called_once() mock_info_log.assert_called_once()
self.assertEqual(not already_canceled, self.assertEqual(not already_canceled,
self.client.abort_volume_move.called) self.client.abort_volume_move.called)
def test_migration_complete_invalid_phase(self): def test_migration_complete_invalid_phase(self):
source_snapshots = mock.Mock() source_snapshots = mock.Mock()
snapshot_mappings = mock.Mock() snapshot_mappings = mock.Mock()
status = { status = {
'state': 'healthy', 'state': 'healthy',
'phase': 'Replicating', 'phase': 'Replicating',
'details': 'Replicating:: Volume move operation is in progress.', 'details': 'Replicating:: Volume move operation is in progress.',
 End of changes. 11 change blocks. 
14 lines changed or deleted 88 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)