Add function for extending the reason trail
authorMichele Tartara <mtartara@google.com>
Mon, 25 Mar 2013 15:51:07 +0000 (16:51 +0100)
committerMichele Tartara <mtartara@google.com>
Mon, 22 Apr 2013 11:13:21 +0000 (11:13 +0000)
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

index 1351b9c..2e1ceaa 100644 (file)
@@ -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.