From f75835322c5305ff66522bf3e3b3efd03524c901 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 7 Sep 2018 18:16:34 -0700 Subject: [PATCH 1/2] Remove hot attach for create endpoint. Join will hot attach instead --- network/endpoint_windows.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/network/endpoint_windows.go b/network/endpoint_windows.go index 57892e3e08..cd9ec0409a 100644 --- a/network/endpoint_windows.go +++ b/network/endpoint_windows.go @@ -88,13 +88,8 @@ func (nw *network) newEndpointImpl(epInfo *EndpointInfo) (*endpoint, error) { } }() - // Attach the endpoint. - log.Printf("[net] Attaching endpoint %v to container %v.", hnsResponse.Id, epInfo.ContainerID) - err = hcsshim.HotAttachEndpoint(epInfo.ContainerID, hnsResponse.Id) - if err != nil { - log.Printf("[net] Failed to attach endpoint: %v.", err) - return nil, err - } + // Attach the endpoint happens on join + log.Printf("[net] Skipping Attaching endpoint %v to container %v, as this will happen in NetworkDriver/Join", hnsResponse.Id, epInfo.ContainerID) // Create the endpoint object. ep := &endpoint{ From e61e92a29b656aedac0a7f906fc45ac53fc9978a Mon Sep 17 00:00:00 2001 From: plooploops Date: Thu, 13 Sep 2018 15:13:51 -0700 Subject: [PATCH 2/2] Update for CNI vs. CNM. CNM attach as separate step. --- network/endpoint_windows.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/network/endpoint_windows.go b/network/endpoint_windows.go index cd9ec0409a..8252fa6274 100644 --- a/network/endpoint_windows.go +++ b/network/endpoint_windows.go @@ -89,7 +89,17 @@ func (nw *network) newEndpointImpl(epInfo *EndpointInfo) (*endpoint, error) { }() // Attach the endpoint happens on join - log.Printf("[net] Skipping Attaching endpoint %v to container %v, as this will happen in NetworkDriver/Join", hnsResponse.Id, epInfo.ContainerID) + if len(epInfo.ContainerID) > 0 { + log.Printf("[net] Attaching endpoint %v to container %v.", hnsResponse.Id, epInfo.ContainerID) + err = hcsshim.HotAttachEndpoint(epInfo.ContainerID, hnsResponse.Id) + if err != nil { + log.Printf("[net] Failed to attach endpoint: %v.", err) + return nil, err + } + } else { + // Attach the endpoint happens on join + log.Printf("[net] Skipping Attaching endpoint %v to container %v, as this will happen in NetworkDriver/Join", hnsResponse.Id, epInfo.ContainerID) + } // Create the endpoint object. ep := &endpoint{