Dan Kenigsberg has uploaded a new change for review. Change subject: pep8: fix E125 ......................................................................
pep8: fix E125 Change-Id: I63312573beac2dfd2fa3062c5e6656d8b7fb50ce Signed-off-by: Dan Kenigsberg <[email protected]> --- M Makefile.am M vdsm/libvirtvm.py M vdsm/storage/blockSD.py M vdsm/storage/fileSD.py M vdsm/storage/multipath.py M vdsm/storage/sd.py M vdsm/storage/task.py M vdsm/storage/volume.py M vdsm_hooks/fileinject/before_vm_start.py M vdsm_hooks/promisc/after_vm_start.py 10 files changed, 44 insertions(+), 43 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/05/9805/1 diff --git a/Makefile.am b/Makefile.am index 0da5d07..fa28ee1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -104,7 +104,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=E125,E126,E127,E128,E241 \ + --ignore=E126,E127,E128,E241 \ $(PEP8_WHITELIST) @if test -f .gitignore; then \ for i in `git ls-files \*.in`; do \ diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py index d5b5e4f..97672a6 100644 --- a/vdsm/libvirtvm.py +++ b/vdsm/libvirtvm.py @@ -401,7 +401,7 @@ fileTotal, fileProcessed, _) = self._vm._dom.jobInfo() if (smallest_dataRemaining is None or - smallest_dataRemaining > dataRemaining): + smallest_dataRemaining > dataRemaining): smallest_dataRemaining = dataRemaining lastProgressTime = time.time() elif (time.time() - lastProgressTime > @@ -477,7 +477,7 @@ try: if ('qxl' in self._vm.conf['display'] and - self._vm.conf.get('clientIp')): + self._vm.conf.get('clientIp')): SPICE_MIGRATION_HANDOVER_TIME = 120 self._vm._reviveTicket(SPICE_MIGRATION_HANDOVER_TIME) @@ -768,7 +768,7 @@ cpu.appendChild(f) if ('smpCoresPerSocket' in self.conf or - 'smpThreadsPerCore' in self.conf): + 'smpThreadsPerCore' in self.conf): topo = self.doc.createElement('topology') vcpus = int(self.conf.get('smp', '1')) cores = int(self.conf.get('smpCoresPerSocket', '1')) @@ -1194,7 +1194,7 @@ driver.setAttribute('cache', self.cache) if (self.propagateErrors == 'on' or - utils.tobool(self.propagateErrors)): + utils.tobool(self.propagateErrors)): driver.setAttribute('error_policy', 'enospace') else: driver.setAttribute('error_policy', 'stop') @@ -1341,8 +1341,8 @@ for volInfo in drive.volumeChain: if ('leasePath' not in volInfo or - 'leaseOffset' not in volInfo or - volInfo['shared']): + 'leaseOffset' not in volInfo or + volInfo['shared']): continue leaseElem = self._buildLease( @@ -1605,7 +1605,7 @@ nicDev = None for dev in self.conf['devices'][:]: if (dev['type'] == vm.NIC_DEVICES and - dev['macAddr'].lower() == nicParams['macAddr'].lower()): + dev['macAddr'].lower() == nicParams['macAddr'].lower()): self.conf['devices'].remove(dev) nicDev = dev @@ -1701,7 +1701,7 @@ diskDev = None for dev in self.conf['devices'][:]: if (dev['type'] == vm.DISK_DEVICES and - dev['path'] == diskParams['path']): + dev['path'] == diskParams['path']): self.conf['devices'].remove(dev) diskDev = dev break @@ -1802,7 +1802,7 @@ if not hasattr(device, "domainID"): continue if (device.domainID, device.imageID, - device.volumeID) == tgetDrv: + device.volumeID) == tgetDrv: return device elif "GUID" in drive: @@ -1837,7 +1837,7 @@ # Updating the VM configuration for device in self.conf["devices"][:]: if (device['type'] == vm.DISK_DEVICES and - device.get("name") == drive["name"]): + device.get("name") == drive["name"]): device.update(drive) break else: @@ -2428,7 +2428,7 @@ # delete the payload devices for drive in self._devices[vm.DISK_DEVICES]: if (hasattr(drive, 'specParams') and - 'vmPayload' in drive.specParams): + 'vmPayload' in drive.specParams): supervdsm.getProxy().removeFs(drive.path) with self._releaseLock: @@ -2450,7 +2450,7 @@ libvirt.VIR_DOMAIN_DESTROY_GRACEFUL) except libvirt.libvirtError, e: if (e.get_error_code() == - libvirt.VIR_ERR_OPERATION_FAILED): + libvirt.VIR_ERR_OPERATION_FAILED): self.log.warn("Failed to destroy VM '%s' " "gracefully", self.conf['vmId']) time.sleep(30) @@ -2579,7 +2579,7 @@ for x in devsxml.childNodes: # Ignore empty nodes and devices without address if (x.nodeName == '#text' or - not x.getElementsByTagName('address')): + not x.getElementsByTagName('address')): continue alias = x.getElementsByTagName('alias')[0].getAttribute('name') @@ -2618,8 +2618,8 @@ # are compared. Currently relevant for USB controllers. for ctrl in self._devices[vm.CONTROLLER_DEVICES]: if ((ctrl.device == device) and - (not hasattr(ctrl, 'index') or ctrl.index == index) and - (not hasattr(ctrl, 'model') or ctrl.model == model)): + (not hasattr(ctrl, 'index') or ctrl.index == index) and + (not hasattr(ctrl, 'model') or ctrl.model == model)): ctrl.alias = alias ctrl.address = address # Update vm's conf with address for known controller devices @@ -2628,9 +2628,9 @@ knownDev = False for dev in self.conf['devices']: if ((dev['type'] == vm.CONTROLLER_DEVICES) and - (dev['device'] == device) and - (not 'index' in dev or dev['index'] == index) and - (not 'model' in dev or dev['model'] == model)): + (dev['device'] == device) and + (not 'index' in dev or dev['index'] == index) and + (not 'model' in dev or dev['model'] == model)): dev['address'] = address dev['alias'] = alias knownDev = True @@ -2663,7 +2663,7 @@ for dev in self.conf['devices']: if ((dev['type'] == vm.BALLOON_DEVICES) and - not dev.get('address')): + not dev.get('address')): dev['address'] = address dev['alias'] = alias @@ -2688,7 +2688,7 @@ for dev in self.conf['devices']: if ((dev['type'] == vm.WATCHDOG_DEVICES) and - (not dev.get('address') or not dev.get('alias'))): + (not dev.get('address') or not dev.get('alias'))): dev['address'] = address dev['alias'] = alias @@ -2716,7 +2716,7 @@ # Update vm's conf with address for dev in self.conf['devices']: if ((dev['type'] == vm.VIDEO_DEVICES) and - (not dev.get('address') or not dev.get('alias'))): + (not dev.get('address') or not dev.get('alias'))): dev['address'] = address dev['alias'] = alias break @@ -2745,7 +2745,7 @@ # Update vm's conf with address for dev in self.conf['devices']: if ((dev['type'] == vm.SOUND_DEVICES) and - (not dev.get('address') or not dev.get('alias'))): + (not dev.get('address') or not dev.get('alias'))): dev['address'] = address dev['alias'] = alias break @@ -2863,7 +2863,7 @@ knownDev = False for dev in self.conf['devices']: if (dev['type'] == vm.NIC_DEVICES and - dev['macAddr'].lower() == mac.lower()): + dev['macAddr'].lower() == mac.lower()): dev['address'] = address dev['alias'] = alias dev['name'] = name @@ -2893,10 +2893,10 @@ eventToString(event), detail, opaque) if event == libvirt.VIR_DOMAIN_EVENT_STOPPED: if (detail == libvirt.VIR_DOMAIN_EVENT_STOPPED_MIGRATED and - self.lastStatus == 'Migration Source'): + self.lastStatus == 'Migration Source'): hooks.after_vm_migrate_source(self._lastXMLDesc, self.conf) elif (detail == libvirt.VIR_DOMAIN_EVENT_STOPPED_SAVED and - self.lastStatus == 'Saving State'): + self.lastStatus == 'Saving State'): hooks.after_vm_hibernate(self._lastXMLDesc, self.conf) else: if detail == libvirt.VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN: @@ -2959,7 +2959,7 @@ if self.childNodes: # added special handling of Text nodes if (len(self.childNodes) == 1 and - isinstance(self.childNodes[0], xml.dom.minidom.Text)): + isinstance(self.childNodes[0], xml.dom.minidom.Text)): writer.write(">") self.childNodes[0].writexml(writer) writer.write("</%s>%s" % (self.tagName, newl)) diff --git a/vdsm/storage/blockSD.py b/vdsm/storage/blockSD.py index b021183..c28f304 100644 --- a/vdsm/storage/blockSD.py +++ b/vdsm/storage/blockSD.py @@ -168,8 +168,8 @@ if vImg not in res[vName]['imgs']: res[vName]['imgs'].insert(0, vImg) if vPar != sd.BLANK_UUID and \ - not vName.startswith(sd.REMOVED_IMAGE_PREFIX) \ - and vImg not in res[vPar]['imgs']: + not vName.startswith(sd.REMOVED_IMAGE_PREFIX) and \ + vImg not in res[vPar]['imgs']: res[vPar]['imgs'].append(vImg) return dict((k, sd.ImgsPar(tuple(v['imgs']), v['parent'])) @@ -766,7 +766,7 @@ pestart = int(pv["pestart"]) pecount = int(pv["pecount"]) if (os.path.basename(dev) == pv["guid"] and - int(ext) in range(pestart, pestart + pecount)): + int(ext) in range(pestart, pestart + pecount)): offs = int(ext) + int(pv["mapoffset"]) if offs < SD_METADATA_SIZE / sd.METASIZE: diff --git a/vdsm/storage/fileSD.py b/vdsm/storage/fileSD.py index fde466f..8e00245 100644 --- a/vdsm/storage/fileSD.py +++ b/vdsm/storage/fileSD.py @@ -529,7 +529,7 @@ for metaFile in metaFiles: if (os.path.basename(os.path.dirname(metaFile)) != - sd.MASTER_FS_DIR): + sd.MASTER_FS_DIR): sdUUID = os.path.basename(os.path.dirname(metaFile)) return (sdUUID, os.path.dirname(metaFile)) diff --git a/vdsm/storage/multipath.py b/vdsm/storage/multipath.py index adaa0c0..741f1a1 100644 --- a/vdsm/storage/multipath.py +++ b/vdsm/storage/multipath.py @@ -275,7 +275,7 @@ slave, exc_info=True) if (not devInfo["logicalblocksize"] or - not devInfo["physicalblocksize"]): + not devInfo["physicalblocksize"]): try: logBlkSize, phyBlkSize = getDeviceBlockSizes(slave) devInfo["logicalblocksize"] = str(logBlkSize) diff --git a/vdsm/storage/sd.py b/vdsm/storage/sd.py index 2d53a70..1b11017 100644 --- a/vdsm/storage/sd.py +++ b/vdsm/storage/sd.py @@ -167,7 +167,7 @@ def packLeaseParams(lockRenewalIntervalSec, leaseTimeSec, ioOpTimeoutSec, leaseRetries): if (lockRenewalIntervalSec and leaseTimeSec and - ioOpTimeoutSec and leaseRetries): + ioOpTimeoutSec and leaseRetries): return {DMDK_LEASE_RETRIES: leaseRetries, DMDK_LEASE_TIME_SEC: leaseTimeSec, DMDK_LOCK_RENEWAL_INTERVAL_SEC: lockRenewalIntervalSec, diff --git a/vdsm/storage/task.py b/vdsm/storage/task.py index a596494..716c1c0 100644 --- a/vdsm/storage/task.py +++ b/vdsm/storage/task.py @@ -484,7 +484,7 @@ if not self.state.isDone(): taskDir = None if (self.cleanPolicy == TaskCleanType.auto and - self.store is not None): + self.store is not None): taskDir = os.path.join(self.store, self.id) threading.Thread(target=finalize, args=(self.log, self.resOwner, taskDir)).start() @@ -900,7 +900,7 @@ try: try: if (not self.state.canAbort() and - (force and not self.state.canAbortRecover())): + (force and not self.state.canAbortRecover())): self.log.warning("Task._doAbort %s: ignoring - " "at state %s", self, self.state) return @@ -1072,7 +1072,7 @@ raise se.TaskPersistError("%s: cannot access/create taskdir" " %s: %s" % (self, taskDir, e)) if (self.persistPolicy == TaskPersistType.auto and - self.state != State.init): + self.state != State.init): self.persist() def setRecoveryPolicy(self, clean): diff --git a/vdsm/storage/volume.py b/vdsm/storage/volume.py index 3f82e08..cde612a 100644 --- a/vdsm/storage/volume.py +++ b/vdsm/storage/volume.py @@ -718,7 +718,7 @@ raise se.SharedVolumeNonWritable(self) if (not chainrw and rw and self.isInternal() and setrw and - not self.recheckIfLeaf()): + not self.recheckIfLeaf()): raise se.InternalVolumeNonWritable(self) self.llPrepare(rw=rw, setrw=setrw) @@ -830,9 +830,10 @@ """ vols = self.getImageVolumes(self.repoPath, self.sdUUID, self.imgUUID) children = [] + dom = sdCache.produce(self.sdUUID) for v in vols: - if (sdCache.produce(self.sdUUID). - produceVolume(self.imgUUID, v).getParent() == self.volUUID): + if (dom.produceVolume(self.imgUUID, v).getParent() == + self.volUUID): children.append(v) return children @@ -1008,7 +1009,7 @@ (src, src_fmt, dst, dst_fmt)) if (src_fmt == "raw" and dst_fmt == "raw" and - dstvolType == PREALLOCATED_VOL): + dstvolType == PREALLOCATED_VOL): (rc, out, err) = misc.ddWatchCopy( src=src, dst=dst, stop=stop, size=size, diff --git a/vdsm_hooks/fileinject/before_vm_start.py b/vdsm_hooks/fileinject/before_vm_start.py index 7a2dd1f..0f571e8 100755 --- a/vdsm_hooks/fileinject/before_vm_start.py +++ b/vdsm_hooks/fileinject/before_vm_start.py @@ -79,14 +79,14 @@ rawcount = 0 for disk in disks: if (disk.hasAttribute('device') and - disk.attributes['device'].value == 'disk'): + disk.attributes['device'].value == 'disk'): sources = disk.getElementsByTagName('source') if len(sources) > 0: source = sources[0] drivers = disk.getElementsByTagName('driver') if (len(drivers) > 0 and drivers[0].hasAttribute('type') and - drivers[0].attributes['type'].value == 'qcow2'): + drivers[0].attributes['type'].value == 'qcow2'): # we can only inject to 'raw' file format continue diff --git a/vdsm_hooks/promisc/after_vm_start.py b/vdsm_hooks/promisc/after_vm_start.py index 1310b62..30f04eb 100755 --- a/vdsm_hooks/promisc/after_vm_start.py +++ b/vdsm_hooks/promisc/after_vm_start.py @@ -110,7 +110,7 @@ for iface in interfaces: if (iface.hasAttribute('type') and - iface.attributes['type'].value == 'bridge'): + iface.attributes['type'].value == 'bridge'): ifaceName = getIfaceName(iface) if mode == MODE_MIRROR: -- To view, visit http://gerrit.ovirt.org/9805 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I63312573beac2dfd2fa3062c5e6656d8b7fb50ce Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Dan Kenigsberg <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
