Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions cni/network/network_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,16 @@ func handleConsecutiveAdd(args *cniSkel.CmdArgs, endpointId string, nwInfo *netw
hnsEndpoint, err := hcsshim.GetHNSEndpointByName(endpointId)
if hnsEndpoint != nil {
log.Printf("[net] Found existing endpoint through hcsshim: %+v", hnsEndpoint)
log.Printf("[net] Attaching ep %v to container %v", hnsEndpoint.Id, args.ContainerID)

err := hcsshim.HotAttachEndpoint(args.ContainerID, hnsEndpoint.Id)
if err != nil {
log.Printf("[cni-net] Failed to hot attach shared endpoint[%v] to container [%v], err:%v.", hnsEndpoint.Id, args.ContainerID, err)
return nil, err
endpoint, _ := hcsshim.GetHNSEndpointByID(hnsEndpoint.Id)
isAttached, _ := endpoint.IsAttached(args.ContainerID)
// Attach endpoint if it's not attached yet.
if !isAttached {
log.Printf("[net] Attaching ep %v to container %v", hnsEndpoint.Id, args.ContainerID)
err := hcsshim.HotAttachEndpoint(args.ContainerID, hnsEndpoint.Id)
if err != nil {
log.Printf("[cni-net] Failed to hot attach shared endpoint[%v] to container [%v], err:%v.", hnsEndpoint.Id, args.ContainerID, err)
return nil, err
}
}

// Populate result.
Expand Down