vol,
fake_host)
self.assertTrue(ret[0])
- self.assertTrue(
- ret[1]['provider_location'].find('type^lun') > 0)
+ self.assertIn('type^lun', ret[1]['provider_location'])
# verification
expect_cmd = [mock.call(*self.testData.MIGRATION_CMD(),
retry_disable=True,
vol = self.driver.create_volume_from_snapshot(
self.testData.test_volume_with_type,
self.testData.test_snapshot)
- self.assertTrue(
- vol['provider_location'].find('type^smp') > 0)
+ self.assertIn('type^smp', vol['provider_location'])
expect_cmd = [
mock.call(
*self.testData.SNAP_COPY_CMD(
vol = self.driver.create_cloned_volume(
self.testData.test_clone,
self.testData.test_volume_with_type)
- self.assertTrue(
- vol['provider_location'].find('type^smp') > 0)
+ self.assertIn('type^smp', vol['provider_location'])
expect_cmd = [
mock.call(
*self.testData.SNAP_CREATE_CMD(
host_test_data)
self.assertTrue(type(ret) == tuple)
self.assertTrue(ret[0])
- self.assertTrue(
- ret[1]['provider_location'].find('type^lun') > 0)
+ self.assertIn('type^lun', ret[1]['provider_location'])
expect_cmd = [
mock.call(*self.testData.SNAP_LIST_CMD(), poll=False),
mock.call(*self.testData.SNAP_DELETE_CMD(tmp_snap),
vol2_in_new_cg['name'] + '_dest'), poll=False),
mock.call(*td.MIGRATION_CMD(6232, 2),
poll=True, retry_disable=True),
- mock.call(*td.MIGRATION_VERIFY_CMD(6232), poll=True),
mock.call(*td.MIGRATION_VERIFY_CMD(6231), poll=True),
+ mock.call(*td.MIGRATION_VERIFY_CMD(6232), poll=True),
mock.call(*td.CREATE_CONSISTENCYGROUP_CMD(
- new_cg['id'], [6232, 6231]), poll=True),
+ new_cg['id'], [6231, 6232]), poll=True),
mock.call(*td.DELETE_CG_SNAPSHOT(copied_snap_name))]
self.assertEqual(expect_cmd, fake_cli.call_args_list)
poll=False),
mock.call('port', '-list', '-gname', 'fakehost')]
fake_cli.assert_has_calls(expected)
- self.assertEqual(['5006016A0860080F', '5006016008600195'],
- data['data']['target_wwn'])
+ self.assertEqual(set(['5006016A0860080F', '5006016008600195']),
+ set(data['data']['target_wwn']))
@mock.patch('random.randint',
mock.Mock(return_value=0))
poll=False),
mock.call('port', '-list', '-gname', 'fakehost')]
fake_cli.assert_has_calls(expected)
- self.assertEqual(['5006016A0860080F', '5006016008600195'],
- data['data']['target_wwn'])
+ self.assertEqual(set(['5006016A0860080F', '5006016008600195']),
+ set(data['data']['target_wwn']))
@mock.patch(
"cinder.zonemanager.fc_san_lookup_service.FCSanLookupService." +
wwnns = connector['wwnns']
wwpns = connector['wwpns']
wwns = [(node + port).upper() for node, port in zip(wwnns, wwpns)]
- return map(lambda wwn: re.sub(r'\S\S',
- lambda m: m.group(0) + ':',
- wwn,
- len(wwn) / 2 - 1),
- wwns)
+ return [re.sub(r'\S\S', lambda m: m.group(0) + ':',
+ wwn, len(wwn) // 2 - 1)
+ for wwn in wwns]
def _exec_command_setpath(self, initiator_uid, sp, port_id,
ip, host, vport_id=None):
pool_list)
pool_feature = (self._client.get_pool_feature_properties(poll=False)
if self.check_max_pool_luns_threshold else None)
- self.stats['pools'] = map(
- lambda pool: self._build_pool_stats(pool, pool_feature), pool_list)
+ self.stats['pools'] = [self._build_pool_stats(pool, pool_feature)
+ for pool in pool_list]
return self.stats
class CreateConsistencyGroupTask(task.Task):
"""Task to create a consistency group."""
def __init__(self, lun_id_key_template, num_of_members):
- self.lun_id_keys = set(
- [lun_id_key_template % i for i in range(num_of_members)])
+ self.lun_id_keys = sorted(set(
+ [lun_id_key_template % i for i in range(num_of_members)]))
super(CreateConsistencyGroupTask, self).__init__(
requires=self.lun_id_keys)
class WaitMigrationsCompleteTask(task.Task):
"""Task to wait migrations to be completed."""
def __init__(self, lun_id_key_template, num_of_members):
- self.lun_id_keys = set(
- [lun_id_key_template % i for i in range(num_of_members)])
+ self.lun_id_keys = sorted(set(
+ [lun_id_key_template % i for i in range(num_of_members)]))
super(WaitMigrationsCompleteTask, self).__init__(
requires=self.lun_id_keys)