From 8e00f36a0eff4a16f06922b92fcbaee204af1757 Mon Sep 17 00:00:00 2001
From: Michele Tartara <mtartara@google.com>
Date: Mon, 25 Mar 2013 16:51:07 +0100
Subject: [PATCH] Add function for extending the reason trail

Noded functions will have to extend the reason trail specifying what
operation is being executed.

This commit adds a function for doing that (will be used by future commits).

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Helga Velroyen <helgav@google.com>
---
 lib/server/noded.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/lib/server/noded.py b/lib/server/noded.py
index 1351b9c90..2e1ceaade 100644
--- a/lib/server/noded.py
+++ b/lib/server/noded.py
@@ -57,6 +57,16 @@ import ganeti.http.server # pylint: disable=W0611
 queue_lock = None
 
 
+def _extendReasonTrail(trail, source, reason=""):
+  """Extend the reason trail with noded information
+
+  The trail is extended by appending the name of the noded functionality
+  """
+  assert trail is not None
+  trail_source = "%s:%s" % (constants.OPCODE_REASON_SRC_NODED, source)
+  trail.append((trail_source, reason, utils.EpochNano()))
+
+
 def _PrepareQueueLock():
   """Try to prepare the queue lock.
 
-- 
GitLab