summaryrefslogtreecommitdiff
path: root/vendor/github.com/Microsoft/hcsshim/internal/hns
diff options
context:
space:
mode:
authorTomSweeneyRedHat <tsweeney@redhat.com>2019-11-13 10:30:08 -0500
committerTomSweeneyRedHat <tsweeney@redhat.com>2019-11-13 10:57:19 -0500
commit6003033adae775f1d725b05231a246a4462ae669 (patch)
treec570c523df92c3c0fb4b704c5c45b0de6603b7d6 /vendor/github.com/Microsoft/hcsshim/internal/hns
parentde32b89eff0928abdef9d85a420b65d8865e737e (diff)
downloadpodman-6003033adae775f1d725b05231a246a4462ae669.tar.gz
podman-6003033adae775f1d725b05231a246a4462ae669.tar.bz2
podman-6003033adae775f1d725b05231a246a4462ae669.zip
Bump to Buildah v1.11.5
Bump to Buildah v1.11.5. Most notably changes to the podman build `--pull` functionality. `--pull=true` and `--pull=false` now work as Docker does, `--pull-never` added to supply the functionality of the old `--pull=false`. Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Diffstat (limited to 'vendor/github.com/Microsoft/hcsshim/internal/hns')
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go22
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hns/hnsfuncs.go15
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go10
-rw-r--r--vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go5
4 files changed, 44 insertions, 8 deletions
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go
index 59ec7004c..6a1c41e15 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go
@@ -3,6 +3,7 @@ package hns
import (
"encoding/json"
"net"
+ "strings"
"github.com/sirupsen/logrus"
)
@@ -94,6 +95,27 @@ func GetHNSEndpointByName(endpointName string) (*HNSEndpoint, error) {
return nil, EndpointNotFoundError{EndpointName: endpointName}
}
+type endpointAttachInfo struct {
+ SharedContainers json.RawMessage `json:",omitempty"`
+}
+
+func (endpoint *HNSEndpoint) IsAttached(vID string) (bool, error) {
+ attachInfo := endpointAttachInfo{}
+ err := hnsCall("GET", "/endpoints/"+endpoint.Id, "", &attachInfo)
+
+ // Return false allows us to just return the err
+ if err != nil {
+ return false, err
+ }
+
+ if strings.Contains(strings.ToLower(string(attachInfo.SharedContainers)), strings.ToLower(vID)) {
+ return true, nil
+ }
+
+ return false, nil
+
+}
+
// Create Endpoint by sending EndpointRequest to HNS. TODO: Create a separate HNS interface to place all these methods
func (endpoint *HNSEndpoint) Create() (*HNSEndpoint, error) {
operation := "Create"
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsfuncs.go b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsfuncs.go
index 969d1b263..2df4a57f5 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsfuncs.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsfuncs.go
@@ -9,23 +9,30 @@ import (
"github.com/sirupsen/logrus"
)
-func hnsCall(method, path, request string, returnResponse interface{}) error {
+func hnsCallRawResponse(method, path, request string) (*hnsResponse, error) {
var responseBuffer *uint16
logrus.Debugf("[%s]=>[%s] Request : %s", method, path, request)
err := _hnsCall(method, path, request, &responseBuffer)
if err != nil {
- return hcserror.New(err, "hnsCall ", "")
+ return nil, hcserror.New(err, "hnsCall ", "")
}
response := interop.ConvertAndFreeCoTaskMemString(responseBuffer)
hnsresponse := &hnsResponse{}
if err = json.Unmarshal([]byte(response), &hnsresponse); err != nil {
- return err
+ return nil, err
}
+ return hnsresponse, nil
+}
+func hnsCall(method, path, request string, returnResponse interface{}) error {
+ hnsresponse, err := hnsCallRawResponse(method, path, request)
+ if err != nil {
+ return fmt.Errorf("failed during hnsCallRawResponse: %v", err)
+ }
if !hnsresponse.Success {
- return fmt.Errorf("HNS failed with error : %s", hnsresponse.Error)
+ return fmt.Errorf("hns failed with error : %s", hnsresponse.Error)
}
if len(hnsresponse.Output) == 0 {
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go
index 7e859de91..b7ae96fdd 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go
@@ -2,9 +2,9 @@ package hns
import (
"encoding/json"
- "net"
-
+ "errors"
"github.com/sirupsen/logrus"
+ "net"
)
// Subnet is assoicated with a network and represents a list
@@ -98,6 +98,12 @@ func (network *HNSNetwork) Create() (*HNSNetwork, error) {
title := "hcsshim::HNSNetwork::" + operation
logrus.Debugf(title+" id=%s", network.Id)
+ for _, subnet := range network.Subnets {
+ if (subnet.AddressPrefix != "") && (subnet.GatewayAddress == "") {
+ return nil, errors.New("network create error, subnet has address prefix but no gateway specified")
+ }
+ }
+
jsonString, err := json.Marshal(network)
if err != nil {
return nil, err
diff --git a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go
index 2318a4fce..61da242ee 100644
--- a/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go
+++ b/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicy.go
@@ -55,8 +55,9 @@ type PaPolicy struct {
type OutboundNatPolicy struct {
Policy
- VIP string `json:"VIP,omitempty"`
- Exceptions []string `json:"ExceptionList,omitempty"`
+ VIP string `json:"VIP,omitempty"`
+ Exceptions []string `json:"ExceptionList,omitempty"`
+ Destinations []string `json:",omitempty"`
}
type ActionType string