Commit 0fbbf897 authored by Iustin Pop's avatar Iustin Pop
Browse files

Add better error logging functions for LUs

Currently, some LUs use logger.Error, others just feedback_fn, etc. This
patch adds three functions to mcpu.Processor than can be used to log
messages to both the log and to the user.

These function will be used to enhance the output of replace-disks for
drbd8 (at least).

Reviewed-by: imsnah
parent 03ece5f3
......@@ -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.
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.
self._feedback_fn(" - INFO: %s" % message)
class HooksMaster(object):
"""Hooks master.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment