Antoni Segura Puimedon has uploaded a new change for review. Change subject: Yet another bunch of completely pep8 fixed files. ......................................................................
Yet another bunch of completely pep8 fixed files. Change-Id: I2d0e38fd43bd76febf3bfb231c4257298e6d921f Signed-off-by: Antoni S. Puimedon <[email protected]> --- M Makefile.am M vdsm/alignmentScan.py M vdsm/betterPopen/__init__.py M vdsm/betterPopen/setup.py M vdsm/blkid.py M vdsm/clientIF.py M vdsm/doc/source/conf.py M vdsm/hooks.py M vdsm/kaxmlrpclib.py M vdsm/ksm.py M vdsm/parted_utils.py M vdsm/sos/vdsm.py.in M vdsm/substitute_constants.py 13 files changed, 77 insertions(+), 69 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/41/10041/1 diff --git a/Makefile.am b/Makefile.am index 80d6f52..0168dbc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,8 @@ vdsm-tool \ vdsm/*.py \ vdsm/*.py.in \ + vdsm/doc/ \ + vdsm/sos/ \ vdsm/storage/__init__.py \ vdsm/storage/blockVolume.py \ vdsm/storage/devicemapper.py \ diff --git a/vdsm/alignmentScan.py b/vdsm/alignmentScan.py index 3a76654..53d4ee3 100644 --- a/vdsm/alignmentScan.py +++ b/vdsm/alignmentScan.py @@ -22,9 +22,10 @@ from collections import namedtuple from storage.misc import execCmd -ScanOutput = namedtuple('ScanOutput', - ['partition_name', 'partition_start_bytes', 'partition_alignment', - 'alignment_scan_result', 'alignment_scan_explanation']) +ScanOutput = namedtuple( + 'ScanOutput', + ['partition_name', 'partition_start_bytes', 'partition_alignment', + 'alignment_scan_result', 'alignment_scan_explanation']) class VirtAlignError(Exception): @@ -65,5 +66,5 @@ scan_result = (line[3] == "ok") # True if aligned, otherwise False scan_explanation = line[3] # optional free-text explanation out_list.append(ScanOutput(part_name, part_start, part_alignment, - scan_result, scan_explanation)) + scan_result, scan_explanation)) return out_list diff --git a/vdsm/betterPopen/__init__.py b/vdsm/betterPopen/__init__.py index 0700a3b..4f16ea4 100644 --- a/vdsm/betterPopen/__init__.py +++ b/vdsm/betterPopen/__init__.py @@ -41,23 +41,23 @@ env = list(("=".join(item) for item in env.iteritems())) Popen.__init__(self, args, - close_fds=close_fds, cwd=cwd, env=env, - stdin=PIPE, stdout=PIPE, - stderr=PIPE) + close_fds=close_fds, cwd=cwd, env=env, + stdin=PIPE, stdout=PIPE, + stderr=PIPE) def _execute_child(self, args, executable, preexec_fn, close_fds, - cwd, env, universal_newlines, - startupinfo, creationflags, shell, - p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite): + cwd, env, universal_newlines, + startupinfo, creationflags, shell, + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite): try: pid, stdin, stdout, stderr = createProcess(args, close_fds, - p2cread, p2cwrite, - c2pread, c2pwrite, - errread, errwrite, - cwd, env) + p2cread, p2cwrite, + c2pread, c2pwrite, + errread, errwrite, + cwd, env) self.pid = pid self._closed = False diff --git a/vdsm/betterPopen/setup.py b/vdsm/betterPopen/setup.py index ac1e45d..f9a33d8 100644 --- a/vdsm/betterPopen/setup.py +++ b/vdsm/betterPopen/setup.py @@ -1,9 +1,9 @@ from distutils.core import setup, Extension module1 = Extension('createprocess', - sources = ['createprocess.c']) + sources=['createprocess.c']) -setup (name = 'createprocess', - version = '1.0', - description = 'Creates a subprocess in simpler safer manner', - ext_modules = [module1]) +setup(name='createprocess', + version='1.0', + description='Creates a subprocess in simpler safer manner', + ext_modules=[module1]) diff --git a/vdsm/blkid.py b/vdsm/blkid.py index 4d855ee..0e8d2ea 100644 --- a/vdsm/blkid.py +++ b/vdsm/blkid.py @@ -36,7 +36,7 @@ 'detected for %s' % self.attrib else: self.message = 'blkid execution failed with error ' + \ - 'code %s for %s' % (self.rc, self.attrib) + 'code %s for %s' % (self.rc, self.attrib) def __str__(self): return self.message diff --git a/vdsm/clientIF.py b/vdsm/clientIF.py index b46415d..5e034a1 100644 --- a/vdsm/clientIF.py +++ b/vdsm/clientIF.py @@ -86,8 +86,8 @@ ifids = netinfo.nics() + netinfo.bondings() ifrates = map(netinfo.speed, ifids) self._hostStats = utils.HostStatsThread( - cif=self, log=log, ifids=ifids, - ifrates=ifrates) + cif=self, log=log, ifids=ifids, + ifrates=ifrates) self._hostStats.start() mog = min(config.getint('vars', 'max_outgoing_migrations'), caps.CpuTopology().cores()) @@ -101,7 +101,7 @@ threading.Thread(target=self._recoverExistingVms, name='clientIFinit').start() self.channelListener.settimeout( - config.getint('vars', 'guest_agent_timeout')) + config.getint('vars', 'guest_agent_timeout')) self.channelListener.start() self.threadLocal = threading.local() self.threadLocal.client = '' @@ -265,8 +265,8 @@ # PDIV drive format if drive['device'] == 'disk' and vm.isVdsmImage(drive): res = self.irs.prepareImage( - drive['domainID'], drive['poolID'], - drive['imageID'], drive['volumeID']) + drive['domainID'], drive['poolID'], + drive['imageID'], drive['volumeID']) if res['status']['code']: raise vm.VolumeError(drive) @@ -300,7 +300,7 @@ volPath = supervdsm.getProxy().mkIsoFs(vmId, files) elif drive['device'] == 'floppy': volPath = \ - supervdsm.getProxy().mkFloppyFs(vmId, files) + supervdsm.getProxy().mkFloppyFs(vmId, files) elif "path" in drive: volPath = drive['path'] @@ -337,7 +337,7 @@ def createVm(self, vmParams): self.vmContainerLock.acquire() self.log.info("vmContainerLock acquired by vm %s", - vmParams['vmId']) + vmParams['vmId']) try: if 'recover' not in vmParams: if vmParams['vmId'] in self.vmContainer: @@ -372,8 +372,8 @@ vmId, exc_info=True) while (self._enabled and - 'WaitForLaunch' in [v.lastStatus for v in - self.vmContainer.values()]): + 'WaitForLaunch' in [v.lastStatus for v in + self.vmContainer.values()]): time.sleep(1) self._cleanOldFiles() self._recovery = False @@ -383,7 +383,7 @@ # Actually, we need it just to get the resources for future # volumes manipulations while self._enabled and self.vmContainer and \ - not self.irs.getConnectedStoragePoolsList()['poollist']: + not self.irs.getConnectedStoragePoolsList()['poollist']: time.sleep(5) for vmId, vmObj in self.vmContainer.items(): @@ -392,7 +392,7 @@ # Do not prepare volumes when system goes down if self._enabled: vmObj.preparePaths( - vmObj.getConfDevices()[vm.DISK_DEVICES]) + vmObj.getConfDevices()[vm.DISK_DEVICES]) except: self.log.error("Vm %s recovery failed", vmId, exc_info=True) @@ -421,8 +421,8 @@ if entry.getAttribute("name") == "product": prod = entry.firstChild.data if prod in (caps.OSName.RHEL, caps.OSName.OVIRT, - caps.OSName.RHEVH, caps.OSName.FEDORA, - caps.OSName.DEBIAN): + caps.OSName.RHEVH, caps.OSName.FEDORA, + caps.OSName.DEBIAN): return True return False @@ -466,7 +466,7 @@ try: vmId, fileType = f.split(".", 1) if fileType in ["guest.socket", "monitor.socket", "pid", - "stdio.dump", "recovery"]: + "stdio.dump", "recovery"]: if vmId in self.vmContainer: continue if f == 'vdsmd.pid': diff --git a/vdsm/doc/source/conf.py b/vdsm/doc/source/conf.py index 4144135..b0814da 100644 --- a/vdsm/doc/source/conf.py +++ b/vdsm/doc/source/conf.py @@ -3,7 +3,7 @@ # VDSM documentation build configuration file, created by # sphinx-quickstart on Thu Dec 24 14:07:47 2009. # -# This file is execfile()d with the current directory set to its containing dir. +# This file is execfile()d with the current directory set to its containing dir # # Note that not all possible configuration values are present in this # autogenerated file. @@ -11,18 +11,20 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.append(os.path.abspath('../../')) -# -- General configuration ----------------------------------------------------- +# -- General configuration ---------------------------------------------------- -# Add any Sphinx extension module names here, as strings. They can be extensions +# Add any Sphinx extension module names here, as strings. They can be extension # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig'] +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', + 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] @@ -66,7 +68,7 @@ # for source files. exclude_trees = [] -# The reST default role (used for this markup: `text`) to use for all documents. +# The reST default role (used for this markup: `text`) to use for all documents #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. @@ -87,7 +89,7 @@ #modindex_common_prefix = [] -# -- Options for HTML output --------------------------------------------------- +# -- Options for HTML output -------------------------------------------------- # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. @@ -161,7 +163,7 @@ htmlhelp_basename = 'vdsmdoc' -# -- Options for LaTeX output -------------------------------------------------- +# -- Options for LaTeX output ------------------------------------------------- # The paper size ('letter' or 'a4'). #latex_paper_size = 'letter' @@ -170,7 +172,7 @@ #latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). +# (source start file, target name, title, author, documentclass [howto/manual]) latex_documents = [('index', 'Vdsm.tex', u'VDSM Documentation', u'Red Hat', 'manual'), ] diff --git a/vdsm/hooks.py b/vdsm/hooks.py index 2fda658..b3c53d3 100644 --- a/vdsm/hooks.py +++ b/vdsm/hooks.py @@ -220,7 +220,7 @@ def _getHookInfo(dir): return dict([(os.path.basename(script), _getScriptInfo(script)) - for script in _scriptsPerDir(dir)]) + for script in _scriptsPerDir(dir)]) def installed(): diff --git a/vdsm/kaxmlrpclib.py b/vdsm/kaxmlrpclib.py index 8ab5e88..3a19292 100644 --- a/vdsm/kaxmlrpclib.py +++ b/vdsm/kaxmlrpclib.py @@ -127,15 +127,15 @@ chost, self._extra_headers, x509 = self.get_host_info(host) if hasattr(xmlrpclib.SafeTransport, "single_request"): # Python 2.7 return TcpkeepHTTPSConnection( - chost, None, key_file=self.key_file, strict=None, - timeout=CONNECTTIMEOUT, - cert_file=self.cert_file, ca_certs=self.ca_certs, - cert_reqs=self.cert_reqs) + chost, None, key_file=self.key_file, strict=None, + timeout=CONNECTTIMEOUT, + cert_file=self.cert_file, ca_certs=self.ca_certs, + cert_reqs=self.cert_reqs) else: return TcpkeepHTTPS( - chost, None, key_file=self.key_file, - cert_file=self.cert_file, ca_certs=self.ca_certs, - cert_reqs=self.cert_reqs) + chost, None, key_file=self.key_file, + cert_file=self.cert_file, ca_certs=self.ca_certs, + cert_reqs=self.cert_reqs) class TcpkeepHTTPSConnection(SecureXMLRPCServer.VerifyingHTTPSConnection): @@ -143,9 +143,9 @@ strict=None, timeout=CONNECTTIMEOUT, ca_certs=None, cert_reqs=ssl.CERT_REQUIRED): SecureXMLRPCServer.VerifyingHTTPSConnection.__init__( - self, host, port=port, key_file=key_file, cert_file=cert_file, - strict=strict, timeout=timeout, - ca_certs=ca_certs, cert_reqs=cert_reqs) + self, host, port=port, key_file=key_file, cert_file=cert_file, + strict=strict, timeout=timeout, + ca_certs=ca_certs, cert_reqs=cert_reqs) def connect(self): SecureXMLRPCServer.VerifyingHTTPSConnection.connect(self) diff --git a/vdsm/ksm.py b/vdsm/ksm.py index c9bb2c2..c5db89b 100644 --- a/vdsm/ksm.py +++ b/vdsm/ksm.py @@ -50,7 +50,7 @@ def _getKsmdJiffies(self): return sum(map(int, file('/proc/%s/stat' % self._pid) - .read().split()[13:15])) + .read().split()[13:15])) def run(self): start() @@ -61,7 +61,7 @@ time.sleep(KSM_MONITOR_INTERVAL) jiff1 = self._getKsmdJiffies() self.cpuUsage = (jiff1 - jiff0) % 2 ** 32 * 100 / \ - os.sysconf('SC_CLK_TCK') / KSM_MONITOR_INTERVAL + os.sysconf('SC_CLK_TCK') / KSM_MONITOR_INTERVAL jiff0 = jiff1 except: self._cif.log.error("Error monitoring KSM", exc_info=True) diff --git a/vdsm/parted_utils.py b/vdsm/parted_utils.py index 29fde80..f394985 100644 --- a/vdsm/parted_utils.py +++ b/vdsm/parted_utils.py @@ -44,9 +44,9 @@ partitions = {} for partition in partedDisk.partitions: partitions.update({partition.path: - (partition.getFlagsAsString().split(), - partition.geometry.start, - partition.geometry.end)}) + (partition.getFlagsAsString().split(), + partition.geometry.start, + partition.geometry.end)}) return {'model': partedDevice.model, 'sectorSize': partedDevice.sectorSize, diff --git a/vdsm/sos/vdsm.py.in b/vdsm/sos/vdsm.py.in index 5f09f8d..d7b9651 100644 --- a/vdsm/sos/vdsm.py.in +++ b/vdsm/sos/vdsm.py.in @@ -27,8 +27,8 @@ import imp import os.path from distutils.sysconfig import get_python_lib - modFile, modPath, modDesc = imp.find_module(modName, - [os.path.join(get_python_lib(True), "vdsm")]) + modFile, modPath, modDesc = imp.find_module( + modName, [os.path.join(get_python_lib(True), "vdsm")]) mod = imp.load_module(modName, modFile, modPath, modDesc) return mod @@ -43,7 +43,8 @@ """VDSM server related information """ - optionList = [("logsize", 'max size (MiB) to collect per log file', '', False)] + optionList = [("logsize", 'max size (MiB) to collect per log file', '', + False)] def __addCopySpecLogLimit(self, path, logsize=None): """ @@ -56,7 +57,6 @@ self.addCopySpecLimit(path, logsize) else: self.addCopySpec(path) - def setup(self): os.environ["LVM_SYSTEM_DIR"] = "@VDSMRUNDIR@/lvm" @@ -81,8 +81,10 @@ self.addCopySpec("/proc/%s/status" % pid) self.addCopySpec("/proc/%s/mountstats" % pid) self.collectExtOutput("/bin/ls -l /var/log/core") - self.collectExtOutput("/bin/su vdsm -s /bin/sh -c '/usr/bin/tree @VDSMREPO@'") - self.collectExtOutput("/bin/su vdsm -s /bin/sh -c '/bin/ls -lR @VDSMREPO@'") + self.collectExtOutput( + "/bin/su vdsm -s /bin/sh -c '/usr/bin/tree @VDSMREPO@'") + self.collectExtOutput( + "/bin/su vdsm -s /bin/sh -c '/bin/ls -lR @VDSMREPO@'") self.collectExtOutput("/sbin/lvm vgs -v -o +tags") self.collectExtOutput("/sbin/lvm lvs -v -o +tags") self.collectExtOutput("/sbin/lvm pvs -v -o +all") @@ -107,7 +109,8 @@ for line in out.splitlines()[1:-1]: pool = line.strip() self.collectExtOutput(vdsclient + "getSpmStatus " + pool) - self.collectExtOutput('/bin/su vdsm -s @PYTHON@ @VDSMDIR@/dumpStorageTable.pyc') + self.collectExtOutput( + '/bin/su vdsm -s @PYTHON@ @VDSMDIR@/dumpStorageTable.pyc') def _addVdsmRunDir(self): """Add everything under /var/run/vdsm except possibly confidential diff --git a/vdsm/substitute_constants.py b/vdsm/substitute_constants.py index 0dc750d..f1a0b4e 100644 --- a/vdsm/substitute_constants.py +++ b/vdsm/substitute_constants.py @@ -28,7 +28,7 @@ def replacement(m): s = m.group() return getattr(constants, 'EXT_' + s[1:-1], - getattr(constants, s[1:-1], s)) + getattr(constants, s[1:-1], s)) if len(sys.argv) <= 1: print """usage: %s filename... -- To view, visit http://gerrit.ovirt.org/10041 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2d0e38fd43bd76febf3bfb231c4257298e6d921f Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
