diff --git a/lib/mcpu.py b/lib/mcpu.py index 5226fd7ffe5549535339a1bb599cc2da84e7b435..6b3ec768dbd5cf5cd021f1ef93e2cc0c6a5aa96e 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -36,6 +36,7 @@ from ganeti import rpc from ganeti import cmdlib from ganeti import config from ganeti import ssconf +from ganeti import logger class Processor(object): """Object which runs OpCodes""" @@ -165,6 +166,28 @@ class Processor(object): # hm.RunPhase(constants.HOOKS_PHASE_POST) return result + def LogStep(self, current, total, message): + """Log a change in LU execution progress. + + """ + logger.Debug("Step %d/%d %s" % (current, total, message)) + self._feedback_fn("STEP %d/%d %s" % (current, total, message)) + + def LogWarning(self, message, hint): + """Log a warning to the logs and the user. + + """ + logger.Error(message) + self._feedback_fn(" - WARNING: %s" % message) + self._feedback_fn(" Hint: %s" % hint) + + def LogInfo(self, message): + """Log an informational message to the logs and the user. + + """ + logger.Info(message) + self._feedback_fn(" - INFO: %s" % message) + class HooksMaster(object): """Hooks master.