Change in vdsm[master]: Update except syntax according to pep3110.
ewoud at kohlvanwijngaarden.nl
ewoud at kohlvanwijngaarden.nl
Sun Jan 13 16:32:02 UTC 2013
Ewoud Kohl van Wijngaarden has posted comments on this change.
Change subject: Update except syntax according to pep3110.
......................................................................
Patch Set 1: Looks good to me, but someone else must approve
(17 inline comments)
In itself a good start. All of the comments are existing issues that could be solved in later patches and some that should because they're unrelated.
....................................................
File vdsm_reg/deployUtil.py.in
Line 818: try:
Line 819: ttp = time.strptime(VDCTime, '%Y-%m-%dT%H:%M:%S')
Line 820: except ValueError as e:
Line 821: logging.debug("setHostTime: Failed to parse @ENGINENAME@ time. "
Line 822: "message= " + str(e))
unrelated, but could be written as logging.debug("[..] message=%s", e)
Line 823: fReturn = False
Line 824:
Line 825: if fReturn:
Line 826: out, err, rc = _logExec(
....................................................
File vdsm_reg/vdsm-reg-setup.in
Line 220: os.chmod(upgradeDir, 0755)
Line 221: except OSError as err:
Line 222: if err.errno != errno.EEXIST:
Line 223: log.error(
Line 224: "can not create vdsm upgrade dir: %s" % upgradeDir
unrelated, but could be written as log.error("[..]", upgradeDir)
Line 225: )
Line 226:
Line 227: def run(confFile, daemonize):
Line 228: #print "entered run(conf='%s', daemonize='%s')"%(confFile,str(daemonize))
....................................................
File vdsm/storage/blockVolume.py
Line 681: misc.ddWatchCopy(
Line 682: "/dev/zero", lvm.lvPath(sdUUID, lv.name),
Line 683: vars.task.aborting, int(lv.size),
Line 684: recoveryCallback=volume.baseAsyncTasksRollback)
Line 685: except se.ActionStopped, e:
looks like you missed one here
Line 686: raise e
Line 687: except Exception as e:
Line 688: raise se.VolumesZeroingError(lv.name)
Line 689:
....................................................
File vdsm/storage/dispatcher.py
Line 62: result = ctask.prepare(self.func, *args, **kwargs)
Line 63: if type(result) == dict:
Line 64: response.update(result)
Line 65: return response
Line 66: except se.GeneralException, e:
missed one here
Line 67: self.log.error(e.response())
Line 68: return e.response()
Line 69: except BaseException as e:
Line 70: self.log.error(e, exc_info=True)
....................................................
File vdsm/storage/fileVolume.py
Line 140: try:
Line 141: # ddWatchCopy expects size to be in bytes
Line 142: misc.ddWatchCopy("/dev/zero", volPath,
Line 143: vars.task.aborting, sizeBytes)
Line 144: except se.ActionStopped, e:
missed one here
Line 145: raise e
Line 146: except Exception as e:
Line 147: cls.log.error("Unexpected error", exc_info=True)
Line 148: raise se.VolumesZeroingError(volPath)
....................................................
File vdsm/storage/image.py
Line 917: dstVol.extend(newsize)
Line 918: dstPath = dstVol.getVolumePath()
Line 919: # Change destination volume metadata back to the original size.
Line 920: dstVol.setSize(volParams['size'])
Line 921: except se.StorageException, e:
missed one, but it looks like it's not used anyway so maybe just remove it?
Line 922: self.log.error("Unexpected error", exc_info=True)
Line 923: raise
Line 924: except Exception as e:
Line 925: self.log.error("Unexpected error", exc_info=True)
Line 951:
Line 952: if force:
Line 953: # Now we should re-link all deleted hardlinks, if exists
Line 954: self.__templateRelink(destDom, dstImgUUID, dstVolUUID)
Line 955: except se.StorageException, e:
missed an unused one here
Line 956: self.log.error("Unexpected error", exc_info=True)
Line 957: raise
Line 958: except Exception as e:
Line 959: self.log.error("Unexpected error", exc_info=True)
....................................................
File vdsm/storage/lvm.py
Line 662: os.path.basename(device))
Line 663: except OSError as e:
Line 664: if e.errno == errno.ENODEV:
Line 665: raise se.PhysDevInitializationError("%s: %s" %
Line 666: (device, str(e)))
unrelated, but the str(e) could rewritten as e
Line 667: else:
Line 668: raise
Line 669:
Line 670: if force is True:
....................................................
File vdsm/storage/remoteFileHandler.py
Line 395: server.registerFunction(func)
Line 396:
Line 397: for mod in (os, glob, fileUtils):
Line 398: server.registerModule(mod)
Line 399: except Exception as ex:
unused, maybe remove it?
Line 400: logging.root.error("Error creating CrabRPC server", exc_info=True)
Line 401: raise
Line 402:
Line 403: try:
Line 401: raise
Line 402:
Line 403: try:
Line 404: server.serve_forever()
Line 405: except Exception as ex:
unused, maybe remove it?
Line 406: logging.root.error("Error while serving", exc_info=True)
Line 407: raise
Line 408:
Line 409: except BaseException as e:
....................................................
File vdsm/storage/resourceFactories.py
Line 175: except (rm.RequestTimedOutError, se.ResourceAcqusitionFailed), e:
Line 176: log.debug("Cannot acquire volume resource (%s)", str(e))
Line 177: failed = True
Line 178: raise
Line 179: except Exception as e:
unused, maybe remove it?
Line 180: log.debug("Cannot acquire volume resource", exc_info=True)
Line 181: failed = True
Line 182: raise
Line 183: finally:
....................................................
File vdsm/storage/resourceManager.py
Line 820: except ValueError as ex:
Line 821: self.log.debug("%s: request for '%s' could not be "
Line 822: "processed (%s)", self, fullName, ex)
Line 823: raise se.InvalidResourceName()
Line 824: except KeyError as ex:
unused, maybe remove it?
Line 825: self.log.debug("%s: resource '%s' does not exist", self,
Line 826: fullName)
Line 827: except Exception as ex:
Line 828: self.log.warn("Unexpected exception caught while owner "
Line 823: raise se.InvalidResourceName()
Line 824: except KeyError as ex:
Line 825: self.log.debug("%s: resource '%s' does not exist", self,
Line 826: fullName)
Line 827: except Exception as ex:
unused, maybe remove it?
Line 828: self.log.warn("Unexpected exception caught while owner "
Line 829: "'%s' tried to acquire '%s'", self, fullName,
Line 830: exc_info=True)
Line 831: raise se.ResourceException(fullName)
Line 868: except ValueError as ex:
Line 869: self.log.debug("%s: request for '%s' could not be processed "
Line 870: "(%s)", self, fullName, ex)
Line 871: raise se.InvalidResourceName()
Line 872: except KeyError as ex:
unused, maybe remove it?
Line 873: self.log.debug("%s: resource '%s' does not exist", self,
Line 874: fullName)
Line 875: raise se.ResourceDoesNotExist()
Line 876: except Exception as ex:
Line 872: except KeyError as ex:
Line 873: self.log.debug("%s: resource '%s' does not exist", self,
Line 874: fullName)
Line 875: raise se.ResourceDoesNotExist()
Line 876: except Exception as ex:
unused, maybe remove it?
Line 877: self.log.warn("Unexpected exception caught while owner '%s' "
Line 878: "tried to acquire '%s'", self, fullName,
Line 879: exc_info=True)
Line 880: raise se.ResourceException()
....................................................
File vdsm/storage/sp.py
Line 296:
Line 297: try:
Line 298: # Make sure backup domain is active
Line 299: self.checkBackupDomain(__securityOverride=True)
Line 300: except Exception as e:
unused, maybe remove it?
Line 301: self.log.error("Backup domain validation failed",
Line 302: exc_info=True)
Line 303:
Line 304: self.taskMng.loadDumpedTasks(self.tasksDir)
Line 339: self.log.debug("ended.")
Line 340:
Line 341: except Exception as e:
Line 342: self.log.error("Unexpected error", exc_info=True)
Line 343: self.log.error("failed: %s" % str(e))
unrelated, but str(e) could be rewritten as e
Line 344: self.stopSpm(force=True, __securityOverride=True)
Line 345: raise
Line 346:
Line 347: @unsecured
--
To view, visit http://gerrit.ovirt.org/10942
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I2c4ac78dace34a41e1afb9f6560889ad9bd34ddf
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ewoud Kohl van Wijngaarden <ewoud at kohlvanwijngaarden.nl>
Gerrit-Reviewer: Zhou Zheng Sheng <zhshzhou at linux.vnet.ibm.com>
Gerrit-Reviewer: oVirt Jenkins CI Server
More information about the vdsm-patches
mailing list