diff options
| author | lzyeval <lzyeval@gmail.com> | 2011-12-31 12:23:56 +0800 |
|---|---|---|
| committer | lzyeval <lzyeval@gmail.com> | 2012-01-04 07:32:13 +0800 |
| commit | 88ccade9d5700db881f2ffc53e4a48a76e92c2db (patch) | |
| tree | f8da941637a68a89705ac7e717992ac8b7d44fc7 /nova/volume | |
| parent | 6f0ef4240fc42f3bf4e7b59cd83997edddb3c985 (diff) | |
PEP8 type comparison cleanup
Fixes bug #910295
The None, True, and False values are singletons.
All variable *comparisons* to singletons should use 'is' or 'is not'.
All variable *evaluations* to boolean should use 'if' or 'if not'.
"== None", "== True", "== False", and "!= None" comparisons in sqlalchemy's
where(), or_(), filter(), and_(), and select() functions should not be changed.
Incorrect comparisons or evaluations in comments were not changed.
Change-Id: I087f0883bf115b5fe714ccfda86a794b9b2a87f7
Diffstat (limited to 'nova/volume')
| -rw-r--r-- | nova/volume/api.py | 2 | ||||
| -rw-r--r-- | nova/volume/manager.py | 2 | ||||
| -rw-r--r-- | nova/volume/xensm.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/nova/volume/api.py b/nova/volume/api.py index b4d5ac48d..1cfe8a3b6 100644 --- a/nova/volume/api.py +++ b/nova/volume/api.py @@ -42,7 +42,7 @@ class API(base.Base): def create(self, context, size, snapshot_id, name, description, volume_type=None, metadata=None, availability_zone=None): - if snapshot_id != None: + if snapshot_id is not None: snapshot = self.get_snapshot(context, snapshot_id) if snapshot['status'] != "available": raise exception.ApiError( diff --git a/nova/volume/manager.py b/nova/volume/manager.py index 5332f9d1e..19c2eb9c0 100644 --- a/nova/volume/manager.py +++ b/nova/volume/manager.py @@ -111,7 +111,7 @@ class VolumeManager(manager.SchedulerDependentManager): vol_size = volume_ref['size'] LOG.debug(_("volume %(vol_name)s: creating lv of" " size %(vol_size)sG") % locals()) - if snapshot_id == None: + if snapshot_id is None: model_update = self.driver.create_volume(volume_ref) else: snapshot_ref = self.db.snapshot_get(context, snapshot_id) diff --git a/nova/volume/xensm.py b/nova/volume/xensm.py index dab14b689..a50362899 100644 --- a/nova/volume/xensm.py +++ b/nova/volume/xensm.py @@ -53,7 +53,7 @@ class XenSMDriver(VolumeDriver): params['sr_type'] = backend_ref['sr_type'] - if backend_ref['sr_uuid'] == None: + if backend_ref['sr_uuid'] is None: # run the sr create command try: LOG.debug(_('SR name = %s') % label) |
