summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/hnsendpoint.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/hnsendpoint.go')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/hnsendpoint.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/hnsendpoint.go b/vendor/github.com/Microsoft/hcsshim/hnsendpoint.go
index eb013d2c4..09b3860a7 100644
--- a/vendor/github.com/Microsoft/hcsshim/hnsendpoint.go
+++ b/vendor/github.com/Microsoft/hcsshim/hnsendpoint.go
@@ -39,11 +39,21 @@ func HNSListEndpointRequest() ([]HNSEndpoint, error) {
// HotAttachEndpoint makes a HCS Call to attach the endpoint to the container
func HotAttachEndpoint(containerID string, endpointID string) error {
+ endpoint, err := GetHNSEndpointByID(endpointID)
+ isAttached, err := endpoint.IsAttached(containerID)
+ if isAttached {
+ return err
+ }
return modifyNetworkEndpoint(containerID, endpointID, Add)
}
// HotDetachEndpoint makes a HCS Call to detach the endpoint from the container
func HotDetachEndpoint(containerID string, endpointID string) error {
+ endpoint, err := GetHNSEndpointByID(endpointID)
+ isAttached, err := endpoint.IsAttached(containerID)
+ if !isAttached {
+ return err
+ }
return modifyNetworkEndpoint(containerID, endpointID, Remove)
}