Skip to content

Commit

Permalink
allocator: improve consistency in logging messages
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Feb 9, 2019
1 parent bcdfe65 commit 62a97de
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions manager/allocator/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,10 @@ func (a *Allocator) allocateNode(ctx context.Context, node *api.Node, existingAd

lbAttachment.Network = network.Copy()
if err := a.netCtx.nwkAllocator.AllocateAttachment(node, lbAttachment); err != nil {
log.G(ctx).WithError(err).Errorf("Failed to allocate network resources for node %s", node.ID)
log.G(ctx).WithError(err).WithField("network.id", lbAttachment.Network.ID).Errorf(
"failed to allocate network resources for node %s",
node.ID,
)
// TODO: Should we add a unallocatedNode and retry allocating resources like we do for network, tasks, services?
// right now, we will only retry allocating network resources for the node when the node is updated.
continue
Expand Down Expand Up @@ -1057,9 +1060,9 @@ func (a *Allocator) allocateNode(ctx context.Context, node *api.Node, existingAd

if err := a.netCtx.nwkAllocator.DeallocateAttachment(node, na); err != nil {
// failed to deallocate; there's nothing we can do besides log an error and keep going
log.G(ctx).WithError(err).Errorf(
"error deallocating attachment for network %v on node %v",
na.Network.ID, node.ID,
log.G(ctx).WithError(err).WithField("network.id", na.Network.ID).Errorf(
"failed to deallocate network resources on node %s",
node.ID,
)
}
// strictly speaking, nothing was allocated, but something was
Expand Down

0 comments on commit 62a97de

Please sign in to comment.