Annotate logs in Nodepool API where possible
Some methods in the Nodepool API did not use the annotated logger that adds the zuul event id to the log lines. Change-Id: Iff99b0be5791abb0cc3eac3546f36994b8c6fdfe
This commit is contained in:
parent
a1bfee1f9a
commit
69c9ec33ae
|
@ -367,6 +367,7 @@ class Nodepool(object):
|
|||
self.log.exception("Error unlocking node:")
|
||||
|
||||
def lockNodes(self, request, nodeset):
|
||||
log = get_annotated_logger(self.log, event=request.event_id)
|
||||
# Try to lock all of the supplied nodes. If any lock fails,
|
||||
# try to unlock any which have already been locked before
|
||||
# re-raising the error.
|
||||
|
@ -377,7 +378,7 @@ class Nodepool(object):
|
|||
if node.allocated_to != request.id:
|
||||
raise Exception("Node %s allocated to %s, not %s" %
|
||||
(node.id, node.allocated_to, request.id))
|
||||
self.log.debug("Locking node %s" % (node,))
|
||||
log.debug("Locking node %s", node)
|
||||
self.zk_nodepool.lockNode(node, timeout=30)
|
||||
# Check the allocated_to again to ensure that nodepool didn't
|
||||
# re-allocate the nodes to a different node request while we
|
||||
|
@ -388,7 +389,7 @@ class Nodepool(object):
|
|||
(node.id, node.allocated_to, request.id))
|
||||
locked_nodes.append(node)
|
||||
except Exception:
|
||||
self.log.exception("Error locking nodes:")
|
||||
log.exception("Error locking nodes:")
|
||||
self._unlockNodes(locked_nodes)
|
||||
raise
|
||||
|
||||
|
@ -432,7 +433,7 @@ class Nodepool(object):
|
|||
|
||||
# Regardless of whether locking (or even the request)
|
||||
# succeeded, delete the request.
|
||||
if not self.deleteNodeRequest(request.id, locked):
|
||||
if not self.deleteNodeRequest(request.id, locked, request.event_id):
|
||||
request.failed = True
|
||||
self.unlockNodeSet(request.nodeset)
|
||||
|
||||
|
|
Loading…
Reference in New Issue