Merge pull request #24365 from xianlubird/bug/network-list

Change buildEndpointResource params avoid repeat visits resource
This commit is contained in:
Brian Goff 2016-07-29 14:54:05 -04:00 committed by GitHub
commit 6bf2db574b
1 changed files with 7 additions and 9 deletions

View File

@ -203,12 +203,13 @@ func (n *networkRouter) buildNetworkResource(nw libnetwork.Network) *types.Netwo
continue
}
sb := ei.Sandbox()
key := "ep-" + e.ID()
tmpID := e.ID()
key := "ep-" + tmpID
if sb != nil {
key = sb.ContainerID()
}
r.Containers[key] = buildEndpointResource(e)
r.Containers[key] = buildEndpointResource(tmpID, e.Name(), ei)
}
return r
}
@ -268,15 +269,12 @@ func buildIpamResources(r *types.NetworkResource, nwInfo libnetwork.NetworkInfo)
}
}
func buildEndpointResource(e libnetwork.Endpoint) types.EndpointResource {
func buildEndpointResource(id string, name string, info libnetwork.EndpointInfo) types.EndpointResource {
er := types.EndpointResource{}
if e == nil {
return er
}
er.EndpointID = e.ID()
er.Name = e.Name()
ei := e.Info()
er.EndpointID = id
er.Name = name
ei := info
if ei == nil {
return er
}