diff --git a/cinder/api/v2/limits.py b/cinder/api/v2/limits.py index e306fd5dd2a..fe31e611e82 100644 --- a/cinder/api/v2/limits.py +++ b/cinder/api/v2/limits.py @@ -168,6 +168,7 @@ class Limit(object): "resetTime": int(self.next_request or self._get_time()), } + # "Limit" format is a dictionary with the HTTP verb, human-readable URI, # a regular-expression to match, value and unit of measure (PER_DAY, etc.) diff --git a/cinder/api/validation/validators.py b/cinder/api/validation/validators.py index 0f8c46f1427..f182d9dc96c 100644 --- a/cinder/api/validation/validators.py +++ b/cinder/api/validation/validators.py @@ -171,11 +171,11 @@ def _validate_status(param_value): msg = _("The 'status' can not be empty.") raise exception.InvalidGroupSnapshotStatus(reason=msg) elif param_value.lower() not in c_fields.GroupSnapshotStatus.ALL: - msg = _("Group snapshot status: %(status)s is invalid, " - "valid statuses are: " - "%(valid)s.") % {'status': param_value, - 'valid': c_fields.GroupSnapshotStatus.ALL} - raise exception.InvalidGroupSnapshotStatus(reason=msg) + msg = _("Group snapshot status: %(status)s is invalid, " + "valid statuses are: " + "%(valid)s.") % {'status': param_value, + 'valid': c_fields.GroupSnapshotStatus.ALL} + raise exception.InvalidGroupSnapshotStatus(reason=msg) return True diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index 02ef3acf703..434475e54a6 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -103,6 +103,7 @@ def get_session(use_slave=False, **kwargs): def dispose_engine(): get_engine().dispose() + _DEFAULT_QUOTA_NAME = 'default' diff --git a/cinder/image/image_utils.py b/cinder/image/image_utils.py index 5a3368ff0a5..7dd4ee059ef 100644 --- a/cinder/image/image_utils.py +++ b/cinder/image/image_utils.py @@ -338,9 +338,9 @@ def verify_glance_image_signature(context, image_service, image_id, path): img_sig_cert_uuid, img_sig_hash_method, img_sig_key_type]): - LOG.error('Image signature metadata for image %s is ' - 'incomplete.', image_id) - raise exception.InvalidSignatureImage(image_id=image_id) + LOG.error('Image signature metadata for image %s is ' + 'incomplete.', image_id) + raise exception.InvalidSignatureImage(image_id=image_id) try: verifier = signature_utils.get_verifier( diff --git a/cinder/scheduler/evaluator/evaluator.py b/cinder/scheduler/evaluator/evaluator.py index f5f129b6aa7..0e7974b480c 100644 --- a/cinder/scheduler/evaluator/evaluator.py +++ b/cinder/scheduler/evaluator/evaluator.py @@ -221,6 +221,7 @@ class EvalBoolOrOp(object): right = self.value[2].eval() return left or right + _parser = None _vars = {} diff --git a/cinder/tests/functional/api_samples_test_base.py b/cinder/tests/functional/api_samples_test_base.py index 9f7a96af7f1..bacf528c43b 100644 --- a/cinder/tests/functional/api_samples_test_base.py +++ b/cinder/tests/functional/api_samples_test_base.py @@ -489,7 +489,7 @@ class ApiSampleTestBase(functional_helpers._FunctionalTestBase): body = self._read_template(name) % self.subs sample = self._get_sample(name) if self.generate_samples and not os.path.exists(sample): - self._write_sample(name, body) + self._write_sample(name, body) return self._get_response(url, method, body, headers=headers) def _do_put(self, url, name=None, subs=None, headers=None): diff --git a/cinder/tests/unit/api/contrib/test_quotas.py b/cinder/tests/unit/api/contrib/test_quotas.py index 4c582969731..a194f33c2eb 100644 --- a/cinder/tests/unit/api/contrib/test_quotas.py +++ b/cinder/tests/unit/api/contrib/test_quotas.py @@ -1046,11 +1046,11 @@ class QuotaSetsControllerNestedQuotasTest(QuotaSetsControllerTestBase): mock_usage.side_effect = self._fake_quota_usage_get_all_by_project class FakeUsage(object): - def __init__(self, in_use, reserved): - self.in_use = in_use - self.reserved = reserved - self.until_refresh = None - self.total = self.reserved + self.in_use + def __init__(self, in_use, reserved): + self.in_use = in_use + self.reserved = reserved + self.until_refresh = None + self.total = self.reserved + self.in_use def _fake__get_quota_usages(context, session, project_id, resources=None): diff --git a/cinder/tests/unit/api/contrib/test_volume_manage.py b/cinder/tests/unit/api/contrib/test_volume_manage.py index dc35ecb154e..ca5935a9b75 100644 --- a/cinder/tests/unit/api/contrib/test_volume_manage.py +++ b/cinder/tests/unit/api/contrib/test_volume_manage.py @@ -69,6 +69,7 @@ def service_get(context, service_id, backend_match_level=None, host=None, 'uuid': '4200b32b-0bf9-436c-86b2-0675f6ac218e'} raise exception.ServiceNotFound(service_id=host) + # Some of the tests check that volume types are correctly validated during a # volume manage operation. This data structure represents an existing volume # type. diff --git a/cinder/tests/unit/api/contrib/test_volume_type_access.py b/cinder/tests/unit/api/contrib/test_volume_type_access.py index 5071eebeeb5..cb03a624722 100644 --- a/cinder/tests/unit/api/contrib/test_volume_type_access.py +++ b/cinder/tests/unit/api/contrib/test_volume_type_access.py @@ -38,6 +38,7 @@ def generate_type(type_id, is_public): 'is_public': bool(is_public) } + VOLUME_TYPES = { fake.VOLUME_TYPE_ID: generate_type(fake.VOLUME_TYPE_ID, True), fake.VOLUME_TYPE2_ID: generate_type(fake.VOLUME_TYPE2_ID, True), diff --git a/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py b/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py index 87dadaf10a2..92c3095b54e 100644 --- a/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py +++ b/cinder/tests/unit/volume/drivers/dell_emc/test_ps.py @@ -426,22 +426,22 @@ class PSSeriesISCSIDriverTestCase(test.TestCase): self.assert_volume_stats(stats) def assert_volume_stats(self, stats): - thin_enabled = self.configuration.san_thin_provision - self.assertEqual(float('111.0'), stats['total_capacity_gb']) - self.assertEqual(float('11.0'), stats['free_capacity_gb']) - self.assertEqual(100, stats['total_volumes']) + thin_enabled = self.configuration.san_thin_provision + self.assertEqual(float('111.0'), stats['total_capacity_gb']) + self.assertEqual(float('11.0'), stats['free_capacity_gb']) + self.assertEqual(100, stats['total_volumes']) - if thin_enabled: - self.assertEqual(80.0, stats['provisioned_capacity_gb']) - else: - space = stats['total_capacity_gb'] - stats['free_capacity_gb'] - self.assertEqual(space, stats['provisioned_capacity_gb']) + if thin_enabled: + self.assertEqual(80.0, stats['provisioned_capacity_gb']) + else: + space = stats['total_capacity_gb'] - stats['free_capacity_gb'] + self.assertEqual(space, stats['provisioned_capacity_gb']) - self.assertEqual(thin_enabled, stats['thin_provisioning_support']) - self.assertEqual(not thin_enabled, - stats['thick_provisioning_support']) - self.assertEqual('Dell EMC', stats['vendor_name']) - self.assertFalse(stats['multiattach']) + self.assertEqual(thin_enabled, stats['thin_provisioning_support']) + self.assertEqual(not thin_enabled, + stats['thick_provisioning_support']) + self.assertEqual('Dell EMC', stats['vendor_name']) + self.assertFalse(stats['multiattach']) def test_get_space_in_gb(self): self.assertEqual(123.0, self.driver._get_space_in_gb('123.0GB')) diff --git a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py index 0c0dad02bce..9172d78eb57 100644 --- a/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py +++ b/cinder/tests/unit/volume/drivers/hpe/test_hpe3par.py @@ -10167,6 +10167,7 @@ class TestHPE3PARISCSIDriver(HPE3PARBaseDriver): expected + self.standard_logout) + VLUNS5_RET = ({'members': [{'portPos': {'node': 0, 'slot': 8, 'cardPort': 2}, 'active': True}, diff --git a/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py b/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py index 095e0d37c47..3e9678fa507 100644 --- a/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py +++ b/cinder/tests/unit/volume/drivers/ibm/test_xiv_proxy.py @@ -760,29 +760,29 @@ class XIVProxyTest(test.TestCase): "xiv_replication.VolumeReplication.create_replication", mock.MagicMock()) def test_create_volume_with_consistency_group_diff_state(self): - """Test Create volume with consistency_group but diff state""" - driver = mock.MagicMock() - driver.VERSION = "VERSION" + """Test Create volume with consistency_group but diff state""" + driver = mock.MagicMock() + driver.VERSION = "VERSION" - p = self.proxy( - self.default_storage_info, - mock.MagicMock(), - test_mock.cinder.exception, - driver) + p = self.proxy( + self.default_storage_info, + mock.MagicMock(), + test_mock.cinder.exception, + driver) - p.ibm_storage_cli = mock.MagicMock() - p._cg_name_from_volume = mock.MagicMock(return_value="cg") + p.ibm_storage_cli = mock.MagicMock() + p._cg_name_from_volume = mock.MagicMock(return_value="cg") - vol_type = testutils.create_volume_type(self.ctxt, name='WTF') - volume = testutils.create_volume( - self.ctxt, size=16, volume_type_id=vol_type.id, - host=self._get_test_host()['name']) + vol_type = testutils.create_volume_type(self.ctxt, name='WTF') + volume = testutils.create_volume( + self.ctxt, size=16, volume_type_id=vol_type.id, + host=self._get_test_host()['name']) - grp = self._create_test_group('WTF') - grp['replication_status'] = 'enabled' - volume.group = grp - ex = getattr(p, "_get_exception")() - self.assertRaises(ex, p.create_volume, volume) + grp = self._create_test_group('WTF') + grp['replication_status'] = 'enabled' + volume.group = grp + ex = getattr(p, "_get_exception")() + self.assertRaises(ex, p.create_volume, volume) @mock.patch("cinder.volume.drivers.ibm.ibm_storage." "xiv_replication.VolumeReplication.create_replication", diff --git a/cinder/tests/unit/volume/drivers/netapp/dataontap/fakes.py b/cinder/tests/unit/volume/drivers/netapp/dataontap/fakes.py index 48f303a038a..bad0135c2a6 100644 --- a/cinder/tests/unit/volume/drivers/netapp/dataontap/fakes.py +++ b/cinder/tests/unit/volume/drivers/netapp/dataontap/fakes.py @@ -502,6 +502,7 @@ class test_volume(object): def __getitem__(self, key): return getattr(self, key) + test_volume = test_volume() test_volume.id = {'vserver': 'openstack', 'name': 'vola'} test_volume.aggr = { @@ -529,6 +530,7 @@ class test_snapshot(object): def __getitem__(self, key): return getattr(self, key) + test_snapshot = test_snapshot() test_snapshot.id = 'fake_snap_id' test_snapshot.name = 'snapshot-%s' % test_snapshot.id diff --git a/cinder/tests/unit/volume/drivers/nexenta/test_nexenta_edge.py b/cinder/tests/unit/volume/drivers/nexenta/test_nexenta_edge.py index e96b66881e5..8460b7ea8cd 100644 --- a/cinder/tests/unit/volume/drivers/nexenta/test_nexenta_edge.py +++ b/cinder/tests/unit/volume/drivers/nexenta/test_nexenta_edge.py @@ -114,11 +114,11 @@ class TestNexentaEdgeISCSIDriver(test.TestCase): ] def my_side_effect(*args, **kwargs): - return {'data': { - 'X-ISCSI-TargetName': ISCSI_TARGET_NAME, - 'X-ISCSI-TargetID': 1, - 'X-VIPS': json.dumps(vips)} - } + return {'data': { + 'X-ISCSI-TargetName': ISCSI_TARGET_NAME, + 'X-ISCSI-TargetID': 1, + 'X-VIPS': json.dumps(vips)} + } self.mock_api.side_effect = my_side_effect self.driver.do_setup(self.context) @@ -132,11 +132,11 @@ class TestNexentaEdgeISCSIDriver(test.TestCase): ] def my_side_effect(*args, **kwargs): - return {'data': { - 'X-ISCSI-TargetName': ISCSI_TARGET_NAME, - 'X-ISCSI-TargetID': 1, - 'X-VIPS': json.dumps(vips)} - } + return {'data': { + 'X-ISCSI-TargetName': ISCSI_TARGET_NAME, + 'X-ISCSI-TargetID': 1, + 'X-VIPS': json.dumps(vips)} + } self.mock_api.side_effect = my_side_effect self.assertRaises(utils.NexentaException, diff --git a/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py b/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py index b06e6afd136..5d329d78202 100644 --- a/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py +++ b/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py @@ -56,6 +56,7 @@ class mock_vref(object): def get(self, item, arg2 = None): return self.__dict__[item] + f_uuid = ['262b9ce2-a71a-4fbe-830c-c20c5596caea', '362b9ce2-a71a-4fbe-830c-c20c5596caea'] diff --git a/cinder/tests/unit/volume/drivers/synology/test_synology_common.py b/cinder/tests/unit/volume/drivers/synology/test_synology_common.py index 5af4af351fd..0f1cdb275e3 100644 --- a/cinder/tests/unit/volume/drivers/synology/test_synology_common.py +++ b/cinder/tests/unit/volume/drivers/synology/test_synology_common.py @@ -144,12 +144,12 @@ FAKE_PATH = 'fake.cgi' class MockResponse(object): - def __init__(self, json_data, status_code): - self.json_data = json_data - self.status_code = status_code + def __init__(self, json_data, status_code): + self.json_data = json_data + self.status_code = status_code - def json(self): - return self.json_data + def json(self): + return self.json_data class SynoSessionTestCase(test.TestCase): diff --git a/cinder/tests/unit/volume/drivers/test_datera.py b/cinder/tests/unit/volume/drivers/test_datera.py index 3030409e167..2ffc5d1351d 100644 --- a/cinder/tests/unit/volume/drivers/test_datera.py +++ b/cinder/tests/unit/volume/drivers/test_datera.py @@ -617,6 +617,7 @@ class DateraVolumeTestCasev21(DateraVolumeTestCasev2): self._apiv = '2.1' self._tenant = self.cfg.datera_tenant_id + stub_acl = { 'initiator_groups': [ '/initiator_groups/IG-8739f309-dae9-4534-aa02-5b8e9e96eefd'], diff --git a/cinder/tests/unit/volume/drivers/test_lvm_driver.py b/cinder/tests/unit/volume/drivers/test_lvm_driver.py index d25c5b96521..e58ab77640f 100644 --- a/cinder/tests/unit/volume/drivers/test_lvm_driver.py +++ b/cinder/tests/unit/volume/drivers/test_lvm_driver.py @@ -610,11 +610,11 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): 'rename_volume') as mock_rename_volume, \ mock.patch.object(self.volume.driver.vg, 'get_volume', self._get_manage_existing_lvs): - mock_rename_volume.return_value = _rename_volume - size = self.volume.driver.manage_existing_get_size(vol, ref) - self.assertEqual(2, size) - model_update = self.volume.driver.manage_existing(vol, ref) - self.assertIsNone(model_update) + mock_rename_volume.return_value = _rename_volume + size = self.volume.driver.manage_existing_get_size(vol, ref) + self.assertEqual(2, size) + model_update = self.volume.driver.manage_existing(vol, ref) + self.assertIsNone(model_update) def test_lvm_manage_existing_bad_size(self): """Make sure correct exception on bad size returned from LVM. @@ -673,13 +673,13 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): 'rename_volume') as mock_rename_volume, \ mock.patch.object(self.volume.driver.vg, 'get_volume', self._get_manage_existing_lvs): - mock_rename_volume.return_value = _rename_volume - size = self.volume.driver.manage_existing_snapshot_get_size( - snp, ref) - self.assertEqual(2, size) - model_update = self.volume.driver.manage_existing_snapshot( - snp, ref) - self.assertIsNone(model_update) + mock_rename_volume.return_value = _rename_volume + size = self.volume.driver.manage_existing_snapshot_get_size( + snp, ref) + self.assertEqual(2, size) + model_update = self.volume.driver.manage_existing_snapshot( + snp, ref) + self.assertIsNone(model_update) def test_lvm_manage_existing_snapshot_bad_ref(self): """Error case where specified LV snapshot doesn't exist. diff --git a/cinder/tests/unit/volume/drivers/test_nfs.py b/cinder/tests/unit/volume/drivers/test_nfs.py index 20ed172b424..8da14080574 100644 --- a/cinder/tests/unit/volume/drivers/test_nfs.py +++ b/cinder/tests/unit/volume/drivers/test_nfs.py @@ -299,6 +299,7 @@ class RemoteFsDriverTestCase(test.TestCase): ret_flag = drv.secure_file_operations_enabled() self.assertFalse(ret_flag) + # NFS configuration scenarios NFS_CONFIG1 = {'max_over_subscription_ratio': 1.0, 'reserved_percentage': 0, diff --git a/cinder/tests/unit/volume/drivers/test_pure.py b/cinder/tests/unit/volume/drivers/test_pure.py index 31e2828eefd..f92af734f2d 100644 --- a/cinder/tests/unit/volume/drivers/test_pure.py +++ b/cinder/tests/unit/volume/drivers/test_pure.py @@ -38,6 +38,7 @@ def fake_retry(exceptions, interval=1, retries=3, backoff_rate=2): return f return _decorator + patch_retry = mock.patch('cinder.utils.retry', fake_retry) patch_retry.start() sys.modules['purestorage'] = mock.Mock() diff --git a/cinder/tests/unit/volume/test_volume.py b/cinder/tests/unit/volume/test_volume.py index 7be652058e8..3e6c1e4b1c7 100644 --- a/cinder/tests/unit/volume/test_volume.py +++ b/cinder/tests/unit/volume/test_volume.py @@ -2003,14 +2003,14 @@ class VolumeTestCase(base.BaseVolumeTestCase): self.volume.driver, 'delete_volume') as mock_driver_delete,\ mock.patch.object( self.volume, '_copy_volume_data') as mock_copy: - temp_volume = tests_utils.create_volume(self.context, - status='available') - mock_temp.return_value = temp_volume - self.volume._revert_to_snapshot_generic( - self.context, fake_volume, fake_snapshot) - mock_copy.assert_called_once_with( - self.context, temp_volume, fake_volume) - mock_driver_delete.assert_called_once_with(temp_volume) + temp_volume = tests_utils.create_volume(self.context, + status='available') + mock_temp.return_value = temp_volume + self.volume._revert_to_snapshot_generic( + self.context, fake_volume, fake_snapshot) + mock_copy.assert_called_once_with( + self.context, temp_volume, fake_volume) + mock_driver_delete.assert_called_once_with(temp_volume) @ddt.data({'driver_error': True}, {'driver_error': False}) diff --git a/cinder/tests/unit/volume/test_volume_migration.py b/cinder/tests/unit/volume/test_volume_migration.py index 14bff8401a1..809ef460ce6 100644 --- a/cinder/tests/unit/volume/test_volume_migration.py +++ b/cinder/tests/unit/volume/test_volume_migration.py @@ -585,9 +585,9 @@ class VolumeMigrationTestCase(base.BaseVolumeTestCase): def fake_attach_volume(self, ctxt, volume, instance_uuid, host_name, mountpoint, mode): - tests_utils.attach_volume(ctxt, volume.id, - instance_uuid, host_name, - '/dev/vda') + tests_utils.attach_volume(ctxt, volume.id, + instance_uuid, host_name, + '/dev/vda') def _test_migrate_volume_completion(self, status='available', instance_uuid=None, attached_host=None, diff --git a/cinder/volume/drivers/dell_emc/powermax/utils.py b/cinder/volume/drivers/dell_emc/powermax/utils.py index 329e39ee84f..9ca162ea165 100644 --- a/cinder/volume/drivers/dell_emc/powermax/utils.py +++ b/cinder/volume/drivers/dell_emc/powermax/utils.py @@ -479,9 +479,9 @@ class PowerMaxUtils(object): """ if volume is not None: if volume.get('replication_status') and ( - volume.replication_status == + volume.replication_status == fields.ReplicationStatus.FAILED_OVER): - return True + return True return False @staticmethod diff --git a/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py b/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py index 34d0b9e37b8..5946dc20a13 100644 --- a/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py +++ b/cinder/volume/drivers/dell_emc/sc/storagecenter_api.py @@ -1219,8 +1219,8 @@ class SCApi(object): # at least give failback a shot. if lv and (self.is_swapped(provider_id, lv) and not self.failed_over and self._autofailback(lv)): - lv = self.get_live_volume(provider_id) - LOG.info('After failback %s', lv) + lv = self.get_live_volume(provider_id) + LOG.info('After failback %s', lv) # Make sure we still have a LV. if lv: # At this point if the secondaryRole is Active we have diff --git a/cinder/volume/drivers/hpe/hpe_3par_common.py b/cinder/volume/drivers/hpe/hpe_3par_common.py index 30efc8bd389..ca54b3d92be 100644 --- a/cinder/volume/drivers/hpe/hpe_3par_common.py +++ b/cinder/volume/drivers/hpe/hpe_3par_common.py @@ -3523,9 +3523,9 @@ class HPE3PARCommon(object): # Check to see if the user requested to failback. if (secondary_backend_id and secondary_backend_id == self.FAILBACK_VALUE): - failover = False - target_id = None - group_target_id = self.FAILBACK_VALUE + failover = False + target_id = None + group_target_id = self.FAILBACK_VALUE else: # Find the failover target. failover_target = None @@ -4136,11 +4136,11 @@ class HPE3PARCommon(object): if not retype: self.client.deleteVolume(vol_name) except hpeexceptions.HTTPConflict as ex: - if ex.get_code() == 34: - # This is a special case which means the - # volume is part of a volume set. - self._delete_vvset(volume) - self.client.deleteVolume(vol_name) + if ex.get_code() == 34: + # This is a special case which means the + # volume is part of a volume set. + self._delete_vvset(volume) + self.client.deleteVolume(vol_name) except Exception: pass diff --git a/cinder/volume/drivers/ibm/ibm_storage/ds8k_connection.py b/cinder/volume/drivers/ibm/ibm_storage/ds8k_connection.py index 5e850fc5608..36f283b40fe 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ds8k_connection.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ds8k_connection.py @@ -146,6 +146,7 @@ class DS8KConnectionPool(connectionpool.HTTPSConnectionPool): url = 'https://' + url[12:] return super(DS8KConnectionPool, self).urlopen(method, url, **kwargs) + if hasattr(poolmanager, 'key_fn_by_scheme'): poolmanager.key_fn_by_scheme["httpsds8k"] = ( poolmanager.key_fn_by_scheme["https"]) diff --git a/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py b/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py index 93735b6e4d4..ac374f1cfe9 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ds8k_proxy.py @@ -572,10 +572,10 @@ class DS8KProxy(proxy.IBMStorageProxy): excluded_lss.add(lun.pool_lss_pair['source'][1]) if lun.group and (lun.group.consisgroup_snapshot_enabled or lun.group.consisgroup_replication_enabled): - msg = _("The reserve LSS for CG is full. " - "Volume can not be created on it.") - LOG.error(msg) - raise exception.VolumeDriverException(message=msg) + msg = _("The reserve LSS for CG is full. " + "Volume can not be created on it.") + LOG.error(msg) + raise exception.VolumeDriverException(message=msg) else: LOG.warning("LSS %s is full, find another one.", lun.pool_lss_pair['source'][1]) diff --git a/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py b/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py index 0d6363d108e..80741029e3d 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py +++ b/cinder/volume/drivers/ibm/ibm_storage/xiv_proxy.py @@ -802,8 +802,8 @@ class XIVProxy(proxy.IBMStorageProxy): volume, not failback) if result: - status = goal_status - group_updated['replication_status'] = status + status = goal_status + group_updated['replication_status'] = status else: status = 'error' updates = {'status': vol_goal_status} diff --git a/cinder/volume/drivers/netapp/dataontap/block_cmode.py b/cinder/volume/drivers/netapp/dataontap/block_cmode.py index 5bf9a2da0c3..34b163e6640 100644 --- a/cinder/volume/drivers/netapp/dataontap/block_cmode.py +++ b/cinder/volume/drivers/netapp/dataontap/block_cmode.py @@ -511,26 +511,26 @@ class NetAppBlockStorageCmodeLibrary(block_base.NetAppBlockStorageLibrary, return None, None def _create_consistent_group_snapshot(self, group_snapshot, snapshots): - flexvols = set() - for snapshot in snapshots: - flexvols.add(volume_utils.extract_host( - snapshot['volume']['host'], level='pool')) + flexvols = set() + for snapshot in snapshots: + flexvols.add(volume_utils.extract_host( + snapshot['volume']['host'], level='pool')) - self.zapi_client.create_cg_snapshot(flexvols, group_snapshot['id']) + self.zapi_client.create_cg_snapshot(flexvols, group_snapshot['id']) - for snapshot in snapshots: - self._clone_lun(snapshot['volume']['name'], snapshot['name'], - source_snapshot=group_snapshot['id']) + for snapshot in snapshots: + self._clone_lun(snapshot['volume']['name'], snapshot['name'], + source_snapshot=group_snapshot['id']) - for flexvol in flexvols: - try: - self.zapi_client.wait_for_busy_snapshot( - flexvol, group_snapshot['id']) - self.zapi_client.delete_snapshot( - flexvol, group_snapshot['id']) - except exception.SnapshotIsBusy: - self.zapi_client.mark_snapshot_for_deletion( - flexvol, group_snapshot['id']) + for flexvol in flexvols: + try: + self.zapi_client.wait_for_busy_snapshot( + flexvol, group_snapshot['id']) + self.zapi_client.delete_snapshot( + flexvol, group_snapshot['id']) + except exception.SnapshotIsBusy: + self.zapi_client.mark_snapshot_for_deletion( + flexvol, group_snapshot['id']) def delete_group_snapshot(self, group_snapshot, snapshots): """Delete LUNs backing each snapshot in the group snapshot. diff --git a/cinder/volume/drivers/pure.py b/cinder/volume/drivers/pure.py index e1ea9d3029d..e2b22273335 100644 --- a/cinder/volume/drivers/pure.py +++ b/cinder/volume/drivers/pure.py @@ -1527,12 +1527,12 @@ class PureBaseVolumeDriver(san.SanDriver): if volume_type and volume_type.is_replicated(): specs = volume_type.get("extra_specs") if specs and EXTRA_SPECS_REPL_TYPE in specs: - replication_type_spec = specs[EXTRA_SPECS_REPL_TYPE] - # Do not validate settings, ignore invalid. - if replication_type_spec == " async": - return REPLICATION_TYPE_ASYNC - elif replication_type_spec == " sync": - return REPLICATION_TYPE_SYNC + replication_type_spec = specs[EXTRA_SPECS_REPL_TYPE] + # Do not validate settings, ignore invalid. + if replication_type_spec == " async": + return REPLICATION_TYPE_ASYNC + elif replication_type_spec == " sync": + return REPLICATION_TYPE_SYNC else: # if no type was specified but replication is enabled assume # that async replication is enabled @@ -2147,9 +2147,9 @@ class PureBaseVolumeDriver(san.SanDriver): def _find_async_failover_target(self): if not self._replication_target_arrays: - raise PureDriverException( - reason=_("Unable to find failover target, no " - "secondary targets configured.")) + raise PureDriverException( + reason=_("Unable to find failover target, no " + "secondary targets configured.")) secondary_array = None pg_snap = None for array in self._replication_target_arrays: diff --git a/cinder/volume/drivers/veritas/utils.py b/cinder/volume/drivers/veritas/utils.py index 182f0bc3d92..80289990d9b 100644 --- a/cinder/volume/drivers/veritas/utils.py +++ b/cinder/volume/drivers/veritas/utils.py @@ -261,8 +261,8 @@ def get_configuration(persona): except (exception.ErrorInSendingMsg, exception.UnableToExecuteHyperScaleCmd, exception.UnableToProcessHyperScaleCmdOutput): - LOG.exception("Failed to get configuration from controller") - raise exception.ErrorInFetchingConfiguration(persona=persona) + LOG.exception("Failed to get configuration from controller") + raise exception.ErrorInFetchingConfiguration(persona=persona) return configuration diff --git a/cinder/volume/flows/manager/create_volume.py b/cinder/volume/flows/manager/create_volume.py index d11d2052e6e..f701c4c68ea 100644 --- a/cinder/volume/flows/manager/create_volume.py +++ b/cinder/volume/flows/manager/create_volume.py @@ -752,8 +752,8 @@ class CreateVolumeFromSpecTask(flow_utils.CinderTask): if should_create_cache_entry: if virtual_size and virtual_size != original_size: - volume.size = virtual_size - volume.save() + volume.size = virtual_size + volume.save() model_update = self._create_from_image_download( context, volume, diff --git a/cinder/volume/manager.py b/cinder/volume/manager.py index 3722a88479d..cad6f304f06 100644 --- a/cinder/volume/manager.py +++ b/cinder/volume/manager.py @@ -4132,8 +4132,8 @@ class VolumeManager(manager.CleanableManager, new_volume.update(model_update_new) new_volume.save() with volume.obj_as_admin(): - volume.update(model_update_default) - volume.save() + volume.update(model_update_default) + volume.save() # Replication V2.1 and a/a method def failover(self, context, secondary_backend_id=None): diff --git a/tox.ini b/tox.ini index bd5f881b4e5..98d19d378cb 100644 --- a/tox.ini +++ b/tox.ini @@ -193,8 +193,7 @@ usedevelop = False # reason: no agreement on this being universally # preferable for our code. Disabled to keep checking # tools from getting in our way with regards to this. -# E117/E305 - new rules, just disabled here temporarily. -ignore = E251,E402,W503,W504,E117,E305 +ignore = E251,E402,W503,W504 # H904 Delay string interpolations at logging calls. enable-extensions = H106,H203,H904 exclude = .git,.venv,.tox,dist,tools,doc/ext,*egg,build