Browse Source

Merge pull request #20982 from Microsoft/jstarks/fix_tp5_commit

Windows: Revendor github.com/Microsoft/hcsshim
Brian Goff 9 years ago
parent
commit
bc730f3d99

+ 1 - 1
hack/vendor.sh

@@ -7,7 +7,7 @@ source 'hack/.vendor-helpers.sh'
 
 
 # the following lines are in sorted order, FYI
 # the following lines are in sorted order, FYI
 clone git github.com/Azure/go-ansiterm 70b2c90b260171e829f1ebd7c17f600c11858dbe
 clone git github.com/Azure/go-ansiterm 70b2c90b260171e829f1ebd7c17f600c11858dbe
-clone git github.com/Microsoft/hcsshim 9488dda5ab5d3c1af26e17d3d9fc2e9f29009a7b
+clone git github.com/Microsoft/hcsshim 116e0e9f5ced0cec94ae46d0aa1b3002a325f532
 clone git github.com/Microsoft/go-winio c40bf24f405ab3cc8e1383542d474e813332de6d
 clone git github.com/Microsoft/go-winio c40bf24f405ab3cc8e1383542d474e813332de6d
 clone git github.com/Sirupsen/logrus v0.9.0 # logrus is a common dependency among multiple deps
 clone git github.com/Sirupsen/logrus v0.9.0 # logrus is a common dependency among multiple deps
 clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
 clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a

+ 2 - 0
vendor/src/github.com/Microsoft/hcsshim/hcsshim.go

@@ -27,6 +27,8 @@ import (
 //sys nameToGuid(name string, guid *GUID) (hr error) = vmcompute.NameToGuid?
 //sys nameToGuid(name string, guid *GUID) (hr error) = vmcompute.NameToGuid?
 //sys prepareLayer(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.PrepareLayer?
 //sys prepareLayer(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR) (hr error) = vmcompute.PrepareLayer?
 //sys unprepareLayer(info *driverInfo, id string) (hr error) = vmcompute.UnprepareLayer?
 //sys unprepareLayer(info *driverInfo, id string) (hr error) = vmcompute.UnprepareLayer?
+//sys processBaseImage(path string) (hr error) = vmcompute.ProcessBaseImage?
+//sys processUtilityImage(path string) (hr error) = vmcompute.ProcessUtilityImage?
 
 
 //sys importLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) = vmcompute.ImportLayerBegin?
 //sys importLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) = vmcompute.ImportLayerBegin?
 //sys importLayerNext(context uintptr, fileName string, fileInfo *winio.FileBasicInfo) (hr error) = vmcompute.ImportLayerNext?
 //sys importLayerNext(context uintptr, fileName string, fileInfo *winio.FileBasicInfo) (hr error) = vmcompute.ImportLayerNext?

+ 14 - 6
vendor/src/github.com/Microsoft/hcsshim/hnsfuncs.go

@@ -36,12 +36,16 @@ type MacPool struct {
 
 
 // HNSNetwork represents a network in HNS
 // HNSNetwork represents a network in HNS
 type HNSNetwork struct {
 type HNSNetwork struct {
-	Id       string            `json:",omitempty"`
-	Name     string            `json:",omitempty"`
-	Type     string            `json:",omitempty"`
-	Policies []json.RawMessage `json:",omitempty"`
-	MacPools []MacPool         `json:",omitempty"`
-	Subnets  []Subnet          `json:",omitempty"`
+	Id                 string            `json:",omitempty"`
+	Name               string            `json:",omitempty"`
+	Type               string            `json:",omitempty"`
+	NetworkAdapterName string            `json:",omitempty"`
+	SourceMac          string            `json:",omitempty"`
+	Policies           []json.RawMessage `json:",omitempty"`
+	MacPools           []MacPool         `json:",omitempty"`
+	Subnets            []Subnet          `json:",omitempty"`
+	DNSSuffix          string            `json:",omitempty"`
+	DNSServerList      string            `json:",omitempty"`
 }
 }
 
 
 // HNSEndpoint represents a network endpoint in HNS
 // HNSEndpoint represents a network endpoint in HNS
@@ -53,6 +57,10 @@ type HNSEndpoint struct {
 	Policies           []json.RawMessage `json:",omitempty"`
 	Policies           []json.RawMessage `json:",omitempty"`
 	MacAddress         string            `json:",omitempty"`
 	MacAddress         string            `json:",omitempty"`
 	IPAddress          net.IP            `json:",omitempty"`
 	IPAddress          net.IP            `json:",omitempty"`
+	DNSSuffix          string            `json:",omitempty"`
+	DNSServerList      string            `json:",omitempty"`
+	GatewayAddress     string            `json:",omitempty"`
+	PrefixLength       uint8             `json:",omitempty"`
 }
 }
 
 
 type hnsNetworkResponse struct {
 type hnsNetworkResponse struct {

+ 2 - 6
vendor/src/github.com/Microsoft/hcsshim/legacy.go

@@ -319,11 +319,7 @@ func (w *LegacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) erro
 		if err != nil {
 		if err != nil {
 			return err
 			return err
 		}
 		}
-		if strings.HasPrefix(name, `Files\`) {
-			path += ".$wcidirs$"
-		} else {
-			createDisposition = syscall.OPEN_EXISTING
-		}
+		path += ".$wcidirs$"
 	}
 	}
 
 
 	f, err := openFileOrDir(path, syscall.GENERIC_READ|syscall.GENERIC_WRITE, createDisposition)
 	f, err := openFileOrDir(path, syscall.GENERIC_READ|syscall.GENERIC_WRITE, createDisposition)
@@ -344,7 +340,7 @@ func (w *LegacyLayerWriter) Add(name string, fileInfo *winio.FileBasicInfo) erro
 		return err
 		return err
 	}
 	}
 
 
-	if !strings.HasPrefix(name, `Files\`) {
+	if strings.HasPrefix(name, `Hives\`) {
 		w.backupWriter = winio.NewBackupFileWriter(f, false)
 		w.backupWriter = winio.NewBackupFileWriter(f, false)
 	} else {
 	} else {
 		if !w.isTP4Format {
 		if !w.isTP4Format {

+ 23 - 0
vendor/src/github.com/Microsoft/hcsshim/processimage.go

@@ -0,0 +1,23 @@
+package hcsshim
+
+import "os"
+
+// ProcessBaseLayer post-processes a base layer that has had its files extracted.
+// The files should have been extracted to <path>\Files.
+func ProcessBaseLayer(path string) error {
+	err := processBaseImage(path)
+	if err != nil {
+		return &os.PathError{Op: "ProcessBaseLayer", Path: path, Err: err}
+	}
+	return nil
+}
+
+// ProcessUtilityVMImage post-processes a utility VM image that has had its files extracted.
+// The files should have been extracted to <path>\Files.
+func ProcessUtilityVMImage(path string) error {
+	err := processUtilityImage(path)
+	if err != nil {
+		return &os.PathError{Op: "ProcessUtilityVMImage", Path: path, Err: err}
+	}
+	return nil
+}

+ 42 - 0
vendor/src/github.com/Microsoft/hcsshim/zhcsshim.go

@@ -30,6 +30,8 @@ var (
 	procNameToGuid                                 = modvmcompute.NewProc("NameToGuid")
 	procNameToGuid                                 = modvmcompute.NewProc("NameToGuid")
 	procPrepareLayer                               = modvmcompute.NewProc("PrepareLayer")
 	procPrepareLayer                               = modvmcompute.NewProc("PrepareLayer")
 	procUnprepareLayer                             = modvmcompute.NewProc("UnprepareLayer")
 	procUnprepareLayer                             = modvmcompute.NewProc("UnprepareLayer")
+	procProcessBaseImage                           = modvmcompute.NewProc("ProcessBaseImage")
+	procProcessUtilityImage                        = modvmcompute.NewProc("ProcessUtilityImage")
 	procImportLayerBegin                           = modvmcompute.NewProc("ImportLayerBegin")
 	procImportLayerBegin                           = modvmcompute.NewProc("ImportLayerBegin")
 	procImportLayerNext                            = modvmcompute.NewProc("ImportLayerNext")
 	procImportLayerNext                            = modvmcompute.NewProc("ImportLayerNext")
 	procImportLayerWrite                           = modvmcompute.NewProc("ImportLayerWrite")
 	procImportLayerWrite                           = modvmcompute.NewProc("ImportLayerWrite")
@@ -370,6 +372,46 @@ func _unprepareLayer(info *driverInfo, id *uint16) (hr error) {
 	return
 	return
 }
 }
 
 
+func processBaseImage(path string) (hr error) {
+	var _p0 *uint16
+	_p0, hr = syscall.UTF16PtrFromString(path)
+	if hr != nil {
+		return
+	}
+	return _processBaseImage(_p0)
+}
+
+func _processBaseImage(path *uint16) (hr error) {
+	if hr = procProcessBaseImage.Find(); hr != nil {
+		return
+	}
+	r0, _, _ := syscall.Syscall(procProcessBaseImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
+	if int32(r0) < 0 {
+		hr = syscall.Errno(win32FromHresult(r0))
+	}
+	return
+}
+
+func processUtilityImage(path string) (hr error) {
+	var _p0 *uint16
+	_p0, hr = syscall.UTF16PtrFromString(path)
+	if hr != nil {
+		return
+	}
+	return _processUtilityImage(_p0)
+}
+
+func _processUtilityImage(path *uint16) (hr error) {
+	if hr = procProcessUtilityImage.Find(); hr != nil {
+		return
+	}
+	r0, _, _ := syscall.Syscall(procProcessUtilityImage.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0)
+	if int32(r0) < 0 {
+		hr = syscall.Errno(win32FromHresult(r0))
+	}
+	return
+}
+
 func importLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) {
 func importLayerBegin(info *driverInfo, id string, descriptors []WC_LAYER_DESCRIPTOR, context *uintptr) (hr error) {
 	var _p0 *uint16
 	var _p0 *uint16
 	_p0, hr = syscall.UTF16PtrFromString(id)
 	_p0, hr = syscall.UTF16PtrFromString(id)