From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has uploaded a new change for review.
Change subject: pylint: silence assorted errors ......................................................................
pylint: silence assorted errors
Some of the silenced erros should be fixed; others should be silenced more pointedly. However we should not make this delay catching real new and more serious erros, such as the missing "discard" argument to _deleteImage.
Change-Id: I77b695dcb4a97677048c84d4f63ccae9b1793313 Signed-off-by: Dan Kenigsberg danken@redhat.com --- M lib/vdsm/commands.py M lib/vdsm/gluster/storagedev.py M lib/vdsm/host/caps.py M lib/vdsm/rpc/bindingxmlrpc.py M lib/vdsm/sslutils.py M lib/vdsm/storage/dispatcher.py M lib/vdsm/storage/iscsi.py M lib/vdsm/storage/misc.py M lib/vdsm/storage/outOfProcess.py M lib/vdsm/supervdsm.py M lib/vdsm/tool/configurator.py M lib/vdsm/utils.py M lib/vdsm/v2v.py M lib/vdsm/virt/containers/domain.py M lib/vdsm/virt/vmdevices/storage.py M lib/vdsm/virt/vmpowerdown.py M lib/yajsonrpc/stompreactor.py M vdsm/storage/blockSD.py M vdsm/storage/fileSD.py M vdsm/storage/hsm.py M vdsm/storage/monitor.py M vdsm/storage/sd.py M vdsm/storage/sp.py M vdsm/storage/volume.py M vdsm/vdsmd.py M vdsm/virt/vm.py 26 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/30/75730/1
diff --git a/lib/vdsm/commands.py b/lib/vdsm/commands.py index f694788..23bd262 100644 --- a/lib/vdsm/commands.py +++ b/lib/vdsm/commands.py @@ -110,6 +110,7 @@ """ class _streamWrapper(io.RawIOBase): def __init__(self, parent, streamToWrap, fd): + # pylint: disable=no-member io.IOBase.__init__(self) self._stream = streamToWrap self._parent = proxy(parent) diff --git a/lib/vdsm/gluster/storagedev.py b/lib/vdsm/gluster/storagedev.py index 74596f1..edd7167 100644 --- a/lib/vdsm/gluster/storagedev.py +++ b/lib/vdsm/gluster/storagedev.py @@ -108,6 +108,7 @@ if hasattr(udev, 'get_device'): dev = udev.get_device(device.sysfsPath) or {} elif hasattr(udev, 'udev_get_device'): + # pylint: disable=no-member dev = udev.udev_get_device(device.sysfsPath) or {} else: dev = {} diff --git a/lib/vdsm/host/caps.py b/lib/vdsm/host/caps.py index 7e2601d..9da9389 100644 --- a/lib/vdsm/host/caps.py +++ b/lib/vdsm/host/caps.py @@ -215,6 +215,7 @@ def _dropVersion(vstring, logMessage): logging.error(logMessage)
+ # pylint: disable=no-name-in-module from distutils import version # Drop cluster supported version to be strictly less than given vstring. info = dsaversion.version_info.copy() diff --git a/lib/vdsm/rpc/bindingxmlrpc.py b/lib/vdsm/rpc/bindingxmlrpc.py index d069a14..f89869c 100644 --- a/lib/vdsm/rpc/bindingxmlrpc.py +++ b/lib/vdsm/rpc/bindingxmlrpc.py @@ -103,6 +103,7 @@ def setup(self): threadLocal.client = self.client_address[0] threadLocal.server = self.request.getsockname()[0] + # pylint: disable=no-member return xmlrpc.IPXMLRPCRequestHandler.setup(self)
def do_GET(self): diff --git a/lib/vdsm/sslutils.py b/lib/vdsm/sslutils.py index df7438e..ccffd81 100644 --- a/lib/vdsm/sslutils.py +++ b/lib/vdsm/sslutils.py @@ -17,6 +17,8 @@ # # Refer to the README and COPYING files for full details of the license # +# pylint: disable=no-member + from __future__ import absolute_import import logging from six.moves import xmlrpc_client as xmlrpclib diff --git a/lib/vdsm/storage/dispatcher.py b/lib/vdsm/storage/dispatcher.py index e4b2f7e..57ebf47 100644 --- a/lib/vdsm/storage/dispatcher.py +++ b/lib/vdsm/storage/dispatcher.py @@ -90,6 +90,7 @@ return se.generateResponse(e) except: try: + # pylint: disable=no-member self.log.error( "Unhandled exception in run and protect: %s, " "args: %s ", self.name, args, exc_info=True) diff --git a/lib/vdsm/storage/iscsi.py b/lib/vdsm/storage/iscsi.py index 58ae8c6..79d4d43 100644 --- a/lib/vdsm/storage/iscsi.py +++ b/lib/vdsm/storage/iscsi.py @@ -180,6 +180,7 @@ except (OSError, IOError): res.append("")
+ # pylint: disable=unbalanced-tuple-unpacking iqn, iface, tpgt, username, password, ip, port, netdev = res password = ProtectedPassword(password) port = int(port) @@ -352,6 +353,7 @@
def __getattr__(self, name): if name in ("_conf", "_fields", "_loaded"): + # pylint: disable=no-member return object.__getattr__(self, name)
if name not in self._fields: diff --git a/lib/vdsm/storage/misc.py b/lib/vdsm/storage/misc.py index 3790837..864b5dd 100644 --- a/lib/vdsm/storage/misc.py +++ b/lib/vdsm/storage/misc.py @@ -569,6 +569,7 @@ exception = e
if exception is not None: + # pylint: disable=raising-bad-type raise exception
diff --git a/lib/vdsm/storage/outOfProcess.py b/lib/vdsm/storage/outOfProcess.py index 118b534..639ed78 100644 --- a/lib/vdsm/storage/outOfProcess.py +++ b/lib/vdsm/storage/outOfProcess.py @@ -240,6 +240,7 @@
_IOProcessFileUtils(self._iop).cleanupdir(newpath, False) self.mkdir(newpath) + # pylint: disable=no-member for fname in self.listdir(oldpath): src = os.path.join(oldpath, fname) dst = os.path.join(newpath, fname) diff --git a/lib/vdsm/supervdsm.py b/lib/vdsm/supervdsm.py index 91ddfe0..bdf8a8b 100644 --- a/lib/vdsm/supervdsm.py +++ b/lib/vdsm/supervdsm.py @@ -70,6 +70,7 @@ self._connect()
def open(self, *args, **kwargs): + # pylint: disable=no-member return self._manager.open(*args, **kwargs)
def _connect(self): @@ -83,6 +84,7 @@ msg = "Connect to supervdsm service failed: %s" % ex panic(msg)
+ # pylint: disable=no-member self._svdsm = self._manager.instance()
def __getattr__(self, name): diff --git a/lib/vdsm/tool/configurator.py b/lib/vdsm/tool/configurator.py index 725b341..4d51e07 100644 --- a/lib/vdsm/tool/configurator.py +++ b/lib/vdsm/tool/configurator.py @@ -125,6 +125,7 @@ for c in configurer_to_trigger: for s in _getservices(c): if service.service_status(s, False) == 0: + # pylint: disable=no-member if not args.force: raise configurators.InvalidRun( "\n\nCannot configure while service '%s' is " diff --git a/lib/vdsm/utils.py b/lib/vdsm/utils.py index c533b46..4d6c90d 100644 --- a/lib/vdsm/utils.py +++ b/lib/vdsm/utils.py @@ -31,6 +31,7 @@ from contextlib import contextmanager from fnmatch import fnmatch from .compat import pickle +# pylint: disable=no-name-in-module import distutils.spawn import errno import functools @@ -224,6 +225,7 @@ res = [] for pid in iteratePids(): try: + # pylint: disable=no-member procName = pidStat(pid).comm if procName == name: res.append(pid) @@ -243,6 +245,7 @@ # Retrying seems to solve it. while len(res) == 0: # cmdline is empty for zombie processes + # pylint: disable=no-member if pidStat(pid).state in ("Z", "z"): return tuple()
@@ -506,6 +509,7 @@ break else: if self._search_path: + # pylint: disable=no-member self._cmd = distutils.spawn.find_executable(self.name) if self._cmd is None: raise OSError(os.errno.ENOENT, diff --git a/lib/vdsm/v2v.py b/lib/vdsm/v2v.py index f8c6547..eb24a25 100644 --- a/lib/vdsm/v2v.py +++ b/lib/vdsm/v2v.py @@ -16,6 +16,7 @@ # # Refer to the README and COPYING files for full details of the license # +# pylint: disable=no-member """ When importing a VM a thread start with a new process of virt-v2v. The way to feedback the information on the progress and the status of the diff --git a/lib/vdsm/virt/containers/domain.py b/lib/vdsm/virt/containers/domain.py index 6eb284c..6a3edc7 100644 --- a/lib/vdsm/virt/containers/domain.py +++ b/lib/vdsm/virt/containers/domain.py @@ -96,6 +96,7 @@ return str(self._rt.uuid)
def ID(self): + # pylint: disable=no-member return self._vm_uuid.int
def UUIDString(self): diff --git a/lib/vdsm/virt/vmdevices/storage.py b/lib/vdsm/virt/vmdevices/storage.py index 79248ee..1411428 100644 --- a/lib/vdsm/virt/vmdevices/storage.py +++ b/lib/vdsm/virt/vmdevices/storage.py @@ -333,6 +333,7 @@
@path.setter def path(self, path): + # pylint: disable=access-member-before-definition if hasattr(self, "_path") and self._path != path: self.log.debug("Drive %s moved from %r to %r", self.name, self._path, path) diff --git a/lib/vdsm/virt/vmpowerdown.py b/lib/vdsm/virt/vmpowerdown.py index f7bdc3c..c773fa8 100644 --- a/lib/vdsm/virt/vmpowerdown.py +++ b/lib/vdsm/virt/vmpowerdown.py @@ -51,13 +51,16 @@
# first try agent if vm.guestAgent.isResponsive(): + # pylint: disable=no-member self.chain.addCallback(self.guestAgentCallback)
# then acpi if enabled if utils.tobool(vm.conf.get('acpiEnable', 'true')): + # pylint: disable=no-member self.chain.addCallback(self.acpiCallback)
if force: + # pylint: disable=no-member self.chain.addCallback(self.forceCallback)
def start(self): @@ -70,6 +73,7 @@ self.event.clear()
self.chain.start() + # pylint: disable=no-member return {'status': {'code': doneCode['code'], 'message': self.returnMsg}} else: diff --git a/lib/yajsonrpc/stompreactor.py b/lib/yajsonrpc/stompreactor.py index 0fcf1ff..e07ebc0 100644 --- a/lib/yajsonrpc/stompreactor.py +++ b/lib/yajsonrpc/stompreactor.py @@ -321,6 +321,7 @@ """ def send(self, message, destination=stomp.SUBSCRIPTION_ID_RESPONSE): resp = json.loads(message) + # pylint: disable=no-member response_id = resp.get("id")
try: diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py index 18f4c4a..6474829 100644 --- a/vdsm/storage/blockSD.py +++ b/vdsm/storage/blockSD.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +# pylint: disable=no-member
import os import threading diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index ab9ae21..eed83e7 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -603,6 +603,7 @@ """ cls.log.info("Formatting domain %s", sdUUID) try: + # pylint: disable=no-member domaindir = cls.findDomainPath(sdUUID) except (se.StorageDomainDoesNotExist): pass diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index 216dfd3..936d390 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -2114,6 +2114,7 @@ "VG size must be more than %s MiB" % str(MINIMALVGSIZE / constants.MEGAB))
+ # pylint: disable=no-member lvm.createVG(vgname, devices, blockSD.STORAGE_UNREADY_DOMAIN_TAG, metadataSize=blockSD.VG_METADATASIZE, force=(force is True) or (isinstance(force, str) and diff --git a/vdsm/storage/monitor.py b/vdsm/storage/monitor.py index 84c090a..ddbfa92 100644 --- a/vdsm/storage/monitor.py +++ b/vdsm/storage/monitor.py @@ -331,6 +331,7 @@ status = Status(self.status._path_status, domain_status) self._updateStatus(status) if self.cycleCallback: + # pylint: disable=not-callable self.cycleCallback() if self.stopEvent.wait(self.interval): raise utils.Canceled @@ -387,6 +388,7 @@ log.exception("Domain monitor for %s failed", self.sdUUID) finally: if self.cycleCallback: + # pylint: disable=not-callable self.cycleCallback() if self.stopEvent.wait(self.interval): raise utils.Canceled diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index c6081bd..41578a5 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +# pylint: disable=no-member
import os import logging diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py index 1b90420..eff6c94 100644 --- a/vdsm/storage/sp.py +++ b/vdsm/storage/sp.py @@ -335,6 +335,7 @@ self._maxHostID = maxHostID
# Upgrade the master domain now if needed + # pylint: disable=unexpected-keyword-arg self._upgradePool(expectedDomVersion, __securityOverride=True)
self.masterDomain.mountMaster() @@ -344,6 +345,7 @@
try: # Make sure backup domain is active + # pylint: disable=unexpected-keyword-arg self.checkBackupDomain(__securityOverride=True) except Exception: self.log.error("Backup domain validation failed", @@ -385,6 +387,7 @@ except Exception as e: self.log.error("Unexpected error", exc_info=True) self.log.error("failed: %s" % str(e)) + # pylint: disable=unexpected-keyword-arg self.stopSpm(force=True, __securityOverride=True) raise
diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py index d7ef44d..b13fdd8 100644 --- a/vdsm/storage/volume.py +++ b/vdsm/storage/volume.py @@ -17,6 +17,7 @@ # # Refer to the README and COPYING files for full details of the license # +# pylint: disable=no-member
import os.path import logging @@ -1007,6 +1008,7 @@ if srcImgUUID == sc.BLANK_UUID: srcImgUUID = imgUUID
+ # pylint: disable=too-many-function-args volParent = cls(repoPath, sdUUID, srcImgUUID, srcVolUUID)
if not volParent.isLegal(): @@ -1015,6 +1017,7 @@
if imgUUID != srcImgUUID: volParent.share(imgPath) + # pylint: disable=too-many-function-args volParent = cls(repoPath, sdUUID, imgUUID, srcVolUUID)
# Override the size with the size of the parent diff --git a/vdsm/vdsmd.py b/vdsm/vdsmd.py index 96f4b46..c6f39a4 100755 --- a/vdsm/vdsmd.py +++ b/vdsm/vdsmd.py @@ -71,6 +71,7 @@ def sigusr1Handler(signum, frame): if irs: log.info("Received signal %s, stopping SPM" % signum) + # pylint: disable=no-member irs.spmStop( irs.getConnectedStoragePoolsList()['poollist'][0])
diff --git a/vdsm/virt/vm.py b/vdsm/virt/vm.py index 63ba06f..0ae207c 100644 --- a/vdsm/virt/vm.py +++ b/vdsm/virt/vm.py @@ -613,6 +613,7 @@ raise except Exception as e: # as above + # pylint: disable=no-member if isinstance(e, libvirt.libvirtError) and \ e.get_error_code() == libvirt.VIR_ERR_NO_DOMAIN: raise MissingLibvirtDomainError() @@ -2255,6 +2256,7 @@ if hasattr(nic, 'portMirroring'): mirroredNetworks = [] try: + # pylint: disable=no-member for network in nic.portMirroring: supervdsm.getProxy().setPortMirroring(network, nic.name) mirroredNetworks.append(network)
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has posted comments on this change.
Change subject: pylint: Silence pylint errors in gluster ......................................................................
Patch Set 3: Code-Review+2 Verified+1
From Dan Kenigsberg danken@redhat.com:
Dan Kenigsberg has submitted this change and it was merged.
Change subject: pylint: Silence pylint errors in gluster ......................................................................
pylint: Silence pylint errors in gluster
pylint is complaining about valid code, checking if an attribute exists before using it. Maybe we can change the code so pylint will be happy, for now we disable this check for the specific line.
Change-Id: I77b695dcb4a97677048c84d4f63ccae9b1793313 Signed-off-by: Dan Kenigsberg danken@redhat.com Signed-off-by: Nir Soffer nsoffer@redhat.com --- M lib/vdsm/gluster/storagedev.py 1 file changed, 4 insertions(+), 0 deletions(-)
Approvals: Jenkins CI: Passed CI tests Dan Kenigsberg: Verified; Looks good to me, approved
vdsm-patches@lists.fedorahosted.org