Change in vdsm[master]: pep8: fix 2 errors and ignore plenty of others
danken at redhat.com
danken at redhat.com
Tue Oct 23 22:32:57 UTC 2012
Dan Kenigsberg has uploaded a new change for review.
Change subject: pep8: fix 2 errors and ignore plenty of others
......................................................................
pep8: fix 2 errors and ignore plenty of others
We need to either ignore or fix upstream pep8 errors so that vdsm can
build in Fedora 18.
Change-Id: Ifc46a3a8600301dd33f3f170c1e85810dc554a33
Signed-off-by: Dan Kenigsberg <danken at redhat.com>
---
M Makefile.am
M tests/alignmentScanTests.py
M tests/gluster_cli_tests.py
M vdsm/BindingXMLRPC.py
M vdsm/caps.py
M vdsm/clientIF.py
M vdsm/gluster/api.py
M vdsm/guestIF.py
M vdsm/libvirtvm.py
M vdsm/storage/lvm.py
M vdsm_hooks/sriov/before_vm_start.py
11 files changed, 15 insertions(+), 14 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/53/8753/1
diff --git a/Makefile.am b/Makefile.am
index d7ae5dc..d29743d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -117,6 +117,7 @@
find . -path './.git' -prune -type f -o \
-name '*.py' -o -name '*.py.in' | xargs $(PYFLAKES)
$(PEP8) --exclude="$(PEP8_BLACKLIST)" --filename '*.py,*.py.in' \
+ --ignore=E121,E122,E123,E124,E125,E126,E127,E128,E241 \
$(PEP8_WHITELIST)
@if test -f .gitignore; then \
for i in `git ls-files \*.in`; do \
diff --git a/tests/alignmentScanTests.py b/tests/alignmentScanTests.py
index c8aa129..86a005a 100644
--- a/tests/alignmentScanTests.py
+++ b/tests/alignmentScanTests.py
@@ -32,7 +32,7 @@
def mkimage(imagepath, aligned=True):
open(imagepath, "wb").truncate(4 * 1024 ** 3)
cmd = ["/sbin/sfdisk", "-uS", "--force", imagepath]
- cmd_input = "128,,\n" if aligned == True else "1,,\n"
+ cmd_input = "128,,\n" if aligned else "1,,\n"
r, o, e = execCmd(cmd, data=cmd_input)
assert r == 0
diff --git a/tests/gluster_cli_tests.py b/tests/gluster_cli_tests.py
index 9f3f538..7830ad6 100644
--- a/tests/gluster_cli_tests.py
+++ b/tests/gluster_cli_tests.py
@@ -56,7 +56,7 @@
'Options Reconfigured:',
'auth.allow: *']
volumeInfo = gcli._parseVolumeInfo(out)
- for volumeName in volumeInfo:
+ for volumeName in volumeInfo:
if volumeName == 'music':
self.assertEquals(volumeInfo['music']['volumeName'],
volumeName)
diff --git a/vdsm/BindingXMLRPC.py b/vdsm/BindingXMLRPC.py
index fc57019..d39759f 100644
--- a/vdsm/BindingXMLRPC.py
+++ b/vdsm/BindingXMLRPC.py
@@ -876,7 +876,7 @@
f.__name__, displayArgs, kwargs)
# if flowID exists
- if getattr(f.im_self.cif.threadLocal, 'flowID', None) != None:
+ if getattr(f.im_self.cif.threadLocal, 'flowID', None) is not None:
logStr += " flowID [%s]" % f.im_self.cif.threadLocal.flowID
# Ready to show the log into vdsm.log
diff --git a/vdsm/caps.py b/vdsm/caps.py
index 295d4ed..cfe4caf 100644
--- a/vdsm/caps.py
+++ b/vdsm/caps.py
@@ -350,7 +350,7 @@
except:
logging.error('', exc_info=True)
- elif getos() == OSName.DEBIAN and python_apt == True:
+ elif getos() == OSName.DEBIAN and python_apt:
KEY_PACKAGES = {'qemu-kvm': 'qemu-kvm', 'qemu-img': 'qemu-utils',
'vdsm': 'vdsmd', 'spice-server': 'libspice-server1',
'libvirt': 'libvirt0'}
diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py
index e9ca7c9..6c5a670 100644
--- a/vdsm/clientIF.py
+++ b/vdsm/clientIF.py
@@ -118,8 +118,8 @@
@classmethod
def getInstance(cls, log=None):
with cls._instanceLock:
- if cls._instance == None:
- if log == None:
+ if cls._instance is None:
+ if log is None:
raise Exception("Logging facility is required to create "
"the single clientIF instance")
else:
diff --git a/vdsm/gluster/api.py b/vdsm/gluster/api.py
index a825de2..b40f13a 100644
--- a/vdsm/gluster/api.py
+++ b/vdsm/gluster/api.py
@@ -241,6 +241,6 @@
l = []
for name in dir(gluster):
func = getattr(gluster, name)
- if getattr(func, 'exportAsVerb', False) == True:
+ if getattr(func, 'exportAsVerb', False) is True:
l.append((func, 'gluster%s%s' % (name[0].upper(), name[1:])))
return tuple(l)
diff --git a/vdsm/guestIF.py b/vdsm/guestIF.py
index 3200f25..d51af14 100644
--- a/vdsm/guestIF.py
+++ b/vdsm/guestIF.py
@@ -102,7 +102,7 @@
def _handleMessage(self, message, args):
self.log.log(logging.TRACE, "Guest's message %s: %s", message, args)
- if self.guestStatus == None:
+ if self.guestStatus is None:
self.guestStatus = 'Running'
if message == 'heartbeat':
self.guestStatus = 'Running'
diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py
index 3507323..62ee937 100644
--- a/vdsm/libvirtvm.py
+++ b/vdsm/libvirtvm.py
@@ -2222,14 +2222,14 @@
def reportError(key='balloonErr', msg=None):
self.log.error("Set new balloon target failed", exc_info=True)
- if msg == None:
+ if msg is None:
error = errCode[key]
else:
error = {'status': {'code': errCode[key]
['status']['code'], 'message': msg}}
return error
- if self._dom == None:
+ if self._dom is None:
return reportError()
try:
target = int(target)
diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 78c846a..01ff942 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -594,7 +594,7 @@
# be in the vg.
# Will be better when the pvs dict will be part of the vg.
#Fix me: should not be more stubs
- if self._stalelv or any(isinstance(lv, Stub)
+ if self._stalelv or any(isinstance(lv, Stub)
for lv in self._lvs.values()):
lvs = self._reloadlvs(vgName)
else:
@@ -667,7 +667,7 @@
else:
raise
- if force == True:
+ if force is True:
options = ("-y", "-ff")
_initpvs_removeHolders()
else:
@@ -736,7 +736,7 @@
cmd = ("lvchange",) + LVM_NOBACKUP + (attrName, attrValue) + lvnames
rc, out, err = _lvminfo.cmd(cmd)
_lvminfo._invalidatelvs(vg, lvs)
- if rc != 0 and len(out) < 1:
+ if rc != 0 and len(out) < 1:
raise se.StorageException("%d %s %s\n%s/%s" % (rc, out, err, vg, lvs))
diff --git a/vdsm_hooks/sriov/before_vm_start.py b/vdsm_hooks/sriov/before_vm_start.py
index 5947f8f..fd9168f 100755
--- a/vdsm_hooks/sriov/before_vm_start.py
+++ b/vdsm_hooks/sriov/before_vm_start.py
@@ -53,7 +53,7 @@
connection = libvirtconnection.get(None)
nodeDevice = connection.nodeDeviceLookupByName(addr)
- if nodeDevice != None:
+ if nodeDevice is not None:
sys.stderr.write('sriov: detaching pci device: %s\n' % addr)
nodeDevice.dettach()
else:
--
To view, visit http://gerrit.ovirt.org/8753
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifc46a3a8600301dd33f3f170c1e85810dc554a33
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Dan Kenigsberg <danken at redhat.com>
More information about the vdsm-patches
mailing list