mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update hcsshim to v0.6.7 for go1.9 support
Signed-off-by: Darren Stahl <darst@microsoft.com>
This commit is contained in:
parent
9de84a78d7
commit
0bee8049c7
8 changed files with 77 additions and 31 deletions
|
@ -1,6 +1,6 @@
|
||||||
# the following lines are in sorted order, FYI
|
# the following lines are in sorted order, FYI
|
||||||
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
|
github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
|
||||||
github.com/Microsoft/hcsshim v0.6.5
|
github.com/Microsoft/hcsshim v0.6.7
|
||||||
github.com/Microsoft/go-winio v0.4.5
|
github.com/Microsoft/go-winio v0.4.5
|
||||||
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
|
github.com/davecgh/go-spew 346938d642f2ec3594ed81d874461961cd0faa76
|
||||||
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
||||||
|
|
22
vendor/github.com/Microsoft/hcsshim/errors.go
generated
vendored
22
vendor/github.com/Microsoft/hcsshim/errors.go
generated
vendored
|
@ -72,6 +72,22 @@ var (
|
||||||
ErrPlatformNotSupported = errors.New("unsupported platform request")
|
ErrPlatformNotSupported = errors.New("unsupported platform request")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type EndpointNotFoundError struct {
|
||||||
|
EndpointName string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e EndpointNotFoundError) Error() string {
|
||||||
|
return fmt.Sprintf("Endpoint %s not found", e.EndpointName)
|
||||||
|
}
|
||||||
|
|
||||||
|
type NetworkNotFoundError struct {
|
||||||
|
NetworkName string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (e NetworkNotFoundError) Error() string {
|
||||||
|
return fmt.Sprintf("Network %s not found", e.NetworkName)
|
||||||
|
}
|
||||||
|
|
||||||
// ProcessError is an error encountered in HCS during an operation on a Process object
|
// ProcessError is an error encountered in HCS during an operation on a Process object
|
||||||
type ProcessError struct {
|
type ProcessError struct {
|
||||||
Process *process
|
Process *process
|
||||||
|
@ -174,6 +190,12 @@ func makeProcessError(process *process, operation string, extraInfo string, err
|
||||||
// will currently return true when the error is ErrElementNotFound or ErrProcNotFound.
|
// will currently return true when the error is ErrElementNotFound or ErrProcNotFound.
|
||||||
func IsNotExist(err error) bool {
|
func IsNotExist(err error) bool {
|
||||||
err = getInnerError(err)
|
err = getInnerError(err)
|
||||||
|
if _, ok := err.(EndpointNotFoundError); ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if _, ok := err.(NetworkNotFoundError); ok {
|
||||||
|
return true
|
||||||
|
}
|
||||||
return err == ErrComputeSystemDoesNotExist ||
|
return err == ErrComputeSystemDoesNotExist ||
|
||||||
err == ErrElementNotFound ||
|
err == ErrElementNotFound ||
|
||||||
err == ErrProcNotFound
|
err == ErrProcNotFound
|
||||||
|
|
17
vendor/github.com/Microsoft/hcsshim/hnsendpoint.go
generated
vendored
17
vendor/github.com/Microsoft/hcsshim/hnsendpoint.go
generated
vendored
|
@ -2,7 +2,6 @@ package hcsshim
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -135,7 +134,7 @@ func GetHNSEndpointByName(endpointName string) (*HNSEndpoint, error) {
|
||||||
return &hnsEndpoint, nil
|
return &hnsEndpoint, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("Endpoint %v not found", endpointName)
|
return nil, EndpointNotFoundError{EndpointName: endpointName}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Endpoint by sending EndpointRequest to HNS. TODO: Create a separate HNS interface to place all these methods
|
// Create Endpoint by sending EndpointRequest to HNS. TODO: Create a separate HNS interface to place all these methods
|
||||||
|
@ -192,18 +191,24 @@ func (endpoint *HNSEndpoint) ContainerHotDetach(containerID string) error {
|
||||||
return modifyNetworkEndpoint(containerID, endpoint.Id, Remove)
|
return modifyNetworkEndpoint(containerID, endpoint.Id, Remove)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ApplyACLPolicy applies Acl Policy on the Endpoint
|
// ApplyACLPolicy applies a set of ACL Policies on the Endpoint
|
||||||
func (endpoint *HNSEndpoint) ApplyACLPolicy(policy *ACLPolicy) error {
|
func (endpoint *HNSEndpoint) ApplyACLPolicy(policies ...*ACLPolicy) error {
|
||||||
operation := "ApplyACLPolicy"
|
operation := "ApplyACLPolicy"
|
||||||
title := "HCSShim::HNSEndpoint::" + operation
|
title := "HCSShim::HNSEndpoint::" + operation
|
||||||
logrus.Debugf(title+" id=%s", endpoint.Id)
|
logrus.Debugf(title+" id=%s", endpoint.Id)
|
||||||
|
|
||||||
|
for _, policy := range policies {
|
||||||
|
if policy == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
jsonString, err := json.Marshal(policy)
|
jsonString, err := json.Marshal(policy)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
endpoint.Policies[0] = jsonString
|
endpoint.Policies = append(endpoint.Policies, jsonString)
|
||||||
_, err = endpoint.Update()
|
}
|
||||||
|
|
||||||
|
_, err := endpoint.Update()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
vendor/github.com/Microsoft/hcsshim/hnsnetwork.go
generated
vendored
3
vendor/github.com/Microsoft/hcsshim/hnsnetwork.go
generated
vendored
|
@ -2,7 +2,6 @@ package hcsshim
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net"
|
"net"
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
@ -90,7 +89,7 @@ func GetHNSNetworkByName(networkName string) (*HNSNetwork, error) {
|
||||||
return &hnsnetwork, nil
|
return &hnsnetwork, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("Network %v not found", networkName)
|
return nil, NetworkNotFoundError{NetworkName: networkName}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Network by sending NetworkRequest to HNS.
|
// Create Network by sending NetworkRequest to HNS.
|
||||||
|
|
5
vendor/github.com/Microsoft/hcsshim/hnspolicy.go
generated
vendored
5
vendor/github.com/Microsoft/hcsshim/hnspolicy.go
generated
vendored
|
@ -80,12 +80,11 @@ type ACLPolicy struct {
|
||||||
InternalPort uint16
|
InternalPort uint16
|
||||||
Action ActionType
|
Action ActionType
|
||||||
Direction DirectionType
|
Direction DirectionType
|
||||||
LocalAddress string
|
LocalAddresses string
|
||||||
RemoteAddress string
|
RemoteAddresses string
|
||||||
LocalPort uint16
|
LocalPort uint16
|
||||||
RemotePort uint16
|
RemotePort uint16
|
||||||
RuleType RuleType `json:"RuleType,omitempty"`
|
RuleType RuleType `json:"RuleType,omitempty"`
|
||||||
|
|
||||||
Priority uint16
|
Priority uint16
|
||||||
ServiceName string
|
ServiceName string
|
||||||
}
|
}
|
||||||
|
|
19
vendor/github.com/Microsoft/hcsshim/legacy.go
generated
vendored
19
vendor/github.com/Microsoft/hcsshim/legacy.go
generated
vendored
|
@ -472,15 +472,21 @@ func cloneTree(srcPath, destPath string, mutatedFiles map[string]bool) error {
|
||||||
}
|
}
|
||||||
destFilePath := filepath.Join(destPath, relPath)
|
destFilePath := filepath.Join(destPath, relPath)
|
||||||
|
|
||||||
|
fileAttributes := info.Sys().(*syscall.Win32FileAttributeData).FileAttributes
|
||||||
// Directories, reparse points, and files that will be mutated during
|
// Directories, reparse points, and files that will be mutated during
|
||||||
// utility VM import must be copied. All other files can be hard linked.
|
// utility VM import must be copied. All other files can be hard linked.
|
||||||
isReparsePoint := info.Sys().(*syscall.Win32FileAttributeData).FileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0
|
isReparsePoint := fileAttributes&syscall.FILE_ATTRIBUTE_REPARSE_POINT != 0
|
||||||
if info.IsDir() || isReparsePoint || mutatedFiles[relPath] {
|
// In go1.9, FileInfo.IsDir() returns false if the directory is also a symlink.
|
||||||
fi, err := copyFileWithMetadata(srcFilePath, destFilePath, info.IsDir())
|
// See: https://github.com/golang/go/commit/1989921aef60c83e6f9127a8448fb5ede10e9acc
|
||||||
|
// Fixes the problem by checking syscall.FILE_ATTRIBUTE_DIRECTORY directly
|
||||||
|
isDir := fileAttributes&syscall.FILE_ATTRIBUTE_DIRECTORY != 0
|
||||||
|
|
||||||
|
if isDir || isReparsePoint || mutatedFiles[relPath] {
|
||||||
|
fi, err := copyFileWithMetadata(srcFilePath, destFilePath, isDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if info.IsDir() && !isReparsePoint {
|
if isDir && !isReparsePoint {
|
||||||
di = append(di, dirInfo{path: destFilePath, fileInfo: *fi})
|
di = append(di, dirInfo{path: destFilePath, fileInfo: *fi})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -490,8 +496,9 @@ func cloneTree(srcPath, destPath string, mutatedFiles map[string]bool) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't recurse on reparse points.
|
// Don't recurse on reparse points in go1.8 and older. Filepath.Walk
|
||||||
if info.IsDir() && isReparsePoint {
|
// handles this in go1.9 and newer.
|
||||||
|
if isDir && isReparsePoint && shouldSkipDirectoryReparse {
|
||||||
return filepath.SkipDir
|
return filepath.SkipDir
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
7
vendor/github.com/Microsoft/hcsshim/legacy18.go
generated
vendored
Normal file
7
vendor/github.com/Microsoft/hcsshim/legacy18.go
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// +build !go1.9
|
||||||
|
|
||||||
|
package hcsshim
|
||||||
|
|
||||||
|
// Due to a bug in go1.8 and before, directory reparse points need to be skipped
|
||||||
|
// during filepath.Walk. This is fixed in go1.9
|
||||||
|
var shouldSkipDirectoryReparse = true
|
7
vendor/github.com/Microsoft/hcsshim/legacy19.go
generated
vendored
Normal file
7
vendor/github.com/Microsoft/hcsshim/legacy19.go
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
// +build go1.9
|
||||||
|
|
||||||
|
package hcsshim
|
||||||
|
|
||||||
|
// Due to a bug in go1.8 and before, directory reparse points need to be skipped
|
||||||
|
// during filepath.Walk. This is fixed in go1.9
|
||||||
|
var shouldSkipDirectoryReparse = false
|
Loading…
Add table
Reference in a new issue