Yaniv Bronhaim has posted comments on this change.
Change subject: Unified network persistence [4.1/4.*] - Upgrade mechanism
......................................................................
Patch Set 15:
(6 comments)
....................................................
File lib/vdsm/tool/upgrade.py
Line 41:
Line 42: To get more functionality you may use this module's 'upgrade'
Line 43: decorator. It removes all boilerplate code, makes sure to run
Line 44: the upgrade only if needed and to automatically call 'seal'
Line 45: if no exception was thrown.
put that part above the decorator imp
Line 46: """
Line 47: def __init__(self, upgradeName):
Line 48: self.upgradeName = upgradeName
Line 49: self.upgradeFilePath = os.path.join(constants.P_VDSM_LIB,
Line 45: if no exception was thrown.
Line 46: """
Line 47: def __init__(self, upgradeName):
Line 48: self.upgradeName = upgradeName
Line 49: self.upgradeFilePath = os.path.join(constants.P_VDSM_LIB,
privates with underscore
Line 50: "upgrade",
self.upgradeName)
Line 51: try:
Line 52: logging.config.fileConfig(LOGGER_CONF_FILE)
Line 53: self.log = logging.getLogger('upgrade')
Line 51: try:
Line 52: logging.config.fileConfig(LOGGER_CONF_FILE)
Line 53: self.log = logging.getLogger('upgrade')
Line 54: except Exception:
Line 55: logging.basicConfig(filename='/dev/stdout', filemode='w+',
stdout? if its important enough it should be out to syslog imo
Line 56: level=logging.DEBUG)
Line 57: logging.error("Could not init proper logging",
exc_info=True)
Line 58: self.log = logging
Line 59:
Line 63: def seal(self):
Line 64: """
Line 65: Mark the upgrade as a success
Line 66: """
Line 67: touchFile(self.upgradeFilePath)
can throws exception. do you need to handle it?
Line 68: self.log.debug("Upgrade %s successfully performed" %
self.upgradeName)
Line 69:
Line 70: def __enter__(self):
Line 71: """
Line 73: will still be output to that logger. However, logging done by
accessing
Line 74: logging directly (Thus using the root logger) will be
'hijacked'
Line 75: to the Upgrade's log instead.
Line 76: """
Line 77: self.oldRoot = logging.root
im sorry.. i don't understand this part
Line 78: logging.root = self.log
Line 79: return self
Line 80:
Line 81: def __exit__(self, type, value, traceback):
Line 91: upgrade.log.debug("Running upgrade %s" %
upgradeName)
Line 92: try:
Line 93: f(*args, **kwargs)
Line 94: except Exception:
Line 95: upgrade.log.exception("Failed to run %s" %
with , instead of %. same for all log usages
Line 96: upgradeName)
Line 97: return 1
Line 98: else:
Line 99: upgrade.seal()
--
To view, visit http://gerrit.ovirt.org/17726
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iba3c9c34f03134c192db1c2add31084824e195d9
Gerrit-PatchSet: 15
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Assaf Muller <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Assaf Muller <[email protected]>
Gerrit-Reviewer: Barak Azulay <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Federico Simoncelli <[email protected]>
Gerrit-Reviewer: Giuseppe Vallarelli <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches