diff --git a/bin/nova-manage b/bin/nova-manage index 7ac36595..a61b5c1d 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -1605,7 +1605,7 @@ class VsaDriveTypeCommands(object): if name is not None: search_opts['extra_specs']['name'] = name - if all == False: + if not all: search_opts['extra_specs']['visible'] = '1' drives = volume_types.get_all_types(self.context, @@ -1973,7 +1973,7 @@ class StorageManagerCommands(object): ctxt = context.get_admin_context() try: - if flavor == None: + if flavor is None: flavors = db.sm_flavor_get_all(ctxt) else: flavors = db.sm_flavor_get(ctxt, flavor) @@ -2015,7 +2015,7 @@ class StorageManagerCommands(object): ctxt = context.get_admin_context() try: - if backend_conf_id == None: + if backend_conf_id is None: backends = db.sm_backend_conf_get_all(ctxt) else: backends = db.sm_backend_conf_get(ctxt, backend_conf_id) @@ -2075,7 +2075,7 @@ class StorageManagerCommands(object): print '(WARNING: Creating will destroy all data on backend!!!)' c = raw_input('Proceed? (y/n) ') if c == 'y' or c == 'Y': - if flavor_label == None: + if flavor_label is None: print "error: backend needs to be associated with flavor" sys.exit(2) diff --git a/nova/common/cfg.py b/nova/common/cfg.py index 68c50593..54940e7d 100644 --- a/nova/common/cfg.py +++ b/nova/common/cfg.py @@ -821,7 +821,7 @@ class ConfigOpts(object): :return: False if the opt was already register, True otherwise :raises: DuplicateOptError, ArgsAlreadyParsedError """ - if self._args != None: + if self._args is not None: raise ArgsAlreadyParsedError("cannot register CLI option") if not self.register_opt(opt, group): diff --git a/nova/scheduler/vsa.py b/nova/scheduler/vsa.py index 7c167095..e4433694 100644 --- a/nova/scheduler/vsa.py +++ b/nova/scheduler/vsa.py @@ -130,8 +130,7 @@ class VsaScheduler(simple.SimpleScheduler): return filtered_hosts def _allowed_to_use_host(self, host, selected_hosts, unique): - if unique == False or \ - host not in [item[0] for item in selected_hosts]: + if not unique or host not in [item[0] for item in selected_hosts]: return True else: return False diff --git a/nova/tests/scheduler/test_distributed_scheduler.py b/nova/tests/scheduler/test_distributed_scheduler.py index 80781c04..047c8c51 100644 --- a/nova/tests/scheduler/test_distributed_scheduler.py +++ b/nova/tests/scheduler/test_distributed_scheduler.py @@ -236,11 +236,11 @@ class DistributedSchedulerTestCase(test.TestCase): for weighted_host in weighted_hosts: # We set this up so remote hosts have even weights ... if int(weighted_host.weight) % 2 == 0: - self.assertTrue(weighted_host.zone != None) - self.assertTrue(weighted_host.host == None) + self.assertTrue(weighted_host.zone is not None) + self.assertTrue(weighted_host.host is None) else: - self.assertTrue(weighted_host.host != None) - self.assertTrue(weighted_host.zone == None) + self.assertTrue(weighted_host.host is not None) + self.assertTrue(weighted_host.zone is None) def test_schedule_local_zone(self): """Test to make sure _schedule makes no call out to zones if @@ -270,8 +270,8 @@ class DistributedSchedulerTestCase(test.TestCase): self.assertEquals(len(weighted_hosts), 10) for weighted_host in weighted_hosts: # There should be no remote hosts - self.assertTrue(weighted_host.host != None) - self.assertTrue(weighted_host.zone == None) + self.assertTrue(weighted_host.host is not None) + self.assertTrue(weighted_host.zone is None) def test_decrypt_blob(self): """Test that the decrypt method works.""" diff --git a/nova/vsa/api.py b/nova/vsa/api.py index 7635b51c..4f6c5c27 100644 --- a/nova/vsa/api.py +++ b/nova/vsa/api.py @@ -68,10 +68,10 @@ class API(base.Base): super(API, self).__init__(**kwargs) def _check_volume_type_correctness(self, vol_type): - if vol_type.get('extra_specs') == None or\ + if vol_type.get('extra_specs') is None or\ vol_type['extra_specs'].get('type') != 'vsa_drive' or\ - vol_type['extra_specs'].get('drive_type') == None or\ - vol_type['extra_specs'].get('drive_size') == None: + vol_type['extra_specs'].get('drive_type') is None or\ + vol_type['extra_specs'].get('drive_size') is None: raise exception.ApiError(_("Invalid drive type %s") % vol_type['name']) @@ -162,7 +162,7 @@ class API(base.Base): if storage is None: storage = [] - if shared is None or shared == 'False' or shared == False: + if not shared or shared == 'False': shared = False else: shared = True