Skip to content

Commit

Permalink
Merge pull request #2680 from weaveworks/2629-host-image-list
Browse files Browse the repository at this point in the history
correct determination of a host's container images
  • Loading branch information
rade authored Jul 5, 2017
2 parents c7a3f7c + 0c122ac commit fd4f1f9
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions render/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,31 @@ var HostRenderer = MakeReduce(
// If this function is given a node without a hostname
// (including other pseudo nodes), it will drop the node.
//
// Otherwise, this function will produce a node with the correct ID
// Otherwise, this function will produce nodes with the correct ID
// format for a host, but without any Major or Minor labels. It does
// not have enough info to do that, and the resulting graph must be
// merged with a host graph to get that info.
func MapX2Host(n report.Node, _ report.Networks) report.Nodes {
// Don't propagate all pseudo nodes - we do this in MapEndpoint2Host
// Don't propagate pseudo nodes - we do this in MapEndpoint2Host
if n.Topology == Pseudo {
return report.Nodes{}
}
hostNodeID, timestamp, ok := n.Latest.LookupEntry(report.HostNodeID)

hostIDs, ok := n.Parents.Lookup(report.Host)
if !ok {
return report.Nodes{}
}
id := report.MakeHostNodeID(report.ExtractHostID(n))
result := NewDerivedNode(id, n).WithTopology(report.Host)
result.Latest = result.Latest.Set(report.HostNodeID, timestamp, hostNodeID)
result.Counters = result.Counters.Add(n.Topology, 1)
result.Children = report.MakeNodeSet(n)
return report.Nodes{id: result}

result := report.Nodes{}
children := report.MakeNodeSet(n)
for _, id := range hostIDs {
node := NewDerivedNode(id, n).WithTopology(report.Host)
node.Counters = node.Counters.Add(n.Topology, 1)
node.Children = children
result[id] = node
}

return result
}

// MapEndpoint2Host takes nodes from the endpoint topology and produces
Expand Down

0 comments on commit fd4f1f9

Please sign in to comment.