Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
Detach namespace from endpoint during DEL call.

Signed-off-by: mansikulkarni96 <[email protected]>
  • Loading branch information
mansikulkarni96 committed Apr 12, 2022
1 parent f30799f commit 75a5394
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/hns/endpoint_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,16 @@ func RemoveHcnEndpoint(epName string) error {
}
return errors.Annotatef(err, "failed to find HostComputeEndpoint %s", epName)
}
epNamespace, err := hcn.GetNamespaceByID(hcnEndpoint.HostComputeNamespace)
if err != nil && !hcn.IsNotFoundError(err) {
return errors.Annotatef(err, "failed to get HostComputeNamespace %s", epName)
}
if epNamespace != nil {
err = hcn.RemoveNamespaceEndpoint(hcnEndpoint.HostComputeNamespace, hcnEndpoint.Id)
if err != nil && !hcn.IsNotFoundError(err) {
return errors.Annotatef(err,"error removing endpoint: %s from namespace", epName)
}
}

err = hcnEndpoint.Delete()
if err != nil {
Expand Down

0 comments on commit 75a5394

Please sign in to comment.