diff --git a/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py b/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py index c588911bb4b..5ee2891d683 100644 --- a/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py +++ b/cinder/tests/unit/volume/drivers/inspur/as13000/test_as13000_driver.py @@ -997,7 +997,7 @@ class AS13000DriverTestCase(test.TestCase): host_exist, target_name, node = ( self.as13000_san._get_target_from_conn(host_ip)) - if host_ip is 'fake_ip3': + if host_ip == 'fake_ip3': self.assertEqual((True, 'fake_target_2', ['fake_node4', 'fake_node3']), (host_exist, target_name, node)) diff --git a/cinder/tests/unit/volume/drivers/nec/test_volume.py b/cinder/tests/unit/volume/drivers/nec/test_volume.py index adb3d853fa1..ba4fcf1f894 100644 --- a/cinder/tests/unit/volume/drivers/nec/test_volume.py +++ b/cinder/tests/unit/volume/drivers/nec/test_volume.py @@ -535,7 +535,7 @@ class NominatePoolLDTest(volume_helper.MStorageDSVDriver, test.TestCase): # config:pool_backup_pools=[2] self.pools[1]['free'] = savePool1 - if len(self.pools[0]['ld_list']) is 1024: + if len(self.pools[0]['ld_list']) == 1024: savePool2 = self.pools[2]['free'] savePool3 = self.pools[3]['free'] self.pools[2]['free'] = 0 diff --git a/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py b/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py index 89d86777128..5d74e46238a 100644 --- a/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py +++ b/cinder/tests/unit/volume/drivers/solidfire/test_solidfire.py @@ -183,7 +183,7 @@ class SolidFireVolumeTestCase(test.TestCase): def fake_issue_api_request(obj, method, params, version='1.0', endpoint=None): - if method is 'GetClusterCapacity': + if method == 'GetClusterCapacity': data = {} if version == '1.0': data = {'result': {'clusterCapacity': { @@ -220,7 +220,7 @@ class SolidFireVolumeTestCase(test.TestCase): 'clusterRecentIOSize': 0}}} return data - elif method is 'GetClusterInfo': + elif method == 'GetClusterInfo': results = { 'result': {'clusterInfo': @@ -233,7 +233,7 @@ class SolidFireVolumeTestCase(test.TestCase): 'attributes': {}}}} return results - elif method is 'GetClusterVersionInfo': + elif method == 'GetClusterVersionInfo': return {'id': None, 'result': {'softwareVersionInfo': {'pendingVersion': '8.2.1.4', 'packageName': '', @@ -242,10 +242,10 @@ class SolidFireVolumeTestCase(test.TestCase): 'clusterVersion': '8.2.1.4', 'clusterAPIVersion': '8.2'}} - elif method is 'AddAccount' and version == '1.0': + elif method == 'AddAccount' and version == '1.0': return {'result': {'accountID': 25}, 'id': 1} - elif method is 'GetAccountByName' and version == '1.0': + elif method == 'GetAccountByName' and version == '1.0': results = {'result': {'account': {'accountID': 25, 'username': params['username'], @@ -257,25 +257,25 @@ class SolidFireVolumeTestCase(test.TestCase): "id": 1} return results - elif method is 'CreateVolume' and version == '1.0': + elif method == 'CreateVolume' and version == '1.0': return {'result': {'volumeID': 5}, 'id': 1} - elif method is 'CreateSnapshot' and version == '6.0': + elif method == 'CreateSnapshot' and version == '6.0': return {'result': {'snapshotID': 5}, 'id': 1} - elif method is 'DeleteVolume' and version == '1.0': + elif method == 'DeleteVolume' and version == '1.0': return {'result': {}, 'id': 1} - elif method is 'ModifyVolume' and version == '5.0': + elif method == 'ModifyVolume' and version == '5.0': return {'result': {}, 'id': 1} - elif method is 'CloneVolume': + elif method == 'CloneVolume': return {'result': {'volumeID': 6}, 'id': 2} - elif method is 'ModifyVolume': + elif method == 'ModifyVolume': return {'result': {}, 'id': 1} - elif method is 'ListVolumesForAccount' and version == '1.0': + elif method == 'ListVolumesForAccount' and version == '1.0': test_name = 'OS-VOLID-a720b3c0-d1f0-11e1-9b23-0800200c9a66' result = {'result': { 'volumes': [{'volumeID': 5, @@ -291,7 +291,7 @@ class SolidFireVolumeTestCase(test.TestCase): 'iqn': test_name}]}} return result - elif method is 'ListActiveVolumes': + elif method == 'ListActiveVolumes': test_name = "existing_volume" result = {'result': { 'volumes': [{'volumeID': 5, @@ -306,7 +306,7 @@ class SolidFireVolumeTestCase(test.TestCase): 'qos': None, 'iqn': test_name}]}} return result - elif method is 'ListVolumes': + elif method == 'ListVolumes': test_name = "get_sfvol_by_cinder" result = {'result': { 'volumes': [{'volumeID': 5, @@ -337,13 +337,13 @@ class SolidFireVolumeTestCase(test.TestCase): != params['startVolumeID']] result['result']['volumes'] = selected_volumes return result - elif method is 'DeleteSnapshot': + elif method == 'DeleteSnapshot': return {'result': {}} - elif method is 'GetClusterVersionInfo': + elif method == 'GetClusterVersionInfo': return {'result': {'clusterAPIVersion': '8.0'}} - elif method is 'StartVolumePairing': + elif method == 'StartVolumePairing': return {'result': {'volumePairingKey': 'fake-pairing-key'}} - elif method is 'RollbackToSnapshot': + elif method == 'RollbackToSnapshot': return { "id": 1, "result": { @@ -368,7 +368,7 @@ class SolidFireVolumeTestCase(test.TestCase): "snapshotID": 1 } } - elif method is 'ListAccounts': + elif method == 'ListAccounts': return { 'result': { 'accounts': [{ diff --git a/cinder/tests/unit/volume/drivers/test_pure.py b/cinder/tests/unit/volume/drivers/test_pure.py index 2ea0fb5b02a..6a4cb6537f8 100644 --- a/cinder/tests/unit/volume/drivers/test_pure.py +++ b/cinder/tests/unit/volume/drivers/test_pure.py @@ -506,7 +506,7 @@ class PureDriverTestCase(test.TestCase): self.purestorage_module.PureHTTPError = FakePureStorageHTTPError def fake_get_array(*args, **kwargs): - if 'action' in kwargs and kwargs['action'] is 'monitor': + if 'action' in kwargs and kwargs['action'] == 'monitor': return PERF_INFO_RAW if 'space' in kwargs and kwargs['space'] is True: diff --git a/cinder/utils.py b/cinder/utils.py index b601083eade..0f101378408 100644 --- a/cinder/utils.py +++ b/cinder/utils.py @@ -587,7 +587,7 @@ def get_blkdev_major_minor(path, lookup_for_file=True): # lookup the mounted disk which the file lies on out, _err = execute('df', path) devpath = out.split("\n")[1].split()[0] - if devpath[0] is not '/': + if devpath[0] != '/': # the file is on a network file system return None return get_blkdev_major_minor(devpath, False) diff --git a/cinder/volume/drivers/hedvig/rest_client.py b/cinder/volume/drivers/hedvig/rest_client.py index 34db4952e04..50bf9972b5c 100644 --- a/cinder/volume/drivers/hedvig/rest_client.py +++ b/cinder/volume/drivers/hedvig/rest_client.py @@ -49,7 +49,7 @@ class RestClient(object): def connect(self): self.store_node_map(self.nodes) - if len(self.nodeMap) is 0: + if len(self.nodeMap) == 0: msg = _('Unable to connect to the nodes') raise exception.VolumeDriverException(msg) diff --git a/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py b/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py index 80bfd94403d..0ba10006734 100644 --- a/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py +++ b/cinder/volume/drivers/ibm/ibm_storage/ds8k_helper.py @@ -175,7 +175,7 @@ class DS8KCommonHelper(object): 'the end.')) lss_range = lss_range.replace('-', ' - ').split() for index, lss in enumerate(lss_range): - if lss is '-': + if lss == '-': try: begin = int(lss_range[index - 1], 16) end = int(lss_range[index + 1], 16) diff --git a/cinder/volume/drivers/synology/synology_common.py b/cinder/volume/drivers/synology/synology_common.py index 8db8f5386fd..655ccba0095 100644 --- a/cinder/volume/drivers/synology/synology_common.py +++ b/cinder/volume/drivers/synology/synology_common.py @@ -890,7 +890,7 @@ class SynoCommon(object): if os_name == 'DSM UC': return elif (os_name == 'DSM' and - ((6 > major) or (major is 6 and minor is 0 and hotfix < 2))): + ((6 > major) or (major == 6 and minor == 0 and hotfix < 2))): m = (_('DS version %s is not supported') % firmware_version) raise exception.VolumeDriverException(message=m)