Browse Source

Merge pull request #1 from docker/master

up to date
smark 6 years ago
parent
commit
3ba3118873
100 changed files with 2403 additions and 448 deletions
  1. 1 2
      libnetwork/Dockerfile
  2. 10 23
      libnetwork/MAINTAINERS
  3. 2 6
      libnetwork/Makefile
  4. 1 1
      libnetwork/cmd/dnet/dnet.go
  5. 10 10
      libnetwork/controller.go
  6. 12 12
      libnetwork/drivers/overlay/ov_network.go
  7. 3 1
      libnetwork/drivers/overlay/overlay_test.go
  8. 32 2
      libnetwork/firewall_linux.go
  9. 5 6
      libnetwork/ipvs/ipvs.go
  10. 7 7
      libnetwork/ipvs/ipvs_test.go
  11. 8 0
      libnetwork/libnetwork_test.go
  12. 7 2
      libnetwork/network.go
  13. 38 4
      libnetwork/resolvconf/resolvconf.go
  14. 1 1
      libnetwork/resolver.go
  15. 21 17
      libnetwork/resolver_test.go
  16. 2 2
      libnetwork/sandbox_dns_unix.go
  17. 15 11
      libnetwork/support/support.sh
  18. 51 47
      libnetwork/vendor.conf
  19. 3 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/hnsendpoint.go
  20. 5 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/interface.go
  21. 100 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/guestrequest/types.go
  22. 36 13
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/callback.go
  23. 10 2
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go
  24. 1 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/hcs.go
  25. 20 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/log.go
  26. 162 67
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
  27. 285 153
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
  28. 5 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/waithelper.go
  29. 21 10
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/watcher.go
  30. 123 31
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/zsyscall_windows.go
  31. 0 4
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcserror/hcserror.go
  32. 2 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go
  33. 8 2
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go
  34. 1 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicylist.go
  35. 5 3
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/zsyscall_windows.go
  36. 2 2
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/interop/interop.go
  37. 3 3
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/interop/zsyscall_windows.go
  38. 32 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/logfields/fields.go
  39. 1 1
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/safefile/safeopen.go
  40. 20 3
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema1/schema1.go
  41. 31 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/attachment.go
  42. 13 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/battery.go
  43. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/cache_query_stats_response.go
  44. 27 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/chipset.go
  45. 15 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/close_handle.go
  46. 18 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/com_port.go
  47. 27 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/compute_system.go
  48. 72 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/configuration.go
  49. 17 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/console_size.go
  50. 35 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/container.go
  51. 25 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/container_credential_guard_state.go
  52. 26 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/container_memory_information.go
  53. 16 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/device.go
  54. 43 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/devices.go
  55. 15 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/enhanced_mode_video.go
  56. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/flexible_io_device.go
  57. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_connection.go
  58. 21 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_connection_info.go
  59. 15 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_crash_reporting.go
  60. 15 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_os.go
  61. 22 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_state.go
  62. 17 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hosted_system.go
  63. 17 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket.go
  64. 16 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket_2.go
  65. 22 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket_service_config.go
  66. 22 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket_system_config.go
  67. 13 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/keyboard.go
  68. 22 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/layer.go
  69. 18 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/linux_kernel_direct.go
  70. 21 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/mapped_directory.go
  71. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/mapped_pipe.go
  72. 15 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory.go
  73. 25 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_2.go
  74. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_information_for_vm.go
  75. 20 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_stats.go
  76. 20 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/modify_setting_request.go
  77. 13 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/mouse.go
  78. 17 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/network_adapter.go
  79. 24 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/networking.go
  80. 16 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/pause_notification.go
  81. 18 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/pause_options.go
  82. 15 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/plan9.go
  83. 34 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/plan9_share.go
  84. 34 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_details.go
  85. 20 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_modify_request.go
  86. 47 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_parameters.go
  87. 22 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_status.go
  88. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/processor.go
  89. 21 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/processor_2.go
  90. 20 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/processor_stats.go
  91. 47 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/properties.go
  92. 16 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/property_query.go
  93. 17 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/rdp_connection_options.go
  94. 17 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/registry_changes.go
  95. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/registry_key.go
  96. 31 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/registry_value.go
  97. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/restore_state.go
  98. 19 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/save_options.go
  99. 16 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/scsi.go
  100. 15 0
      libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/shared_memory_configuration.go

+ 1 - 2
libnetwork/Dockerfile

@@ -11,8 +11,7 @@ RUN go get golang.org/x/lint/golint \
 		golang.org/x/tools/cmd/cover \
 		golang.org/x/tools/cmd/cover \
 		github.com/mattn/goveralls \
 		github.com/mattn/goveralls \
 		github.com/gordonklaus/ineffassign \
 		github.com/gordonklaus/ineffassign \
-		github.com/client9/misspell/cmd/misspell \
-		honnef.co/go/tools/cmd/gosimple
+		github.com/client9/misspell/cmd/misspell
 
 
 WORKDIR /go/src/github.com/docker/libnetwork
 WORKDIR /go/src/github.com/docker/libnetwork
 
 

+ 10 - 23
libnetwork/MAINTAINERS

@@ -11,12 +11,10 @@
 [Org]
 [Org]
 	[Org."Core maintainers"]
 	[Org."Core maintainers"]
 		people = [
 		people = [
-			"abhi",
-			"aboch",
-			"ctelfer",
-			"chenchun",
+			"euanh",
 			"fcrisciani",
 			"fcrisciani",
 			"mavenugo",
 			"mavenugo",
+			"selansen",
 		]
 		]
 
 
 [people]
 [people]
@@ -27,25 +25,10 @@
 
 
 	# ADD YOURSELF HERE IN ALPHABETICAL ORDER
 	# ADD YOURSELF HERE IN ALPHABETICAL ORDER
 
 
-	[people.abhi]
-	Name = "Abhinandan Prativadi Bayankaram"
-	Email = "abhi@docker.com"
-	GitHub = "abhi"
-
-	[people.aboch]
-	Name = "Alessandro Boch"
-	Email = "aboch@docker.com"
-	GitHub = "aboch"
-
-	[people.ctelfer]
-	Name = "Christopher Telfer"
-	Email = "chris.telfer@docker.com"
-	GitHub = "ctelfer"
-
-	[people.chenchun]
-	Name = "Chun Chen"
-	Email = "ramichen@tencent.com"
-	GitHub = "chenchun"
+	[people.euanh]
+	Name = "Euan Harris"
+	Email = "euan.harris@docker.com"
+	GitHub = "euanh"
 
 
 	[people.fcrisciani]
 	[people.fcrisciani]
 	Name = "Flavio Crisciani"
 	Name = "Flavio Crisciani"
@@ -57,3 +40,7 @@
 	Email = "madhu@docker.com"
 	Email = "madhu@docker.com"
 	GitHub = "mavenugo"
 	GitHub = "mavenugo"
 
 
+	[people.selansen]
+	Name = "Elangovan Sivanandam"
+	Email = "elango.siva@docker.com"
+	GitHub = "selansen"

+ 2 - 6
libnetwork/Makefile

@@ -1,4 +1,4 @@
-.PHONY: all all-local build build-local clean cross cross-local gosimple vet lint misspell check check-local check-code check-format unit-tests protobuf protobuf-local check-protobuf
+.PHONY: all all-local build build-local clean cross cross-local vet lint misspell check check-local check-code check-format unit-tests protobuf protobuf-local check-protobuf
 SHELL=/bin/bash
 SHELL=/bin/bash
 
 
 dockerbuildargs ?= --target dev - < Dockerfile
 dockerbuildargs ?= --target dev - < Dockerfile
@@ -115,7 +115,7 @@ check: builder
 
 
 check-local: check-code check-format
 check-local: check-code check-format
 
 
-check-code: check-protobuf lint gosimple vet ineffassign
+check-code: check-protobuf lint vet ineffassign
 
 
 check-format: fmt misspell
 check-format: fmt misspell
 
 
@@ -164,10 +164,6 @@ ineffassign: ## run ineffassign
 	@echo "🐳 $@"
 	@echo "🐳 $@"
 	@test -z "$$(ineffassign . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)"
 	@test -z "$$(ineffassign . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)"
 
 
-gosimple: ## run gosimple
-	@echo "🐳 $@"
-	@test -z "$$(gosimple . | grep -v vendor/ | grep -v ".pb.go:" | grep -v ".mock.go" | tee /dev/stderr)"
-
 # check-protobuf rebuilds .pb.go files and fails if they have changed
 # check-protobuf rebuilds .pb.go files and fails if they have changed
 check-protobuf: PROTOC_CHECK=1
 check-protobuf: PROTOC_CHECK=1
 check-protobuf: $(PB_FILES)
 check-protobuf: $(PB_FILES)

+ 1 - 1
libnetwork/cmd/dnet/dnet.go

@@ -416,7 +416,7 @@ func startTestDriver() error {
 }
 }
 
 
 func newDnetConnection(val string) (*dnetConnection, error) {
 func newDnetConnection(val string) (*dnetConnection, error) {
-	url, err := opts.ParseHost(false, val)
+	url, err := opts.ParseHost(false, false, val)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}

+ 10 - 10
libnetwork/controller.go

@@ -339,7 +339,6 @@ func (c *controller) clusterAgentInit() {
 				}
 				}
 			}
 			}
 		case cluster.EventNodeLeave:
 		case cluster.EventNodeLeave:
-			keysAvailable = false
 			c.agentOperationStart()
 			c.agentOperationStart()
 			c.Lock()
 			c.Lock()
 			c.keys = nil
 			c.keys = nil
@@ -706,11 +705,17 @@ const overlayDSROptionString = "dsr"
 // NewNetwork creates a new network of the specified network type. The options
 // NewNetwork creates a new network of the specified network type. The options
 // are network specific and modeled in a generic way.
 // are network specific and modeled in a generic way.
 func (c *controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (Network, error) {
 func (c *controller) NewNetwork(networkType, name string, id string, options ...NetworkOption) (Network, error) {
+	var (
+		cap *driverapi.Capability
+		err error
+		t   *network
+	)
+
 	if id != "" {
 	if id != "" {
 		c.networkLocker.Lock(id)
 		c.networkLocker.Lock(id)
 		defer c.networkLocker.Unlock(id)
 		defer c.networkLocker.Unlock(id)
 
 
-		if _, err := c.NetworkByID(id); err == nil {
+		if _, err = c.NetworkByID(id); err == nil {
 			return nil, NetworkNameError(id)
 			return nil, NetworkNameError(id)
 		}
 		}
 	}
 	}
@@ -739,15 +744,10 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ...
 	}
 	}
 
 
 	network.processOptions(options...)
 	network.processOptions(options...)
-	if err := network.validateConfiguration(); err != nil {
+	if err = network.validateConfiguration(); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	var (
-		cap *driverapi.Capability
-		err error
-	)
-
 	// Reset network types, force local scope and skip allocation and
 	// Reset network types, force local scope and skip allocation and
 	// plumbing for configuration networks. Reset of the config-only
 	// plumbing for configuration networks. Reset of the config-only
 	// network drivers is needed so that this special network is not
 	// network drivers is needed so that this special network is not
@@ -794,11 +794,11 @@ func (c *controller) NewNetwork(networkType, name string, id string, options ...
 	// From this point on, we need the network specific configuration,
 	// From this point on, we need the network specific configuration,
 	// which may come from a configuration-only network
 	// which may come from a configuration-only network
 	if network.configFrom != "" {
 	if network.configFrom != "" {
-		t, err := c.getConfigNetwork(network.configFrom)
+		t, err = c.getConfigNetwork(network.configFrom)
 		if err != nil {
 		if err != nil {
 			return nil, types.NotFoundErrorf("configuration network %q does not exist", network.configFrom)
 			return nil, types.NotFoundErrorf("configuration network %q does not exist", network.configFrom)
 		}
 		}
-		if err := t.applyConfigurationTo(network); err != nil {
+		if err = t.applyConfigurationTo(network); err != nil {
 			return nil, types.InternalErrorf("Failed to apply configuration: %v", err)
 			return nil, types.InternalErrorf("Failed to apply configuration: %v", err)
 		}
 		}
 		defer func() {
 		defer func() {

+ 12 - 12
libnetwork/drivers/overlay/ov_network.go

@@ -12,7 +12,6 @@ import (
 	"strconv"
 	"strconv"
 	"strings"
 	"strings"
 	"sync"
 	"sync"
-	"syscall"
 
 
 	"github.com/docker/docker/pkg/reexec"
 	"github.com/docker/docker/pkg/reexec"
 	"github.com/docker/libnetwork/datastore"
 	"github.com/docker/libnetwork/datastore"
@@ -27,6 +26,7 @@ import (
 	"github.com/vishvananda/netlink"
 	"github.com/vishvananda/netlink"
 	"github.com/vishvananda/netlink/nl"
 	"github.com/vishvananda/netlink/nl"
 	"github.com/vishvananda/netns"
 	"github.com/vishvananda/netns"
+	"golang.org/x/sys/unix"
 )
 )
 
 
 var (
 var (
@@ -97,18 +97,18 @@ func setDefaultVlan() {
 	}
 	}
 
 
 	// make sure the sysfs mount doesn't propagate back
 	// make sure the sysfs mount doesn't propagate back
-	if err = syscall.Unshare(syscall.CLONE_NEWNS); err != nil {
+	if err = unix.Unshare(unix.CLONE_NEWNS); err != nil {
 		logrus.Errorf("unshare failed, %v", err)
 		logrus.Errorf("unshare failed, %v", err)
 		os.Exit(1)
 		os.Exit(1)
 	}
 	}
 
 
-	flag := syscall.MS_PRIVATE | syscall.MS_REC
-	if err = syscall.Mount("", "/", "", uintptr(flag), ""); err != nil {
+	flag := unix.MS_PRIVATE | unix.MS_REC
+	if err = unix.Mount("", "/", "", uintptr(flag), ""); err != nil {
 		logrus.Errorf("root mount failed, %v", err)
 		logrus.Errorf("root mount failed, %v", err)
 		os.Exit(1)
 		os.Exit(1)
 	}
 	}
 
 
-	if err = syscall.Mount("sysfs", "/sys", "sysfs", 0, ""); err != nil {
+	if err = unix.Mount("sysfs", "/sys", "sysfs", 0, ""); err != nil {
 		logrus.Errorf("mounting sysfs failed, %v", err)
 		logrus.Errorf("mounting sysfs failed, %v", err)
 		os.Exit(1)
 		os.Exit(1)
 	}
 	}
@@ -427,7 +427,7 @@ func populateVNITbl() {
 			}
 			}
 			defer ns.Close()
 			defer ns.Close()
 
 
-			nlh, err := netlink.NewHandleAt(ns, syscall.NETLINK_ROUTE)
+			nlh, err := netlink.NewHandleAt(ns, unix.NETLINK_ROUTE)
 			if err != nil {
 			if err != nil {
 				logrus.Errorf("Could not open netlink handle during vni population for ns %s: %v", path, err)
 				logrus.Errorf("Could not open netlink handle during vni population for ns %s: %v", path, err)
 				return nil
 				return nil
@@ -583,7 +583,7 @@ func (n *network) setupSubnetSandbox(s *subnet, brName, vxlanName string) error
 
 
 		if ok {
 		if ok {
 			deleteVxlanByVNI(path, s.vni)
 			deleteVxlanByVNI(path, s.vni)
-			if err := syscall.Unmount(path, syscall.MNT_FORCE); err != nil {
+			if err := unix.Unmount(path, unix.MNT_FORCE); err != nil {
 				logrus.Errorf("unmount of %s failed: %v", path, err)
 				logrus.Errorf("unmount of %s failed: %v", path, err)
 			}
 			}
 			os.Remove(path)
 			os.Remove(path)
@@ -693,7 +693,7 @@ func (n *network) cleanupStaleSandboxes() {
 			if strings.Contains(n.id, pattern) {
 			if strings.Contains(n.id, pattern) {
 				// Delete all vnis
 				// Delete all vnis
 				deleteVxlanByVNI(path, 0)
 				deleteVxlanByVNI(path, 0)
-				syscall.Unmount(path, syscall.MNT_DETACH)
+				unix.Unmount(path, unix.MNT_DETACH)
 				os.Remove(path)
 				os.Remove(path)
 
 
 				// Now that we have destroyed this
 				// Now that we have destroyed this
@@ -755,12 +755,12 @@ func (n *network) initSandbox(restore bool) error {
 
 
 	var nlSock *nl.NetlinkSocket
 	var nlSock *nl.NetlinkSocket
 	sbox.InvokeFunc(func() {
 	sbox.InvokeFunc(func() {
-		nlSock, err = nl.Subscribe(syscall.NETLINK_ROUTE, syscall.RTNLGRP_NEIGH)
+		nlSock, err = nl.Subscribe(unix.NETLINK_ROUTE, unix.RTNLGRP_NEIGH)
 		if err != nil {
 		if err != nil {
 			return
 			return
 		}
 		}
 		// set the receive timeout to not remain stuck on the RecvFrom if the fd gets closed
 		// set the receive timeout to not remain stuck on the RecvFrom if the fd gets closed
-		tv := syscall.NsecToTimeval(soTimeout.Nanoseconds())
+		tv := unix.NsecToTimeval(soTimeout.Nanoseconds())
 		err = nlSock.SetReceiveTimeout(&tv)
 		err = nlSock.SetReceiveTimeout(&tv)
 	})
 	})
 	n.nlSocket = nlSock
 	n.nlSocket = nlSock
@@ -803,7 +803,7 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket, nsPath string) {
 				return
 				return
 			}
 			}
 			// When the receive timeout expires the receive will return EAGAIN
 			// When the receive timeout expires the receive will return EAGAIN
-			if err == syscall.EAGAIN {
+			if err == unix.EAGAIN {
 				// we continue here to avoid spam for timeouts
 				// we continue here to avoid spam for timeouts
 				continue
 				continue
 			}
 			}
@@ -812,7 +812,7 @@ func (n *network) watchMiss(nlSock *nl.NetlinkSocket, nsPath string) {
 		}
 		}
 
 
 		for _, msg := range msgs {
 		for _, msg := range msgs {
-			if msg.Header.Type != syscall.RTM_GETNEIGH && msg.Header.Type != syscall.RTM_NEWNEIGH {
+			if msg.Header.Type != unix.RTM_GETNEIGH && msg.Header.Type != unix.RTM_NEWNEIGH {
 				continue
 				continue
 			}
 			}
 
 

+ 3 - 1
libnetwork/drivers/overlay/overlay_test.go

@@ -9,6 +9,8 @@ import (
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
+	"golang.org/x/sys/unix"
+
 	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/docker/pkg/plugingetter"
 	"github.com/docker/libkv/store/consul"
 	"github.com/docker/libkv/store/consul"
 	"github.com/docker/libnetwork/datastore"
 	"github.com/docker/libnetwork/datastore"
@@ -150,7 +152,7 @@ func TestNetlinkSocket(t *testing.T) {
 		t.Fatal()
 		t.Fatal()
 	}
 	}
 	// set the receive timeout to not remain stuck on the RecvFrom if the fd gets closed
 	// set the receive timeout to not remain stuck on the RecvFrom if the fd gets closed
-	tv := syscall.NsecToTimeval(soTimeout.Nanoseconds())
+	tv := unix.NsecToTimeval(soTimeout.Nanoseconds())
 	err = nlSock.SetReceiveTimeout(&tv)
 	err = nlSock.SetReceiveTimeout(&tv)
 	if err != nil {
 	if err != nil {
 		t.Fatal()
 		t.Fatal()

+ 32 - 2
libnetwork/firewall_linux.go

@@ -2,6 +2,7 @@ package libnetwork
 
 
 import (
 import (
 	"github.com/docker/libnetwork/iptables"
 	"github.com/docker/libnetwork/iptables"
+	"github.com/docker/libnetwork/netlabel"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
 )
 )
 
 
@@ -9,15 +10,44 @@ const userChain = "DOCKER-USER"
 
 
 func (c *controller) arrangeUserFilterRule() {
 func (c *controller) arrangeUserFilterRule() {
 	c.Lock()
 	c.Lock()
-	arrangeUserFilterRule()
+
+	if c.hasIPTablesEnabled() {
+		arrangeUserFilterRule()
+	}
+
 	c.Unlock()
 	c.Unlock()
+
 	iptables.OnReloaded(func() {
 	iptables.OnReloaded(func() {
 		c.Lock()
 		c.Lock()
-		arrangeUserFilterRule()
+
+		if c.hasIPTablesEnabled() {
+			arrangeUserFilterRule()
+		}
+
 		c.Unlock()
 		c.Unlock()
 	})
 	})
 }
 }
 
 
+func (c *controller) hasIPTablesEnabled() bool {
+	// Locking c should be handled in the calling method.
+	if c.cfg == nil || c.cfg.Daemon.DriverCfg[netlabel.GenericData] == nil {
+		return false
+	}
+
+	genericData, ok := c.cfg.Daemon.DriverCfg[netlabel.GenericData]
+	if !ok {
+		return false
+	}
+
+	optMap := genericData.(map[string]interface{})
+	enabled, ok := optMap["EnableIPTables"].(bool)
+	if !ok {
+		return false
+	}
+
+	return enabled
+}
+
 // This chain allow users to configure firewall policies in a way that persists
 // This chain allow users to configure firewall policies in a way that persists
 // docker operations/restarts. Docker will not delete or modify any pre-existing
 // docker operations/restarts. Docker will not delete or modify any pre-existing
 // rules from the DOCKER-USER filter chain.
 // rules from the DOCKER-USER filter chain.

+ 5 - 6
libnetwork/ipvs/ipvs.go

@@ -3,14 +3,13 @@
 package ipvs
 package ipvs
 
 
 import (
 import (
+	"fmt"
 	"net"
 	"net"
-	"syscall"
 	"time"
 	"time"
 
 
-	"fmt"
-
 	"github.com/vishvananda/netlink/nl"
 	"github.com/vishvananda/netlink/nl"
 	"github.com/vishvananda/netns"
 	"github.com/vishvananda/netns"
+	"golang.org/x/sys/unix"
 )
 )
 
 
 const (
 const (
@@ -98,16 +97,16 @@ func New(path string) (*Handle, error) {
 	}
 	}
 	defer n.Close()
 	defer n.Close()
 
 
-	sock, err := nl.GetNetlinkSocketAt(n, netns.None(), syscall.NETLINK_GENERIC)
+	sock, err := nl.GetNetlinkSocketAt(n, netns.None(), unix.NETLINK_GENERIC)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 	// Add operation timeout to avoid deadlocks
 	// Add operation timeout to avoid deadlocks
-	tv := syscall.NsecToTimeval(netlinkSendSocketTimeout.Nanoseconds())
+	tv := unix.NsecToTimeval(netlinkSendSocketTimeout.Nanoseconds())
 	if err := sock.SetSendTimeout(&tv); err != nil {
 	if err := sock.SetSendTimeout(&tv); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	tv = syscall.NsecToTimeval(netlinkRecvSocketsTimeout.Nanoseconds())
+	tv = unix.NsecToTimeval(netlinkRecvSocketsTimeout.Nanoseconds())
 	if err := sock.SetReceiveTimeout(&tv); err != nil {
 	if err := sock.SetReceiveTimeout(&tv); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}

+ 7 - 7
libnetwork/ipvs/ipvs_test.go

@@ -4,13 +4,13 @@ package ipvs
 
 
 import (
 import (
 	"net"
 	"net"
-	"syscall"
 	"testing"
 	"testing"
 	"time"
 	"time"
 
 
 	"github.com/docker/libnetwork/testutils"
 	"github.com/docker/libnetwork/testutils"
 	"github.com/vishvananda/netlink"
 	"github.com/vishvananda/netlink"
 	"github.com/vishvananda/netlink/nl"
 	"github.com/vishvananda/netlink/nl"
+	"golang.org/x/sys/unix"
 	"gotest.tools/assert"
 	"gotest.tools/assert"
 	is "gotest.tools/assert/cmp"
 	is "gotest.tools/assert/cmp"
 )
 )
@@ -143,12 +143,12 @@ func TestService(t *testing.T) {
 			case "FWM":
 			case "FWM":
 				s.FWMark = 1234
 				s.FWMark = 1234
 			case "TCP":
 			case "TCP":
-				s.Protocol = syscall.IPPROTO_TCP
+				s.Protocol = unix.IPPROTO_TCP
 				s.Port = 80
 				s.Port = 80
 				s.Address = net.ParseIP("1.2.3.4")
 				s.Address = net.ParseIP("1.2.3.4")
 				s.Netmask = 0xFFFFFFFF
 				s.Netmask = 0xFFFFFFFF
 			case "UDP":
 			case "UDP":
-				s.Protocol = syscall.IPPROTO_UDP
+				s.Protocol = unix.IPPROTO_UDP
 				s.Port = 53
 				s.Port = 53
 				s.Address = net.ParseIP("2.3.4.5")
 				s.Address = net.ParseIP("2.3.4.5")
 			}
 			}
@@ -183,7 +183,7 @@ func TestService(t *testing.T) {
 		{
 		{
 			AddressFamily: nl.FAMILY_V4,
 			AddressFamily: nl.FAMILY_V4,
 			SchedName:     RoundRobin,
 			SchedName:     RoundRobin,
-			Protocol:      syscall.IPPROTO_TCP,
+			Protocol:      unix.IPPROTO_TCP,
 			Port:          80,
 			Port:          80,
 			Address:       net.ParseIP("10.20.30.40"),
 			Address:       net.ParseIP("10.20.30.40"),
 			Netmask:       0xFFFFFFFF,
 			Netmask:       0xFFFFFFFF,
@@ -191,7 +191,7 @@ func TestService(t *testing.T) {
 		{
 		{
 			AddressFamily: nl.FAMILY_V4,
 			AddressFamily: nl.FAMILY_V4,
 			SchedName:     LeastConnection,
 			SchedName:     LeastConnection,
-			Protocol:      syscall.IPPROTO_UDP,
+			Protocol:      unix.IPPROTO_UDP,
 			Port:          8080,
 			Port:          8080,
 			Address:       net.ParseIP("10.20.30.41"),
 			Address:       net.ParseIP("10.20.30.41"),
 			Netmask:       0xFFFFFFFF,
 			Netmask:       0xFFFFFFFF,
@@ -261,12 +261,12 @@ func TestDestination(t *testing.T) {
 		case "FWM":
 		case "FWM":
 			s.FWMark = 1234
 			s.FWMark = 1234
 		case "TCP":
 		case "TCP":
-			s.Protocol = syscall.IPPROTO_TCP
+			s.Protocol = unix.IPPROTO_TCP
 			s.Port = 80
 			s.Port = 80
 			s.Address = net.ParseIP("1.2.3.4")
 			s.Address = net.ParseIP("1.2.3.4")
 			s.Netmask = 0xFFFFFFFF
 			s.Netmask = 0xFFFFFFFF
 		case "UDP":
 		case "UDP":
-			s.Protocol = syscall.IPPROTO_UDP
+			s.Protocol = unix.IPPROTO_UDP
 			s.Port = 53
 			s.Port = 53
 			s.Address = net.ParseIP("2.3.4.5")
 			s.Address = net.ParseIP("2.3.4.5")
 		}
 		}

+ 8 - 0
libnetwork/libnetwork_test.go

@@ -1375,10 +1375,18 @@ func TestValidRemoteDriver(t *testing.T) {
 		w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
 		w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
 		fmt.Fprintf(w, `{"Implements": ["%s"]}`, driverapi.NetworkPluginEndpointType)
 		fmt.Fprintf(w, `{"Implements": ["%s"]}`, driverapi.NetworkPluginEndpointType)
 	})
 	})
+	mux.HandleFunc(fmt.Sprintf("/%s.GetCapabilities", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) {
+		w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
+		fmt.Fprintf(w, `{"Scope":"local"}`)
+	})
 	mux.HandleFunc(fmt.Sprintf("/%s.CreateNetwork", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) {
 	mux.HandleFunc(fmt.Sprintf("/%s.CreateNetwork", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) {
 		w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
 		w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
 		fmt.Fprintf(w, "null")
 		fmt.Fprintf(w, "null")
 	})
 	})
+	mux.HandleFunc(fmt.Sprintf("/%s.DeleteNetwork", driverapi.NetworkPluginEndpointType), func(w http.ResponseWriter, r *http.Request) {
+		w.Header().Set("Content-Type", "application/vnd.docker.plugins.v1+json")
+		fmt.Fprintf(w, "null")
+	})
 
 
 	if err := os.MkdirAll("/etc/docker/plugins", 0755); err != nil {
 	if err := os.MkdirAll("/etc/docker/plugins", 0755); err != nil {
 		t.Fatal(err)
 		t.Fatal(err)

+ 7 - 2
libnetwork/network.go

@@ -1381,14 +1381,18 @@ func delIPToName(ipMap setmatrix.SetMatrix, name, serviceID string, ip net.IP) {
 }
 }
 
 
 func addNameToIP(svcMap setmatrix.SetMatrix, name, serviceID string, epIP net.IP) {
 func addNameToIP(svcMap setmatrix.SetMatrix, name, serviceID string, epIP net.IP) {
-	svcMap.Insert(name, svcMapEntry{
+	// Since DNS name resolution is case-insensitive, Use the lower-case form
+	// of the name as the key into svcMap
+	lowerCaseName := strings.ToLower(name)
+	svcMap.Insert(lowerCaseName, svcMapEntry{
 		ip:        epIP.String(),
 		ip:        epIP.String(),
 		serviceID: serviceID,
 		serviceID: serviceID,
 	})
 	})
 }
 }
 
 
 func delNameToIP(svcMap setmatrix.SetMatrix, name, serviceID string, epIP net.IP) {
 func delNameToIP(svcMap setmatrix.SetMatrix, name, serviceID string, epIP net.IP) {
-	svcMap.Remove(name, svcMapEntry{
+	lowerCaseName := strings.ToLower(name)
+	svcMap.Remove(lowerCaseName, svcMapEntry{
 		ip:        epIP.String(),
 		ip:        epIP.String(),
 		serviceID: serviceID,
 		serviceID: serviceID,
 	})
 	})
@@ -1956,6 +1960,7 @@ func (n *network) ResolveName(req string, ipType int) ([]net.IP, bool) {
 	}
 	}
 
 
 	req = strings.TrimSuffix(req, ".")
 	req = strings.TrimSuffix(req, ".")
+	req = strings.ToLower(req)
 	ipSet, ok := sr.svcMap.Get(req)
 	ipSet, ok := sr.svcMap.Get(req)
 
 
 	if ipType == types.IPv6 {
 	if ipType == types.IPv6 {

+ 38 - 4
libnetwork/resolvconf/resolvconf.go

@@ -15,10 +15,44 @@ import (
 )
 )
 
 
 const (
 const (
-	// DefaultResolvConf points to the default file used for dns configuration on a linux machine
-	DefaultResolvConf = "/etc/resolv.conf"
+	// defaultPath is the default path to the resolv.conf that contains information to resolve DNS. See Path().
+	defaultPath = "/etc/resolv.conf"
+	// alternatePath is a path different from defaultPath, that may be used to resolve DNS. See Path().
+	alternatePath = "/run/systemd/resolve/resolv.conf"
 )
 )
 
 
+var (
+	detectSystemdResolvConfOnce sync.Once
+	pathAfterSystemdDetection   = defaultPath
+)
+
+// Path returns the path to the resolv.conf file that libnetwork should use.
+//
+// When /etc/resolv.conf contains 127.0.0.53 as the only nameserver, then
+// it is assumed systemd-resolved manages DNS. Because inside the container 127.0.0.53
+// is not a valid DNS server, Path() returns /run/systemd/resolve/resolv.conf
+// which is the resolv.conf that systemd-resolved generates and manages.
+// Otherwise Path() returns /etc/resolv.conf.
+//
+// Errors are silenced as they will inevitably resurface at future open/read calls.
+//
+// More information at https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html#/etc/resolv.conf
+func Path() string {
+	detectSystemdResolvConfOnce.Do(func() {
+		candidateResolvConf, err := ioutil.ReadFile(defaultPath)
+		if err != nil {
+			// silencing error as it will resurface at next calls trying to read defaultPath
+			return
+		}
+		ns := GetNameservers(candidateResolvConf, types.IP)
+		if len(ns) == 1 && ns[0] == "127.0.0.53" {
+			pathAfterSystemdDetection = alternatePath
+			logrus.Infof("detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: %s", alternatePath)
+		}
+	})
+	return pathAfterSystemdDetection
+}
+
 var (
 var (
 	// Note: the default IPv4 & IPv6 resolvers are set to Google's Public DNS
 	// Note: the default IPv4 & IPv6 resolvers are set to Google's Public DNS
 	defaultIPv4Dns = []string{"nameserver 8.8.8.8", "nameserver 8.8.4.4"}
 	defaultIPv4Dns = []string{"nameserver 8.8.8.8", "nameserver 8.8.4.4"}
@@ -55,7 +89,7 @@ type File struct {
 
 
 // Get returns the contents of /etc/resolv.conf and its hash
 // Get returns the contents of /etc/resolv.conf and its hash
 func Get() (*File, error) {
 func Get() (*File, error) {
-	return GetSpecific(DefaultResolvConf)
+	return GetSpecific(Path())
 }
 }
 
 
 // GetSpecific returns the contents of the user specified resolv.conf file and its hash
 // GetSpecific returns the contents of the user specified resolv.conf file and its hash
@@ -78,7 +112,7 @@ func GetIfChanged() (*File, error) {
 	lastModified.Lock()
 	lastModified.Lock()
 	defer lastModified.Unlock()
 	defer lastModified.Unlock()
 
 
-	resolv, err := ioutil.ReadFile("/etc/resolv.conf")
+	resolv, err := ioutil.ReadFile(Path())
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}

+ 1 - 1
libnetwork/resolver.go

@@ -366,8 +366,8 @@ func (r *resolver) ServeDNS(w dns.ResponseWriter, query *dns.Msg) {
 	if query == nil || len(query.Question) == 0 {
 	if query == nil || len(query.Question) == 0 {
 		return
 		return
 	}
 	}
-	name := query.Question[0].Name
 
 
+	name := query.Question[0].Name
 	switch query.Question[0].Qtype {
 	switch query.Question[0].Qtype {
 	case dns.TypeA:
 	case dns.TypeA:
 		resp, err = r.handleIPQuery(name, query, types.IPv4)
 		resp, err = r.handleIPQuery(name, query, types.IPv4)

+ 21 - 17
libnetwork/resolver_test.go

@@ -126,29 +126,33 @@ func TestDNSIPQuery(t *testing.T) {
 	r := NewResolver(resolverIPSandbox, false, sb.Key(), sb.(*sandbox))
 	r := NewResolver(resolverIPSandbox, false, sb.Key(), sb.(*sandbox))
 
 
 	// test name1's IP is resolved correctly with the default A type query
 	// test name1's IP is resolved correctly with the default A type query
-	q := new(dns.Msg)
-	q.SetQuestion("name1", dns.TypeA)
-	r.(*resolver).ServeDNS(w, q)
-	resp := w.GetResponse()
-	checkNonNullResponse(t, resp)
-	t.Log("Response: ", resp.String())
-	checkDNSResponseCode(t, resp, dns.RcodeSuccess)
-	checkDNSAnswersCount(t, resp, 1)
-	checkDNSRRType(t, resp.Answer[0].Header().Rrtype, dns.TypeA)
-	if answer, ok := resp.Answer[0].(*dns.A); ok {
-		if !bytes.Equal(answer.A, net.ParseIP("192.168.0.1")) {
-			t.Fatalf("IP response in Answer %v does not match 192.168.0.1", answer.A)
+	// Also make sure DNS lookups are case insensitive
+	names := []string{"name1", "NaMe1"}
+	for _, name := range names {
+		q := new(dns.Msg)
+		q.SetQuestion(name, dns.TypeA)
+		r.(*resolver).ServeDNS(w, q)
+		resp := w.GetResponse()
+		checkNonNullResponse(t, resp)
+		t.Log("Response: ", resp.String())
+		checkDNSResponseCode(t, resp, dns.RcodeSuccess)
+		checkDNSAnswersCount(t, resp, 1)
+		checkDNSRRType(t, resp.Answer[0].Header().Rrtype, dns.TypeA)
+		if answer, ok := resp.Answer[0].(*dns.A); ok {
+			if !bytes.Equal(answer.A, net.ParseIP("192.168.0.1")) {
+				t.Fatalf("IP response in Answer %v does not match 192.168.0.1", answer.A)
+			}
+		} else {
+			t.Fatal("Answer of type A not found")
 		}
 		}
-	} else {
-		t.Fatal("Answer of type A not found")
+		w.ClearResponse()
 	}
 	}
-	w.ClearResponse()
 
 
 	// test MX query with name1 results in Success response with 0 answer records
 	// test MX query with name1 results in Success response with 0 answer records
-	q = new(dns.Msg)
+	q := new(dns.Msg)
 	q.SetQuestion("name1", dns.TypeMX)
 	q.SetQuestion("name1", dns.TypeMX)
 	r.(*resolver).ServeDNS(w, q)
 	r.(*resolver).ServeDNS(w, q)
-	resp = w.GetResponse()
+	resp := w.GetResponse()
 	checkNonNullResponse(t, resp)
 	checkNonNullResponse(t, resp)
 	t.Log("Response: ", resp.String())
 	t.Log("Response: ", resp.String())
 	checkDNSResponseCode(t, resp, dns.RcodeSuccess)
 	checkDNSResponseCode(t, resp, dns.RcodeSuccess)

+ 2 - 2
libnetwork/sandbox_dns_unix.go

@@ -213,8 +213,8 @@ func (sb *sandbox) setupDNS() error {
 
 
 	originResolvConfPath := sb.config.originResolvConfPath
 	originResolvConfPath := sb.config.originResolvConfPath
 	if originResolvConfPath == "" {
 	if originResolvConfPath == "" {
-		// if not specified fallback to default /etc/resolv.conf
-		originResolvConfPath = resolvconf.DefaultResolvConf
+		// fallback if not specified
+		originResolvConfPath = resolvconf.Path()
 	}
 	}
 	currRC, err := resolvconf.GetSpecific(originResolvConfPath)
 	currRC, err := resolvconf.GetSpecific(originResolvConfPath)
 	if err != nil {
 	if err != nil {

+ 15 - 11
libnetwork/support/support.sh

@@ -76,23 +76,27 @@ echo "Overlay network configuration"
 for networkID in $(${DOCKER} network ls --no-trunc --filter driver=overlay -q) "ingress_sbox"; do
 for networkID in $(${DOCKER} network ls --no-trunc --filter driver=overlay -q) "ingress_sbox"; do
     echo "nnn Network ${networkID}"
     echo "nnn Network ${networkID}"
     if [ "${networkID}" != "ingress_sbox" ]; then
     if [ "${networkID}" != "ingress_sbox" ]; then
-        nspath=(${NSDIR}/*-${networkID:0:10})
+        nspath=($(ls ${NSDIR}/*${networkID:0:9}*))
         inspect_output=$(${DOCKER} network inspect ${NETINSPECT_VERBOSE_SUPPORT} ${networkID})
         inspect_output=$(${DOCKER} network inspect ${NETINSPECT_VERBOSE_SUPPORT} ${networkID})
         echo "$inspect_output"
         echo "$inspect_output"
         check_ip_overlap $inspect_output
         check_ip_overlap $inspect_output
     else
     else
         nspath=(${NSDIR}/${networkID})
         nspath=(${NSDIR}/${networkID})
     fi
     fi
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${IP} -o -4 address show
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${IP} -4 route show
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${IP} -4 neigh show
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${BRIDGE} fdb show
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${IPTABLES} -w1 -n -v -L -t filter | grep -v '^$'
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${IPTABLES} -w1 -n -v -L -t nat | grep -v '^$'
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${IPTABLES} -w1 -n -v -L -t mangle | grep -v '^$'
-    echo_and_run ${NSENTER} --net=${nspath[0]} ${IPVSADM} -l -n
-    printf "\n"
-    ((networks++))
+
+    for i in "${nspath[@]}"
+    do
+      echo_and_run ${NSENTER} --net=${i} ${IP} -o -4 address show
+      echo_and_run ${NSENTER} --net=${i} ${IP} -4 route show
+      echo_and_run ${NSENTER} --net=${i} ${IP} -4 neigh show
+      echo_and_run ${NSENTER} --net=${i} ${BRIDGE} fdb show
+      echo_and_run ${NSENTER} --net=${i} ${IPTABLES} -w1 -n -v -L -t filter | grep -v '^$'
+      echo_and_run ${NSENTER} --net=${i} ${IPTABLES} -w1 -n -v -L -t nat | grep -v '^$'
+      echo_and_run ${NSENTER} --net=${i} ${IPTABLES} -w1 -n -v -L -t mangle | grep -v '^$'
+      echo_and_run ${NSENTER} --net=${i} ${IPVSADM} -l -n
+      printf "\n"
+      ((networks++))
+    done
 done
 done
 
 
 echo "Container network configuration"
 echo "Container network configuration"

+ 51 - 47
libnetwork/vendor.conf

@@ -1,50 +1,54 @@
-github.com/Azure/go-ansiterm d6e3b3328b783f23731bc4d058875b0371ff8109
-github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
-github.com/Microsoft/go-winio v0.4.11
-github.com/Microsoft/hcsshim v0.7.3
-github.com/armon/go-metrics eb0af217e5e9747e41dd5303755356b62d28e3ec
-github.com/armon/go-radix e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
-github.com/codegangsta/cli a65b733b303f0055f8d324d805f393cd3e7a7904
-github.com/containerd/continuity d3c23511c1bf5851696cba83143d9cbcd666869b
-github.com/coreos/etcd v3.2.1
-github.com/coreos/go-semver v0.2.0
-github.com/deckarep/golang-set ef32fa3046d9f249d399f98ebaf9be944430fd1d
-go.etcd.io/bbolt v1.3.1-etcd.8
+github.com/Azure/go-ansiterm            d6e3b3328b783f23731bc4d058875b0371ff8109
+github.com/BurntSushi/toml              3012a1dbe2e4bd1391d42b32f0577cb7bbc7f005 # v0.3.1
+github.com/Microsoft/go-winio           c599b533b43b1363d7d7c6cfda5ede70ed73ff13
+github.com/Microsoft/hcsshim            ba3d6667710fa905116f39a19d059c4c1016be7c
+github.com/armon/go-metrics             eb0af217e5e9747e41dd5303755356b62d28e3ec
+github.com/armon/go-radix               e39d623f12e8e41c7b5529e9a9dd67a1e2261f80
+github.com/codegangsta/cli              a65b733b303f0055f8d324d805f393cd3e7a7904
+github.com/containerd/continuity        004b46473808b3e7a4a3049c20e4376c91eb966d
+github.com/coreos/etcd                  fca8add78a9d926166eb739b8e4a124434025ba3 # v3.3.9
+github.com/coreos/go-semver             8ab6407b697782a06568d4b7f1db25550ec2e4c6 # v0.2.0
+github.com/deckarep/golang-set          ef32fa3046d9f249d399f98ebaf9be944430fd1d
+go.etcd.io/bbolt                        7ee3ded59d4835e10f3e7d0f7603c42aa5e83820 # v1.3.1-etcd.8
 
 
-github.com/docker/docker 162ba6016def672690ee4a1f3978368853a1e149
-github.com/docker/go-connections 7beb39f0b969b075d1325fecb092faf27fd357b6
-github.com/docker/go-events 9461782956ad83b30282bf90e31fa6a70c255ba9
-github.com/docker/go-units 9e638d38cf6977a37a8ea0078f3ee75a7cdb2dd1
-github.com/docker/libkv 458977154600b9f23984d9f4b82e79570b5ae12b
+github.com/docker/docker                dbe4a30928d418e0570891a09703bcbc0e4997a1
+github.com/docker/distribution          0d3efadf0154c2b8a4e7b6621fff9809655cc580
+github.com/docker/go-connections        7395e3f8aa162843a74ed6d48e79627d9792ac55 # v0.4.0
+github.com/docker/go-events             9461782956ad83b30282bf90e31fa6a70c255ba9
+github.com/docker/go-units              47565b4f722fb6ceae66b95f853feed578a4a51c # v0.3.3
+github.com/docker/libkv                 458977154600b9f23984d9f4b82e79570b5ae12b
 
 
-github.com/godbus/dbus v4.0.0
-github.com/gogo/protobuf v1.0.0
-github.com/gorilla/context v1.1
-github.com/gorilla/mux v1.1
-github.com/hashicorp/consul v0.5.2
-github.com/hashicorp/go-msgpack 71c2886f5a673a35f909803f38ece5810165097b
-github.com/hashicorp/go-multierror fcdddc395df1ddf4247c69bd436e84cfa0733f7e
-github.com/hashicorp/memberlist 3d8438da9589e7b608a83ffac1ef8211486bcb7c
-github.com/sean-/seed e2103e2c35297fb7e17febb81e49b312087a2372
-github.com/hashicorp/go-sockaddr 6d291a969b86c4b633730bfc6b8b9d64c3aafed9
-github.com/hashicorp/serf 598c54895cc5a7b1a24a398d635e8c0ea0959870
-github.com/mattn/go-shellwords v1.0.3
-github.com/miekg/dns v1.0.7
-github.com/opencontainers/go-digest v1.0.0-rc1
-github.com/opencontainers/image-spec v1.0.1
-github.com/opencontainers/runc 96ec2177ae841256168fcf76954f7177af9446eb
-github.com/opencontainers/runtime-spec v1.0.1
-github.com/samuel/go-zookeeper d0e0d8e11f318e000a8cc434616d69e329edc374
-github.com/sirupsen/logrus v1.0.3
-github.com/ugorji/go f1f1a805ed361a0e078bb537e4ea78cd37dcf065
-github.com/vishvananda/netlink b2de5d10e38ecce8607e6b438b6d174f389a004e
-github.com/vishvananda/netns 604eaf189ee867d8c147fafc28def2394e878d25
-golang.org/x/crypto 1a580b3eff7814fc9b40602fd35256c63b50f491
-golang.org/x/net 0ed95abb35c445290478a5348a7b38bb154135fd
-golang.org/x/sys 37707fdb30a5b38865cfb95e5aab41707daec7fd
-golang.org/x/sync fd80eb99c8f653c847d294a001bdf2a3a6f768f5
-github.com/pkg/errors 839d9e913e063e28dfd0e6c7b7512793e0a48be9
-github.com/ishidawataru/sctp 07191f837fedd2f13d1ec7b5f885f0f3ec54b1cb
+github.com/gogo/protobuf                ba06b47c162d49f2af050fb4c75bcbc86a159d5c # v1.2.1
+github.com/golang/protobuf              aa810b61a9c79d51363740d207bb46cf8e620ed5 # v1.2.0
+google.golang.org/grpc                  7a6a684ca69eb4cae85ad0a484f2e531598c047b # v1.12.2
+google.golang.org/genproto              694d95ba50e67b2e363f3483057db5d4910c18f9
 
 
-gotest.tools v2.1.0
-github.com/google/go-cmp v0.2.0
+github.com/godbus/dbus                  5f6efc7ef2759c81b7ba876593971bfce311eab3 # v4.0.0
+github.com/gorilla/mux                  c5c6c98bc25355028a63748a498942a6398ccd22 # v1.7.1
+github.com/hashicorp/consul             9a9cc9341bb487651a0399e3fc5e1e8a42e62dd9 # v0.5.2
+github.com/hashicorp/go-msgpack         71c2886f5a673a35f909803f38ece5810165097b
+github.com/hashicorp/go-multierror      fcdddc395df1ddf4247c69bd436e84cfa0733f7e
+github.com/hashicorp/memberlist         3d8438da9589e7b608a83ffac1ef8211486bcb7c
+github.com/sean-/seed                   e2103e2c35297fb7e17febb81e49b312087a2372
+github.com/hashicorp/go-sockaddr        6d291a969b86c4b633730bfc6b8b9d64c3aafed9
+github.com/hashicorp/serf               598c54895cc5a7b1a24a398d635e8c0ea0959870
+github.com/mattn/go-shellwords          02e3cf038dcea8290e44424da473dd12be796a8a # v1.0.3
+github.com/miekg/dns                    e57bf427e68187a27e22adceac868350d7a7079b # v1.0.7
+github.com/opencontainers/go-digest     279bed98673dd5bef374d3b6e4b09e2af76183bf # v1.0.0-rc1
+github.com/opencontainers/image-spec    d60099175f88c47cd379c4738d158884749ed235 # v1.0.1
+github.com/opencontainers/runc          2b18fe1d885ee5083ef9f0838fee39b62d653e30
+github.com/opencontainers/runtime-spec  29686dbc5559d93fb1ef402eeda3e35c38d75af4 # v1.0.1-59-g29686db
+github.com/samuel/go-zookeeper          d0e0d8e11f318e000a8cc434616d69e329edc374
+github.com/sirupsen/logrus              f006c2ac4710855cf0f916dd6b77acf6b048dc6e # v1.0.3
+github.com/ugorji/go                    b4c50a2b199d93b13dc15e78929cfb23bfdf21ab # v1.1.1
+github.com/vishvananda/netlink          a2ad57a690f3caf3015351d2d6e1c0b95c349752 # v1.0.0
+github.com/vishvananda/netns            13995c7128ccc8e51e9a6bd2b551020a27180abd
+golang.org/x/crypto                     b7391e95e576cacdcdd422573063bc057239113d
+golang.org/x/net                        a680a1efc54dd51c040b3b5ce4939ea3cf2ea0d1
+golang.org/x/sys                        d455e41777fca6e8a5a79e34a14b8368bc11d9ba
+golang.org/x/sync                       1d60e4601c6fd243af51cc01ddf169918a5407ca
+github.com/pkg/errors                   ba968bfe8b2f7e042a574c888954fccecfa385b4 # v0.8.1
+github.com/ishidawataru/sctp            07191f837fedd2f13d1ec7b5f885f0f3ec54b1cb
+
+gotest.tools                            b6e20af1ed078cd01a6413b734051a292450b4cb # v2.1.0
+github.com/google/go-cmp                3af367b6b30c263d47e8895973edcca9a49cf029 # v0.2.0

+ 3 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/hnsendpoint.go

@@ -7,6 +7,9 @@ import (
 // HNSEndpoint represents a network endpoint in HNS
 // HNSEndpoint represents a network endpoint in HNS
 type HNSEndpoint = hns.HNSEndpoint
 type HNSEndpoint = hns.HNSEndpoint
 
 
+// Namespace represents a Compartment.
+type Namespace = hns.Namespace
+
 //SystemType represents the type of the system on which actions are done
 //SystemType represents the type of the system on which actions are done
 type SystemType string
 type SystemType string
 
 

+ 5 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/interface.go

@@ -17,6 +17,11 @@ type MappedPipe = schema1.MappedPipe
 type HvRuntime = schema1.HvRuntime
 type HvRuntime = schema1.HvRuntime
 type MappedVirtualDisk = schema1.MappedVirtualDisk
 type MappedVirtualDisk = schema1.MappedVirtualDisk
 
 
+// AssignedDevice represents a device that has been directly assigned to a container
+//
+// NOTE: Support added in RS5
+type AssignedDevice = schema1.AssignedDevice
+
 // ContainerConfig is used as both the input of CreateContainer
 // ContainerConfig is used as both the input of CreateContainer
 // and to convert the parameters to JSON for passing onto the HCS
 // and to convert the parameters to JSON for passing onto the HCS
 type ContainerConfig = schema1.ContainerConfig
 type ContainerConfig = schema1.ContainerConfig

+ 100 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/guestrequest/types.go

@@ -0,0 +1,100 @@
+package guestrequest
+
+import (
+	"github.com/Microsoft/hcsshim/internal/schema2"
+)
+
+// Arguably, many of these (at least CombinedLayers) should have been generated
+// by swagger.
+//
+// This will also change package name due to an inbound breaking change.
+
+// This class is used by a modify request to add or remove a combined layers
+// structure in the guest. For windows, the GCS applies a filter in ContainerRootPath
+// using the specified layers as the parent content. Ignores property ScratchPath
+// since the container path is already the scratch path. For linux, the GCS unions
+// the specified layers and ScratchPath together, placing the resulting union
+// filesystem at ContainerRootPath.
+type CombinedLayers struct {
+	ContainerRootPath string            `json:"ContainerRootPath,omitempty"`
+	Layers            []hcsschema.Layer `json:"Layers,omitempty"`
+	ScratchPath       string            `json:"ScratchPath,omitempty"`
+}
+
+// Defines the schema for hosted settings passed to GCS and/or OpenGCS
+
+// SCSI. Scratch space for remote file-system commands, or R/W layer for containers
+type LCOWMappedVirtualDisk struct {
+	MountPath  string `json:"MountPath,omitempty"` // /tmp/scratch for an LCOW utility VM being used as a service VM
+	Lun        uint8  `json:"Lun,omitempty"`
+	Controller uint8  `json:"Controller,omitempty"`
+	ReadOnly   bool   `json:"ReadOnly,omitempty"`
+}
+
+type WCOWMappedVirtualDisk struct {
+	ContainerPath string `json:"ContainerPath,omitempty"`
+	Lun           int32  `json:"Lun,omitempty"`
+}
+
+type LCOWMappedDirectory struct {
+	MountPath string `json:"MountPath,omitempty"`
+	Port      int32  `json:"Port,omitempty"`
+	ShareName string `json:"ShareName,omitempty"` // If empty not using ANames (not currently supported)
+	ReadOnly  bool   `json:"ReadOnly,omitempty"`
+}
+
+// Read-only layers over VPMem
+type LCOWMappedVPMemDevice struct {
+	DeviceNumber uint32 `json:"DeviceNumber,omitempty"`
+	MountPath    string `json:"MountPath,omitempty"` // /tmp/pN
+}
+
+type LCOWNetworkAdapter struct {
+	NamespaceID     string `json:",omitempty"`
+	ID              string `json:",omitempty"`
+	MacAddress      string `json:",omitempty"`
+	IPAddress       string `json:",omitempty"`
+	PrefixLength    uint8  `json:",omitempty"`
+	GatewayAddress  string `json:",omitempty"`
+	DNSSuffix       string `json:",omitempty"`
+	DNSServerList   string `json:",omitempty"`
+	EnableLowMetric bool   `json:",omitempty"`
+	EncapOverhead   uint16 `json:",omitempty"`
+}
+
+type ResourceType string
+
+const (
+	// These are constants for v2 schema modify guest requests.
+	ResourceTypeMappedDirectory   ResourceType = "MappedDirectory"
+	ResourceTypeMappedVirtualDisk ResourceType = "MappedVirtualDisk"
+	ResourceTypeNetwork           ResourceType = "Network"
+	ResourceTypeNetworkNamespace  ResourceType = "NetworkNamespace"
+	ResourceTypeCombinedLayers    ResourceType = "CombinedLayers"
+	ResourceTypeVPMemDevice       ResourceType = "VPMemDevice"
+)
+
+// GuestRequest is for modify commands passed to the guest.
+type GuestRequest struct {
+	RequestType  string       `json:"RequestType,omitempty"`
+	ResourceType ResourceType `json:"ResourceType,omitempty"`
+	Settings     interface{}  `json:"Settings,omitempty"`
+}
+
+type NetworkModifyRequest struct {
+	AdapterId   string      `json:"AdapterId,omitempty"`
+	RequestType string      `json:"RequestType,omitempty"`
+	Settings    interface{} `json:"Settings,omitempty"`
+}
+
+type RS4NetworkModifyRequest struct {
+	AdapterInstanceId string      `json:"AdapterInstanceId,omitempty"`
+	RequestType       string      `json:"RequestType,omitempty"`
+	Settings          interface{} `json:"Settings,omitempty"`
+}
+
+// SignalProcessOptions is the options passed to either WCOW or LCOW
+// to signal a given process.
+type SignalProcessOptions struct {
+	Signal int `json:,omitempty`
+}

+ 36 - 13
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/callback.go

@@ -5,6 +5,7 @@ import (
 	"syscall"
 	"syscall"
 
 
 	"github.com/Microsoft/hcsshim/internal/interop"
 	"github.com/Microsoft/hcsshim/internal/interop"
+	"github.com/sirupsen/logrus"
 )
 )
 
 
 var (
 var (
@@ -15,11 +16,20 @@ var (
 	notificationWatcherCallback = syscall.NewCallback(notificationWatcher)
 	notificationWatcherCallback = syscall.NewCallback(notificationWatcher)
 
 
 	// Notifications for HCS_SYSTEM handles
 	// Notifications for HCS_SYSTEM handles
-	hcsNotificationSystemExited          hcsNotification = 0x00000001
-	hcsNotificationSystemCreateCompleted hcsNotification = 0x00000002
-	hcsNotificationSystemStartCompleted  hcsNotification = 0x00000003
-	hcsNotificationSystemPauseCompleted  hcsNotification = 0x00000004
-	hcsNotificationSystemResumeCompleted hcsNotification = 0x00000005
+	hcsNotificationSystemExited                      hcsNotification = 0x00000001
+	hcsNotificationSystemCreateCompleted             hcsNotification = 0x00000002
+	hcsNotificationSystemStartCompleted              hcsNotification = 0x00000003
+	hcsNotificationSystemPauseCompleted              hcsNotification = 0x00000004
+	hcsNotificationSystemResumeCompleted             hcsNotification = 0x00000005
+	hcsNotificationSystemCrashReport                 hcsNotification = 0x00000006
+	hcsNotificationSystemSiloJobCreated              hcsNotification = 0x00000007
+	hcsNotificationSystemSaveCompleted               hcsNotification = 0x00000008
+	hcsNotificationSystemRdpEnhancedModeStateChanged hcsNotification = 0x00000009
+	hcsNotificationSystemShutdownFailed              hcsNotification = 0x0000000A
+	hcsNotificationSystemGetPropertiesCompleted      hcsNotification = 0x0000000B
+	hcsNotificationSystemModifyCompleted             hcsNotification = 0x0000000C
+	hcsNotificationSystemCrashInitiated              hcsNotification = 0x0000000D
+	hcsNotificationSystemGuestConnectionClosed       hcsNotification = 0x0000000E
 
 
 	// Notifications for HCS_PROCESS handles
 	// Notifications for HCS_PROCESS handles
 	hcsNotificationProcessExited hcsNotification = 0x00010000
 	hcsNotificationProcessExited hcsNotification = 0x00010000
@@ -49,16 +59,23 @@ func newChannels() notificationChannels {
 	channels[hcsNotificationSystemResumeCompleted] = make(notificationChannel, 1)
 	channels[hcsNotificationSystemResumeCompleted] = make(notificationChannel, 1)
 	channels[hcsNotificationProcessExited] = make(notificationChannel, 1)
 	channels[hcsNotificationProcessExited] = make(notificationChannel, 1)
 	channels[hcsNotificationServiceDisconnect] = make(notificationChannel, 1)
 	channels[hcsNotificationServiceDisconnect] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemCrashReport] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemSiloJobCreated] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemSaveCompleted] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemRdpEnhancedModeStateChanged] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemShutdownFailed] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemGetPropertiesCompleted] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemModifyCompleted] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemCrashInitiated] = make(notificationChannel, 1)
+	channels[hcsNotificationSystemGuestConnectionClosed] = make(notificationChannel, 1)
+
 	return channels
 	return channels
 }
 }
+
 func closeChannels(channels notificationChannels) {
 func closeChannels(channels notificationChannels) {
-	close(channels[hcsNotificationSystemExited])
-	close(channels[hcsNotificationSystemCreateCompleted])
-	close(channels[hcsNotificationSystemStartCompleted])
-	close(channels[hcsNotificationSystemPauseCompleted])
-	close(channels[hcsNotificationSystemResumeCompleted])
-	close(channels[hcsNotificationProcessExited])
-	close(channels[hcsNotificationServiceDisconnect])
+	for _, c := range channels {
+		close(c)
+	}
 }
 }
 
 
 func notificationWatcher(notificationType hcsNotification, callbackNumber uintptr, notificationStatus uintptr, notificationData *uint16) uintptr {
 func notificationWatcher(notificationType hcsNotification, callbackNumber uintptr, notificationStatus uintptr, notificationData *uint16) uintptr {
@@ -75,7 +92,13 @@ func notificationWatcher(notificationType hcsNotification, callbackNumber uintpt
 		return 0
 		return 0
 	}
 	}
 
 
-	context.channels[notificationType] <- result
+	if channel, ok := context.channels[notificationType]; ok {
+		channel <- result
+	} else {
+		logrus.WithFields(logrus.Fields{
+			"notification-type": notificationType,
+		}).Warn("Received a callback of an unsupported type")
+	}
 
 
 	return 0
 	return 0
 }
 }

+ 10 - 2
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/errors.go

@@ -7,6 +7,7 @@ import (
 	"syscall"
 	"syscall"
 
 
 	"github.com/Microsoft/hcsshim/internal/interop"
 	"github.com/Microsoft/hcsshim/internal/interop"
+	"github.com/Microsoft/hcsshim/internal/logfields"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
 )
 )
 
 
@@ -72,6 +73,9 @@ var (
 	// ErrVmcomputeUnknownMessage is an error encountered guest compute system doesn't support the message
 	// ErrVmcomputeUnknownMessage is an error encountered guest compute system doesn't support the message
 	ErrVmcomputeUnknownMessage = syscall.Errno(0xc037010b)
 	ErrVmcomputeUnknownMessage = syscall.Errno(0xc037010b)
 
 
+	// ErrVmcomputeUnexpectedExit is an error encountered when the compute system terminates unexpectedly
+	ErrVmcomputeUnexpectedExit = syscall.Errno(0xC0370106)
+
 	// ErrNotSupported is an error encountered when hcs doesn't support the request
 	// ErrNotSupported is an error encountered when hcs doesn't support the request
 	ErrPlatformNotSupported = errors.New("unsupported platform request")
 	ErrPlatformNotSupported = errors.New("unsupported platform request")
 )
 )
@@ -116,10 +120,14 @@ func (ev *ErrorEvent) String() string {
 func processHcsResult(resultp *uint16) []ErrorEvent {
 func processHcsResult(resultp *uint16) []ErrorEvent {
 	if resultp != nil {
 	if resultp != nil {
 		resultj := interop.ConvertAndFreeCoTaskMemString(resultp)
 		resultj := interop.ConvertAndFreeCoTaskMemString(resultp)
-		logrus.Debugf("Result: %s", resultj)
+		logrus.WithField(logfields.JSON, resultj).
+			Debug("HCS Result")
 		result := &hcsResult{}
 		result := &hcsResult{}
 		if err := json.Unmarshal([]byte(resultj), result); err != nil {
 		if err := json.Unmarshal([]byte(resultj), result); err != nil {
-			logrus.Warnf("Could not unmarshal HCS result %s: %s", resultj, err)
+			logrus.WithFields(logrus.Fields{
+				logfields.JSON:  resultj,
+				logrus.ErrorKey: err,
+			}).Warning("Could not unmarshal HCS result")
 			return nil
 			return nil
 		}
 		}
 		return result.ErrorEvents
 		return result.ErrorEvents

+ 1 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/hcs.go

@@ -27,6 +27,7 @@ import (
 //sys hcsOpenProcess(computeSystem hcsSystem, pid uint32, process *hcsProcess, result **uint16) (hr error) = vmcompute.HcsOpenProcess?
 //sys hcsOpenProcess(computeSystem hcsSystem, pid uint32, process *hcsProcess, result **uint16) (hr error) = vmcompute.HcsOpenProcess?
 //sys hcsCloseProcess(process hcsProcess) (hr error) = vmcompute.HcsCloseProcess?
 //sys hcsCloseProcess(process hcsProcess) (hr error) = vmcompute.HcsCloseProcess?
 //sys hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) = vmcompute.HcsTerminateProcess?
 //sys hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) = vmcompute.HcsTerminateProcess?
+//sys hcsSignalProcess(process hcsProcess, options string, result **uint16) (hr error) = vmcompute.HcsTerminateProcess?
 //sys hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInformation, result **uint16) (hr error) = vmcompute.HcsGetProcessInfo?
 //sys hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInformation, result **uint16) (hr error) = vmcompute.HcsGetProcessInfo?
 //sys hcsGetProcessProperties(process hcsProcess, processProperties **uint16, result **uint16) (hr error) = vmcompute.HcsGetProcessProperties?
 //sys hcsGetProcessProperties(process hcsProcess, processProperties **uint16, result **uint16) (hr error) = vmcompute.HcsGetProcessProperties?
 //sys hcsModifyProcess(process hcsProcess, settings string, result **uint16) (hr error) = vmcompute.HcsModifyProcess?
 //sys hcsModifyProcess(process hcsProcess, settings string, result **uint16) (hr error) = vmcompute.HcsModifyProcess?

+ 20 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/log.go

@@ -0,0 +1,20 @@
+package hcs
+
+import "github.com/sirupsen/logrus"
+
+func logOperationBegin(ctx logrus.Fields, msg string) {
+	logrus.WithFields(ctx).Debug(msg)
+}
+
+func logOperationEnd(ctx logrus.Fields, msg string, err error) {
+	// Copy the log and fields first.
+	log := logrus.WithFields(ctx)
+	if err == nil {
+		log.Debug(msg)
+	} else {
+		// Edit only the copied field data to avoid race conditions on the
+		// write.
+		log.Data[logrus.ErrorKey] = err
+		log.Error(msg)
+	}
+}

+ 162 - 67
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go

@@ -2,13 +2,14 @@ package hcs
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"
-	"fmt"
 	"io"
 	"io"
 	"sync"
 	"sync"
 	"syscall"
 	"syscall"
 	"time"
 	"time"
 
 
+	"github.com/Microsoft/hcsshim/internal/guestrequest"
 	"github.com/Microsoft/hcsshim/internal/interop"
 	"github.com/Microsoft/hcsshim/internal/interop"
+	"github.com/Microsoft/hcsshim/internal/logfields"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
 )
 )
 
 
@@ -20,6 +21,25 @@ type Process struct {
 	system         *System
 	system         *System
 	cachedPipes    *cachedPipes
 	cachedPipes    *cachedPipes
 	callbackNumber uintptr
 	callbackNumber uintptr
+
+	logctx logrus.Fields
+
+	closedWaitOnce sync.Once
+	waitBlock      chan struct{}
+	waitError      error
+}
+
+func newProcess(process hcsProcess, processID int, computeSystem *System) *Process {
+	return &Process{
+		handle:    process,
+		processID: processID,
+		system:    computeSystem,
+		logctx: logrus.Fields{
+			logfields.ContainerID: computeSystem.ID(),
+			logfields.ProcessID:   processID,
+		},
+		waitBlock: make(chan struct{}),
+	}
 }
 }
 
 
 type cachedPipes struct {
 type cachedPipes struct {
@@ -71,70 +91,136 @@ func (process *Process) SystemID() string {
 	return process.system.ID()
 	return process.system.ID()
 }
 }
 
 
-// Kill signals the process to terminate but does not wait for it to finish terminating.
-func (process *Process) Kill() error {
+func (process *Process) logOperationBegin(operation string) {
+	logOperationBegin(
+		process.logctx,
+		operation+" - Begin Operation")
+}
+
+func (process *Process) logOperationEnd(operation string, err error) {
+	var result string
+	if err == nil {
+		result = "Success"
+	} else {
+		result = "Error"
+	}
+
+	logOperationEnd(
+		process.logctx,
+		operation+" - End Operation - "+result,
+		err)
+}
+
+// Signal signals the process with `options`.
+func (process *Process) Signal(options guestrequest.SignalProcessOptions) (err error) {
 	process.handleLock.RLock()
 	process.handleLock.RLock()
 	defer process.handleLock.RUnlock()
 	defer process.handleLock.RUnlock()
-	operation := "Kill"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+
+	operation := "hcsshim::Process::Signal"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
 	if process.handle == 0 {
 	if process.handle == 0 {
 		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
 		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
 	}
 	}
 
 
+	optionsb, err := json.Marshal(options)
+	if err != nil {
+		return err
+	}
+
+	optionsStr := string(optionsb)
+
 	var resultp *uint16
 	var resultp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("TerminateProcess %s: %d", process.SystemID(), process.Pid()), &completed)
-	err := hcsTerminateProcess(process.handle, &resultp)
-	completed = true
+	syscallWatcher(process.logctx, func() {
+		err = hcsSignalProcess(process.handle, optionsStr, &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return makeProcessError(process, operation, err, events)
 		return makeProcessError(process, operation, err, events)
 	}
 	}
 
 
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return nil
 	return nil
 }
 }
 
 
-// Wait waits for the process to exit.
-func (process *Process) Wait() error {
-	operation := "Wait"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+// Kill signals the process to terminate but does not wait for it to finish terminating.
+func (process *Process) Kill() (err error) {
+	process.handleLock.RLock()
+	defer process.handleLock.RUnlock()
+
+	operation := "hcsshim::Process::Kill"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
-	err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil)
+	if process.handle == 0 {
+		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
+	}
+
+	var resultp *uint16
+	syscallWatcher(process.logctx, func() {
+		err = hcsTerminateProcess(process.handle, &resultp)
+	})
+	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
-		return makeProcessError(process, operation, err, nil)
+		return makeProcessError(process, operation, err, events)
 	}
 	}
 
 
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return nil
 	return nil
 }
 }
 
 
-// WaitTimeout waits for the process to exit or the duration to elapse. It returns
-// false if timeout occurs.
-func (process *Process) WaitTimeout(timeout time.Duration) error {
-	operation := "WaitTimeout"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+// waitBackground waits for the process exit notification. Once received sets
+// `process.waitError` (if any) and unblocks all `Wait` and `WaitTimeout` calls.
+//
+// This MUST be called exactly once per `process.handle` but `Wait` and
+// `WaitTimeout` are safe to call multiple times.
+func (process *Process) waitBackground() {
+	process.waitError = waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil)
+	process.closedWaitOnce.Do(func() {
+		close(process.waitBlock)
+	})
+}
+
+// Wait waits for the process to exit. If the process has already exited returns
+// the pervious error (if any).
+func (process *Process) Wait() (err error) {
+	operation := "hcsshim::Process::Wait"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
-	err := waitForNotification(process.callbackNumber, hcsNotificationProcessExited, &timeout)
-	if err != nil {
+	<-process.waitBlock
+	if process.waitError != nil {
 		return makeProcessError(process, operation, err, nil)
 		return makeProcessError(process, operation, err, nil)
 	}
 	}
-
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return nil
 	return nil
 }
 }
 
 
+// WaitTimeout waits for the process to exit or the duration to elapse. If the
+// process has already exited returns the pervious error (if any). If a timeout
+// occurs returns `ErrTimeout`.
+func (process *Process) WaitTimeout(timeout time.Duration) (err error) {
+	operation := "hcssshim::Process::WaitTimeout"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
+
+	select {
+	case <-process.waitBlock:
+		if process.waitError != nil {
+			return makeProcessError(process, operation, process.waitError, nil)
+		}
+		return nil
+	case <-time.After(timeout):
+		return makeProcessError(process, operation, ErrTimeout, nil)
+	}
+}
+
 // ResizeConsole resizes the console of the process.
 // ResizeConsole resizes the console of the process.
-func (process *Process) ResizeConsole(width, height uint16) error {
+func (process *Process) ResizeConsole(width, height uint16) (err error) {
 	process.handleLock.RLock()
 	process.handleLock.RLock()
 	defer process.handleLock.RUnlock()
 	defer process.handleLock.RUnlock()
-	operation := "ResizeConsole"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+
+	operation := "hcsshim::Process::ResizeConsole"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
 	if process.handle == 0 {
 	if process.handle == 0 {
 		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
 		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
@@ -162,16 +248,16 @@ func (process *Process) ResizeConsole(width, height uint16) error {
 		return makeProcessError(process, operation, err, events)
 		return makeProcessError(process, operation, err, events)
 	}
 	}
 
 
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return nil
 	return nil
 }
 }
 
 
-func (process *Process) Properties() (*ProcessStatus, error) {
+func (process *Process) Properties() (_ *ProcessStatus, err error) {
 	process.handleLock.RLock()
 	process.handleLock.RLock()
 	defer process.handleLock.RUnlock()
 	defer process.handleLock.RUnlock()
-	operation := "Properties"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+
+	operation := "hcsshim::Process::Properties"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
 	if process.handle == 0 {
 	if process.handle == 0 {
 		return nil, makeProcessError(process, operation, ErrAlreadyClosed, nil)
 		return nil, makeProcessError(process, operation, ErrAlreadyClosed, nil)
@@ -181,10 +267,9 @@ func (process *Process) Properties() (*ProcessStatus, error) {
 		resultp     *uint16
 		resultp     *uint16
 		propertiesp *uint16
 		propertiesp *uint16
 	)
 	)
-	completed := false
-	go syscallWatcher(fmt.Sprintf("GetProcessProperties %s: %d", process.SystemID(), process.Pid()), &completed)
-	err := hcsGetProcessProperties(process.handle, &propertiesp, &resultp)
-	completed = true
+	syscallWatcher(process.logctx, func() {
+		err = hcsGetProcessProperties(process.handle, &propertiesp, &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return nil, makeProcessError(process, operation, err, events)
 		return nil, makeProcessError(process, operation, err, events)
@@ -200,25 +285,32 @@ func (process *Process) Properties() (*ProcessStatus, error) {
 		return nil, makeProcessError(process, operation, err, nil)
 		return nil, makeProcessError(process, operation, err, nil)
 	}
 	}
 
 
-	logrus.Debugf(title+" succeeded processid=%d, properties=%s", process.processID, propertiesRaw)
 	return properties, nil
 	return properties, nil
 }
 }
 
 
 // ExitCode returns the exit code of the process. The process must have
 // ExitCode returns the exit code of the process. The process must have
 // already terminated.
 // already terminated.
-func (process *Process) ExitCode() (int, error) {
-	operation := "ExitCode"
+func (process *Process) ExitCode() (_ int, err error) {
+	operation := "hcsshim::Process::ExitCode"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
+
 	properties, err := process.Properties()
 	properties, err := process.Properties()
 	if err != nil {
 	if err != nil {
-		return 0, makeProcessError(process, operation, err, nil)
+		return -1, makeProcessError(process, operation, err, nil)
 	}
 	}
 
 
 	if properties.Exited == false {
 	if properties.Exited == false {
-		return 0, makeProcessError(process, operation, ErrInvalidProcessState, nil)
+		return -1, makeProcessError(process, operation, ErrInvalidProcessState, nil)
 	}
 	}
 
 
 	if properties.LastWaitResult != 0 {
 	if properties.LastWaitResult != 0 {
-		return 0, makeProcessError(process, operation, syscall.Errno(properties.LastWaitResult), nil)
+		logrus.WithFields(logrus.Fields{
+			logfields.ContainerID: process.SystemID(),
+			logfields.ProcessID:   process.processID,
+			"wait-result":         properties.LastWaitResult,
+		}).Warn("hcsshim::Process::ExitCode - Non-zero last wait result")
+		return -1, nil
 	}
 	}
 
 
 	return int(properties.ExitCode), nil
 	return int(properties.ExitCode), nil
@@ -227,12 +319,13 @@ func (process *Process) ExitCode() (int, error) {
 // Stdio returns the stdin, stdout, and stderr pipes, respectively. Closing
 // Stdio returns the stdin, stdout, and stderr pipes, respectively. Closing
 // these pipes does not close the underlying pipes; it should be possible to
 // these pipes does not close the underlying pipes; it should be possible to
 // call this multiple times to get multiple interfaces.
 // call this multiple times to get multiple interfaces.
-func (process *Process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, error) {
+func (process *Process) Stdio() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadCloser, err error) {
 	process.handleLock.RLock()
 	process.handleLock.RLock()
 	defer process.handleLock.RUnlock()
 	defer process.handleLock.RUnlock()
-	operation := "Stdio"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+
+	operation := "hcsshim::Process::Stdio"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
 	if process.handle == 0 {
 	if process.handle == 0 {
 		return nil, nil, nil, makeProcessError(process, operation, ErrAlreadyClosed, nil)
 		return nil, nil, nil, makeProcessError(process, operation, ErrAlreadyClosed, nil)
@@ -245,7 +338,7 @@ func (process *Process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, e
 			processInfo hcsProcessInformation
 			processInfo hcsProcessInformation
 			resultp     *uint16
 			resultp     *uint16
 		)
 		)
-		err := hcsGetProcessInfo(process.handle, &processInfo, &resultp)
+		err = hcsGetProcessInfo(process.handle, &processInfo, &resultp)
 		events := processHcsResult(resultp)
 		events := processHcsResult(resultp)
 		if err != nil {
 		if err != nil {
 			return nil, nil, nil, makeProcessError(process, operation, err, events)
 			return nil, nil, nil, makeProcessError(process, operation, err, events)
@@ -265,18 +358,18 @@ func (process *Process) Stdio() (io.WriteCloser, io.ReadCloser, io.ReadCloser, e
 		return nil, nil, nil, makeProcessError(process, operation, err, nil)
 		return nil, nil, nil, makeProcessError(process, operation, err, nil)
 	}
 	}
 
 
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return pipes[0], pipes[1], pipes[2], nil
 	return pipes[0], pipes[1], pipes[2], nil
 }
 }
 
 
 // CloseStdin closes the write side of the stdin pipe so that the process is
 // CloseStdin closes the write side of the stdin pipe so that the process is
 // notified on the read side that there is no more data in stdin.
 // notified on the read side that there is no more data in stdin.
-func (process *Process) CloseStdin() error {
+func (process *Process) CloseStdin() (err error) {
 	process.handleLock.RLock()
 	process.handleLock.RLock()
 	defer process.handleLock.RUnlock()
 	defer process.handleLock.RUnlock()
-	operation := "CloseStdin"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+
+	operation := "hcsshim::Process::CloseStdin"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
 	if process.handle == 0 {
 	if process.handle == 0 {
 		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
 		return makeProcessError(process, operation, ErrAlreadyClosed, nil)
@@ -303,35 +396,37 @@ func (process *Process) CloseStdin() error {
 		return makeProcessError(process, operation, err, events)
 		return makeProcessError(process, operation, err, events)
 	}
 	}
 
 
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return nil
 	return nil
 }
 }
 
 
 // Close cleans up any state associated with the process but does not kill
 // Close cleans up any state associated with the process but does not kill
 // or wait on it.
 // or wait on it.
-func (process *Process) Close() error {
+func (process *Process) Close() (err error) {
 	process.handleLock.Lock()
 	process.handleLock.Lock()
 	defer process.handleLock.Unlock()
 	defer process.handleLock.Unlock()
-	operation := "Close"
-	title := "hcsshim::Process::" + operation
-	logrus.Debugf(title+" processid=%d", process.processID)
+
+	operation := "hcsshim::Process::Close"
+	process.logOperationBegin(operation)
+	defer func() { process.logOperationEnd(operation, err) }()
 
 
 	// Don't double free this
 	// Don't double free this
 	if process.handle == 0 {
 	if process.handle == 0 {
 		return nil
 		return nil
 	}
 	}
 
 
-	if err := process.unregisterCallback(); err != nil {
+	if err = process.unregisterCallback(); err != nil {
 		return makeProcessError(process, operation, err, nil)
 		return makeProcessError(process, operation, err, nil)
 	}
 	}
 
 
-	if err := hcsCloseProcess(process.handle); err != nil {
+	if err = hcsCloseProcess(process.handle); err != nil {
 		return makeProcessError(process, operation, err, nil)
 		return makeProcessError(process, operation, err, nil)
 	}
 	}
 
 
 	process.handle = 0
 	process.handle = 0
+	process.closedWaitOnce.Do(func() {
+		close(process.waitBlock)
+	})
 
 
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return nil
 	return nil
 }
 }
 
 
@@ -384,7 +479,7 @@ func (process *Process) unregisterCallback() error {
 	closeChannels(context.channels)
 	closeChannels(context.channels)
 
 
 	callbackMapLock.Lock()
 	callbackMapLock.Lock()
-	callbackMap[callbackNumber] = nil
+	delete(callbackMap, callbackNumber)
 	callbackMapLock.Unlock()
 	callbackMapLock.Unlock()
 
 
 	handle = 0
 	handle = 0

+ 285 - 153
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go

@@ -2,7 +2,6 @@ package hcs
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"
-	"fmt"
 	"os"
 	"os"
 	"strconv"
 	"strconv"
 	"sync"
 	"sync"
@@ -10,6 +9,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/Microsoft/hcsshim/internal/interop"
 	"github.com/Microsoft/hcsshim/internal/interop"
+	"github.com/Microsoft/hcsshim/internal/logfields"
 	"github.com/Microsoft/hcsshim/internal/schema1"
 	"github.com/Microsoft/hcsshim/internal/schema1"
 	"github.com/Microsoft/hcsshim/internal/timeout"
 	"github.com/Microsoft/hcsshim/internal/timeout"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
@@ -41,36 +41,74 @@ type System struct {
 	handle         hcsSystem
 	handle         hcsSystem
 	id             string
 	id             string
 	callbackNumber uintptr
 	callbackNumber uintptr
-}
 
 
-// CreateComputeSystem creates a new compute system with the given configuration but does not start it.
-func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (*System, error) {
-	operation := "CreateComputeSystem"
-	title := "hcsshim::" + operation
+	logctx logrus.Fields
+
+	closedWaitOnce sync.Once
+	waitBlock      chan struct{}
+	waitError      error
+}
 
 
-	computeSystem := &System{
+func newSystem(id string) *System {
+	return &System{
 		id: id,
 		id: id,
+		logctx: logrus.Fields{
+			logfields.ContainerID: id,
+		},
+		waitBlock: make(chan struct{}),
+	}
+}
+
+func (computeSystem *System) logOperationBegin(operation string) {
+	logOperationBegin(
+		computeSystem.logctx,
+		operation+" - Begin Operation")
+}
+
+func (computeSystem *System) logOperationEnd(operation string, err error) {
+	var result string
+	if err == nil {
+		result = "Success"
+	} else {
+		result = "Error"
 	}
 	}
 
 
+	logOperationEnd(
+		computeSystem.logctx,
+		operation+" - End Operation - "+result,
+		err)
+}
+
+// CreateComputeSystem creates a new compute system with the given configuration but does not start it.
+func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System, err error) {
+	operation := "hcsshim::CreateComputeSystem"
+
+	computeSystem := newSystem(id)
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
+
 	hcsDocumentB, err := json.Marshal(hcsDocumentInterface)
 	hcsDocumentB, err := json.Marshal(hcsDocumentInterface)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
 	hcsDocument := string(hcsDocumentB)
 	hcsDocument := string(hcsDocumentB)
-	logrus.Debugf(title+" ID=%s config=%s", id, hcsDocument)
+
+	logrus.WithFields(computeSystem.logctx).
+		WithField(logfields.JSON, hcsDocument).
+		Debug("HCS ComputeSystem Document")
 
 
 	var (
 	var (
-		resultp  *uint16
-		identity syscall.Handle
+		resultp     *uint16
+		identity    syscall.Handle
+		createError error
 	)
 	)
-	completed := false
-	go syscallWatcher(fmt.Sprintf("CreateCompleteSystem %s: %s", id, hcsDocument), &completed)
-	createError := hcsCreateComputeSystem(id, hcsDocument, identity, &computeSystem.handle, &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		createError = hcsCreateComputeSystem(id, hcsDocument, identity, &computeSystem.handle, &resultp)
+	})
 
 
 	if createError == nil || IsPending(createError) {
 	if createError == nil || IsPending(createError) {
-		if err := computeSystem.registerCallback(); err != nil {
+		if err = computeSystem.registerCallback(); err != nil {
 			// Terminate the compute system if it still exists. We're okay to
 			// Terminate the compute system if it still exists. We're okay to
 			// ignore a failure here.
 			// ignore a failure here.
 			computeSystem.Terminate()
 			computeSystem.Terminate()
@@ -88,25 +126,30 @@ func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (*System,
 		return nil, makeSystemError(computeSystem, operation, hcsDocument, err, events)
 		return nil, makeSystemError(computeSystem, operation, hcsDocument, err, events)
 	}
 	}
 
 
-	logrus.Debugf(title+" succeeded id=%s handle=%d", id, computeSystem.handle)
+	go computeSystem.waitBackground()
+
 	return computeSystem, nil
 	return computeSystem, nil
 }
 }
 
 
 // OpenComputeSystem opens an existing compute system by ID.
 // OpenComputeSystem opens an existing compute system by ID.
-func OpenComputeSystem(id string) (*System, error) {
-	operation := "OpenComputeSystem"
-	title := "hcsshim::" + operation
-	logrus.Debugf(title+" ID=%s", id)
-
-	computeSystem := &System{
-		id: id,
-	}
+func OpenComputeSystem(id string) (_ *System, err error) {
+	operation := "hcsshim::OpenComputeSystem"
+
+	computeSystem := newSystem(id)
+	computeSystem.logOperationBegin(operation)
+	defer func() {
+		if IsNotExist(err) {
+			computeSystem.logOperationEnd(operation, nil)
+		} else {
+			computeSystem.logOperationEnd(operation, err)
+		}
+	}()
 
 
 	var (
 	var (
 		handle  hcsSystem
 		handle  hcsSystem
 		resultp *uint16
 		resultp *uint16
 	)
 	)
-	err := hcsOpenComputeSystem(id, &handle, &resultp)
+	err = hcsOpenComputeSystem(id, &handle, &resultp)
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return nil, makeSystemError(computeSystem, operation, "", err, events)
 		return nil, makeSystemError(computeSystem, operation, "", err, events)
@@ -114,18 +157,35 @@ func OpenComputeSystem(id string) (*System, error) {
 
 
 	computeSystem.handle = handle
 	computeSystem.handle = handle
 
 
-	if err := computeSystem.registerCallback(); err != nil {
+	if err = computeSystem.registerCallback(); err != nil {
 		return nil, makeSystemError(computeSystem, operation, "", err, nil)
 		return nil, makeSystemError(computeSystem, operation, "", err, nil)
 	}
 	}
+	go computeSystem.waitBackground()
 
 
-	logrus.Debugf(title+" succeeded id=%s handle=%d", id, handle)
 	return computeSystem, nil
 	return computeSystem, nil
 }
 }
 
 
 // GetComputeSystems gets a list of the compute systems on the system that match the query
 // GetComputeSystems gets a list of the compute systems on the system that match the query
-func GetComputeSystems(q schema1.ComputeSystemQuery) ([]schema1.ContainerProperties, error) {
-	operation := "GetComputeSystems"
-	title := "hcsshim::" + operation
+func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerProperties, err error) {
+	operation := "hcsshim::GetComputeSystems"
+	fields := logrus.Fields{}
+	logOperationBegin(
+		fields,
+		operation+" - Begin Operation")
+
+	defer func() {
+		var result string
+		if err == nil {
+			result = "Success"
+		} else {
+			result = "Error"
+		}
+
+		logOperationEnd(
+			fields,
+			operation+" - End Operation - "+result,
+			err)
+	}()
 
 
 	queryb, err := json.Marshal(q)
 	queryb, err := json.Marshal(q)
 	if err != nil {
 	if err != nil {
@@ -133,16 +193,19 @@ func GetComputeSystems(q schema1.ComputeSystemQuery) ([]schema1.ContainerPropert
 	}
 	}
 
 
 	query := string(queryb)
 	query := string(queryb)
-	logrus.Debugf(title+" query=%s", query)
+
+	logrus.WithFields(fields).
+		WithField(logfields.JSON, query).
+		Debug("HCS ComputeSystem Query")
 
 
 	var (
 	var (
 		resultp         *uint16
 		resultp         *uint16
 		computeSystemsp *uint16
 		computeSystemsp *uint16
 	)
 	)
-	completed := false
-	go syscallWatcher(fmt.Sprintf("GetComputeSystems %s:", query), &completed)
-	err = hcsEnumerateComputeSystems(query, &computeSystemsp, &resultp)
-	completed = true
+
+	syscallWatcher(fields, func() {
+		err = hcsEnumerateComputeSystems(query, &computeSystemsp, &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return nil, &HcsError{Op: operation, Err: err, Events: events}
 		return nil, &HcsError{Op: operation, Err: err, Events: events}
@@ -153,20 +216,21 @@ func GetComputeSystems(q schema1.ComputeSystemQuery) ([]schema1.ContainerPropert
 	}
 	}
 	computeSystemsRaw := interop.ConvertAndFreeCoTaskMemBytes(computeSystemsp)
 	computeSystemsRaw := interop.ConvertAndFreeCoTaskMemBytes(computeSystemsp)
 	computeSystems := []schema1.ContainerProperties{}
 	computeSystems := []schema1.ContainerProperties{}
-	if err := json.Unmarshal(computeSystemsRaw, &computeSystems); err != nil {
+	if err = json.Unmarshal(computeSystemsRaw, &computeSystems); err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
 
 
-	logrus.Debugf(title + " succeeded")
 	return computeSystems, nil
 	return computeSystems, nil
 }
 }
 
 
 // Start synchronously starts the computeSystem.
 // Start synchronously starts the computeSystem.
-func (computeSystem *System) Start() error {
+func (computeSystem *System) Start() (err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::ComputeSystem::Start ID=" + computeSystem.ID()
-	logrus.Debugf(title)
+
+	operation := "hcsshim::ComputeSystem::Start"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
 
 
 	if computeSystem.handle == 0 {
 	if computeSystem.handle == 0 {
 		return makeSystemError(computeSystem, "Start", "", ErrAlreadyClosed, nil)
 		return makeSystemError(computeSystem, "Start", "", ErrAlreadyClosed, nil)
@@ -199,16 +263,14 @@ func (computeSystem *System) Start() error {
 	}
 	}
 
 
 	var resultp *uint16
 	var resultp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("StartComputeSystem %s:", computeSystem.ID()), &completed)
-	err := hcsStartComputeSystem(computeSystem.handle, "", &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsStartComputeSystem(computeSystem.handle, "", &resultp)
+	})
 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart)
 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemStartCompleted, &timeout.SystemStart)
 	if err != nil {
 	if err != nil {
 		return makeSystemError(computeSystem, "Start", "", err, events)
 		return makeSystemError(computeSystem, "Start", "", err, events)
 	}
 	}
 
 
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
@@ -219,98 +281,152 @@ func (computeSystem *System) ID() string {
 
 
 // Shutdown requests a compute system shutdown, if IsPending() on the error returned is true,
 // Shutdown requests a compute system shutdown, if IsPending() on the error returned is true,
 // it may not actually be shut down until Wait() succeeds.
 // it may not actually be shut down until Wait() succeeds.
-func (computeSystem *System) Shutdown() error {
+func (computeSystem *System) Shutdown() (err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::ComputeSystem::Shutdown"
-	logrus.Debugf(title)
+
+	operation := "hcsshim::ComputeSystem::Shutdown"
+	computeSystem.logOperationBegin(operation)
+	defer func() {
+		if IsAlreadyClosed(err) || IsAlreadyStopped(err) || IsPending(err) {
+			computeSystem.logOperationEnd(operation, nil)
+		} else {
+			computeSystem.logOperationEnd(operation, err)
+		}
+	}()
+
 	if computeSystem.handle == 0 {
 	if computeSystem.handle == 0 {
 		return makeSystemError(computeSystem, "Shutdown", "", ErrAlreadyClosed, nil)
 		return makeSystemError(computeSystem, "Shutdown", "", ErrAlreadyClosed, nil)
 	}
 	}
 
 
 	var resultp *uint16
 	var resultp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("ShutdownComputeSystem %s:", computeSystem.ID()), &completed)
-	err := hcsShutdownComputeSystem(computeSystem.handle, "", &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsShutdownComputeSystem(computeSystem.handle, "", &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return makeSystemError(computeSystem, "Shutdown", "", err, events)
 		return makeSystemError(computeSystem, "Shutdown", "", err, events)
 	}
 	}
 
 
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
 // Terminate requests a compute system terminate, if IsPending() on the error returned is true,
 // Terminate requests a compute system terminate, if IsPending() on the error returned is true,
 // it may not actually be shut down until Wait() succeeds.
 // it may not actually be shut down until Wait() succeeds.
-func (computeSystem *System) Terminate() error {
+func (computeSystem *System) Terminate() (err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::ComputeSystem::Terminate ID=" + computeSystem.ID()
-	logrus.Debugf(title)
+
+	operation := "hcsshim::ComputeSystem::Terminate"
+	computeSystem.logOperationBegin(operation)
+	defer func() {
+		if IsAlreadyClosed(err) || IsAlreadyStopped(err) || IsPending(err) {
+			computeSystem.logOperationEnd(operation, nil)
+		} else {
+			computeSystem.logOperationEnd(operation, err)
+		}
+	}()
 
 
 	if computeSystem.handle == 0 {
 	if computeSystem.handle == 0 {
 		return makeSystemError(computeSystem, "Terminate", "", ErrAlreadyClosed, nil)
 		return makeSystemError(computeSystem, "Terminate", "", ErrAlreadyClosed, nil)
 	}
 	}
 
 
 	var resultp *uint16
 	var resultp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("TerminateComputeSystem %s:", computeSystem.ID()), &completed)
-	err := hcsTerminateComputeSystem(computeSystem.handle, "", &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsTerminateComputeSystem(computeSystem.handle, "", &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
-	if err != nil {
+	if err != nil && err != ErrVmcomputeAlreadyStopped {
 		return makeSystemError(computeSystem, "Terminate", "", err, events)
 		return makeSystemError(computeSystem, "Terminate", "", err, events)
 	}
 	}
 
 
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
-// Wait synchronously waits for the compute system to shutdown or terminate.
-func (computeSystem *System) Wait() error {
-	title := "hcsshim::ComputeSystem::Wait ID=" + computeSystem.ID()
-	logrus.Debugf(title)
+// waitBackground waits for the compute system exit notification. Once received
+// sets `computeSystem.waitError` (if any) and unblocks all `Wait`,
+// `WaitExpectedError`, and `WaitTimeout` calls.
+//
+// This MUST be called exactly once per `computeSystem.handle` but `Wait`,
+// `WaitExpectedError`, and `WaitTimeout` are safe to call multiple times.
+func (computeSystem *System) waitBackground() {
+	computeSystem.waitError = waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, nil)
+	computeSystem.closedWaitOnce.Do(func() {
+		close(computeSystem.waitBlock)
+	})
+}
+
+// Wait synchronously waits for the compute system to shutdown or terminate. If
+// the compute system has already exited returns the previous error (if any).
+func (computeSystem *System) Wait() (err error) {
+	operation := "hcsshim::ComputeSystem::Wait"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
 
 
-	err := waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, nil)
-	if err != nil {
-		return makeSystemError(computeSystem, "Wait", "", err, nil)
+	<-computeSystem.waitBlock
+	if computeSystem.waitError != nil {
+		return makeSystemError(computeSystem, "Wait", "", computeSystem.waitError, nil)
 	}
 	}
 
 
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
-// WaitTimeout synchronously waits for the compute system to terminate or the duration to elapse.
-// If the timeout expires, IsTimeout(err) == true
-func (computeSystem *System) WaitTimeout(timeout time.Duration) error {
-	title := "hcsshim::ComputeSystem::WaitTimeout ID=" + computeSystem.ID()
-	logrus.Debugf(title)
+// WaitExpectedError synchronously waits for the compute system to shutdown or
+// terminate and returns the error (if any) as long as it does not match
+// `expected`. If the compute system has already exited returns the previous
+// error (if any) as long as it does not match `expected`.
+func (computeSystem *System) WaitExpectedError(expected error) (err error) {
+	operation := "hcsshim::ComputeSystem::WaitExpectedError"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
 
 
-	err := waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, &timeout)
-	if err != nil {
-		return makeSystemError(computeSystem, "WaitTimeout", "", err, nil)
+	<-computeSystem.waitBlock
+	if computeSystem.waitError != nil && getInnerError(computeSystem.waitError) != expected {
+		return makeSystemError(computeSystem, "WaitExpectedError", "", computeSystem.waitError, nil)
 	}
 	}
-
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
-func (computeSystem *System) Properties(types ...schema1.PropertyType) (*schema1.ContainerProperties, error) {
+// WaitTimeout synchronously waits for the compute system to terminate or the
+// duration to elapse. If the timeout expires, `IsTimeout(err) == true`. If
+// the compute system has already exited returns the previous error (if any).
+func (computeSystem *System) WaitTimeout(timeout time.Duration) (err error) {
+	operation := "hcsshim::ComputeSystem::WaitTimeout"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
+
+	select {
+	case <-computeSystem.waitBlock:
+		if computeSystem.waitError != nil {
+			return makeSystemError(computeSystem, "WaitTimeout", "", computeSystem.waitError, nil)
+		}
+		return nil
+	case <-time.After(timeout):
+		return makeSystemError(computeSystem, "WaitTimeout", "", ErrTimeout, nil)
+	}
+}
+
+func (computeSystem *System) Properties(types ...schema1.PropertyType) (_ *schema1.ContainerProperties, err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
 
 
+	operation := "hcsshim::ComputeSystem::Properties"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
+
 	queryj, err := json.Marshal(schema1.PropertyQuery{types})
 	queryj, err := json.Marshal(schema1.PropertyQuery{types})
 	if err != nil {
 	if err != nil {
 		return nil, makeSystemError(computeSystem, "Properties", "", err, nil)
 		return nil, makeSystemError(computeSystem, "Properties", "", err, nil)
 	}
 	}
 
 
+	logrus.WithFields(computeSystem.logctx).
+		WithField(logfields.JSON, queryj).
+		Debug("HCS ComputeSystem Properties Query")
+
 	var resultp, propertiesp *uint16
 	var resultp, propertiesp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("GetComputeSystemProperties %s:", computeSystem.ID()), &completed)
-	err = hcsGetComputeSystemProperties(computeSystem.handle, string(queryj), &propertiesp, &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsGetComputeSystemProperties(computeSystem.handle, string(queryj), &propertiesp, &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return nil, makeSystemError(computeSystem, "Properties", "", err, events)
 		return nil, makeSystemError(computeSystem, "Properties", "", err, events)
@@ -324,64 +440,69 @@ func (computeSystem *System) Properties(types ...schema1.PropertyType) (*schema1
 	if err := json.Unmarshal(propertiesRaw, properties); err != nil {
 	if err := json.Unmarshal(propertiesRaw, properties); err != nil {
 		return nil, makeSystemError(computeSystem, "Properties", "", err, nil)
 		return nil, makeSystemError(computeSystem, "Properties", "", err, nil)
 	}
 	}
+
 	return properties, nil
 	return properties, nil
 }
 }
 
 
 // Pause pauses the execution of the computeSystem. This feature is not enabled in TP5.
 // Pause pauses the execution of the computeSystem. This feature is not enabled in TP5.
-func (computeSystem *System) Pause() error {
+func (computeSystem *System) Pause() (err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::ComputeSystem::Pause ID=" + computeSystem.ID()
-	logrus.Debugf(title)
+
+	operation := "hcsshim::ComputeSystem::Pause"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
 
 
 	if computeSystem.handle == 0 {
 	if computeSystem.handle == 0 {
 		return makeSystemError(computeSystem, "Pause", "", ErrAlreadyClosed, nil)
 		return makeSystemError(computeSystem, "Pause", "", ErrAlreadyClosed, nil)
 	}
 	}
 
 
 	var resultp *uint16
 	var resultp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("PauseComputeSystem %s:", computeSystem.ID()), &completed)
-	err := hcsPauseComputeSystem(computeSystem.handle, "", &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsPauseComputeSystem(computeSystem.handle, "", &resultp)
+	})
 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemPauseCompleted, &timeout.SystemPause)
 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemPauseCompleted, &timeout.SystemPause)
 	if err != nil {
 	if err != nil {
 		return makeSystemError(computeSystem, "Pause", "", err, events)
 		return makeSystemError(computeSystem, "Pause", "", err, events)
 	}
 	}
 
 
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
 // Resume resumes the execution of the computeSystem. This feature is not enabled in TP5.
 // Resume resumes the execution of the computeSystem. This feature is not enabled in TP5.
-func (computeSystem *System) Resume() error {
+func (computeSystem *System) Resume() (err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::ComputeSystem::Resume ID=" + computeSystem.ID()
-	logrus.Debugf(title)
+
+	operation := "hcsshim::ComputeSystem::Resume"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
 
 
 	if computeSystem.handle == 0 {
 	if computeSystem.handle == 0 {
 		return makeSystemError(computeSystem, "Resume", "", ErrAlreadyClosed, nil)
 		return makeSystemError(computeSystem, "Resume", "", ErrAlreadyClosed, nil)
 	}
 	}
 
 
 	var resultp *uint16
 	var resultp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("ResumeComputeSystem %s:", computeSystem.ID()), &completed)
-	err := hcsResumeComputeSystem(computeSystem.handle, "", &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsResumeComputeSystem(computeSystem.handle, "", &resultp)
+	})
 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemResumeCompleted, &timeout.SystemResume)
 	events, err := processAsyncHcsResult(err, resultp, computeSystem.callbackNumber, hcsNotificationSystemResumeCompleted, &timeout.SystemResume)
 	if err != nil {
 	if err != nil {
 		return makeSystemError(computeSystem, "Resume", "", err, events)
 		return makeSystemError(computeSystem, "Resume", "", err, events)
 	}
 	}
 
 
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
 // CreateProcess launches a new process within the computeSystem.
 // CreateProcess launches a new process within the computeSystem.
-func (computeSystem *System) CreateProcess(c interface{}) (*Process, error) {
+func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::ComputeSystem::CreateProcess ID=" + computeSystem.ID()
+
+	operation := "hcsshim::ComputeSystem::CreateProcess"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
+
 	var (
 	var (
 		processInfo   hcsProcessInformation
 		processInfo   hcsProcessInformation
 		processHandle hcsProcess
 		processHandle hcsProcess
@@ -398,42 +519,51 @@ func (computeSystem *System) CreateProcess(c interface{}) (*Process, error) {
 	}
 	}
 
 
 	configuration := string(configurationb)
 	configuration := string(configurationb)
-	logrus.Debugf(title+" config=%s", configuration)
 
 
-	completed := false
-	go syscallWatcher(fmt.Sprintf("CreateProcess %s: %s", computeSystem.ID(), configuration), &completed)
-	err = hcsCreateProcess(computeSystem.handle, configuration, &processInfo, &processHandle, &resultp)
-	completed = true
+	logrus.WithFields(computeSystem.logctx).
+		WithField(logfields.JSON, configuration).
+		Debug("HCS ComputeSystem Process Document")
+
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsCreateProcess(computeSystem.handle, configuration, &processInfo, &processHandle, &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return nil, makeSystemError(computeSystem, "CreateProcess", configuration, err, events)
 		return nil, makeSystemError(computeSystem, "CreateProcess", configuration, err, events)
 	}
 	}
 
 
-	process := &Process{
-		handle:    processHandle,
-		processID: int(processInfo.ProcessId),
-		system:    computeSystem,
-		cachedPipes: &cachedPipes{
-			stdIn:  processInfo.StdInput,
-			stdOut: processInfo.StdOutput,
-			stdErr: processInfo.StdError,
-		},
+	logrus.WithFields(computeSystem.logctx).
+		WithField(logfields.ProcessID, processInfo.ProcessId).
+		Debug("HCS ComputeSystem CreateProcess PID")
+
+	process := newProcess(processHandle, int(processInfo.ProcessId), computeSystem)
+	process.cachedPipes = &cachedPipes{
+		stdIn:  processInfo.StdInput,
+		stdOut: processInfo.StdOutput,
+		stdErr: processInfo.StdError,
 	}
 	}
 
 
-	if err := process.registerCallback(); err != nil {
+	if err = process.registerCallback(); err != nil {
 		return nil, makeSystemError(computeSystem, "CreateProcess", "", err, nil)
 		return nil, makeSystemError(computeSystem, "CreateProcess", "", err, nil)
 	}
 	}
+	go process.waitBackground()
 
 
-	logrus.Debugf(title+" succeeded processid=%d", process.processID)
 	return process, nil
 	return process, nil
 }
 }
 
 
 // OpenProcess gets an interface to an existing process within the computeSystem.
 // OpenProcess gets an interface to an existing process within the computeSystem.
-func (computeSystem *System) OpenProcess(pid int) (*Process, error) {
+func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::ComputeSystem::OpenProcess ID=" + computeSystem.ID()
-	logrus.Debugf(title+" processid=%d", pid)
+
+	// Add PID for the context of this operation
+	computeSystem.logctx[logfields.ProcessID] = pid
+	defer delete(computeSystem.logctx, logfields.ProcessID)
+
+	operation := "hcsshim::ComputeSystem::OpenProcess"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
+
 	var (
 	var (
 		processHandle hcsProcess
 		processHandle hcsProcess
 		resultp       *uint16
 		resultp       *uint16
@@ -443,56 +573,53 @@ func (computeSystem *System) OpenProcess(pid int) (*Process, error) {
 		return nil, makeSystemError(computeSystem, "OpenProcess", "", ErrAlreadyClosed, nil)
 		return nil, makeSystemError(computeSystem, "OpenProcess", "", ErrAlreadyClosed, nil)
 	}
 	}
 
 
-	completed := false
-	go syscallWatcher(fmt.Sprintf("OpenProcess %s: %d", computeSystem.ID(), pid), &completed)
-	err := hcsOpenProcess(computeSystem.handle, uint32(pid), &processHandle, &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsOpenProcess(computeSystem.handle, uint32(pid), &processHandle, &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return nil, makeSystemError(computeSystem, "OpenProcess", "", err, events)
 		return nil, makeSystemError(computeSystem, "OpenProcess", "", err, events)
 	}
 	}
 
 
-	process := &Process{
-		handle:    processHandle,
-		processID: pid,
-		system:    computeSystem,
-	}
-
-	if err := process.registerCallback(); err != nil {
+	process := newProcess(processHandle, pid, computeSystem)
+	if err = process.registerCallback(); err != nil {
 		return nil, makeSystemError(computeSystem, "OpenProcess", "", err, nil)
 		return nil, makeSystemError(computeSystem, "OpenProcess", "", err, nil)
 	}
 	}
+	go process.waitBackground()
 
 
-	logrus.Debugf(title+" succeeded processid=%s", process.processID)
 	return process, nil
 	return process, nil
 }
 }
 
 
 // Close cleans up any state associated with the compute system but does not terminate or wait for it.
 // Close cleans up any state associated with the compute system but does not terminate or wait for it.
-func (computeSystem *System) Close() error {
+func (computeSystem *System) Close() (err error) {
 	computeSystem.handleLock.Lock()
 	computeSystem.handleLock.Lock()
 	defer computeSystem.handleLock.Unlock()
 	defer computeSystem.handleLock.Unlock()
-	title := "hcsshim::ComputeSystem::Close ID=" + computeSystem.ID()
-	logrus.Debugf(title)
+
+	operation := "hcsshim::ComputeSystem::Close"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
 
 
 	// Don't double free this
 	// Don't double free this
 	if computeSystem.handle == 0 {
 	if computeSystem.handle == 0 {
 		return nil
 		return nil
 	}
 	}
 
 
-	if err := computeSystem.unregisterCallback(); err != nil {
+	if err = computeSystem.unregisterCallback(); err != nil {
 		return makeSystemError(computeSystem, "Close", "", err, nil)
 		return makeSystemError(computeSystem, "Close", "", err, nil)
 	}
 	}
 
 
-	completed := false
-	go syscallWatcher(fmt.Sprintf("CloseComputeSystem %s:", computeSystem.ID()), &completed)
-	err := hcsCloseComputeSystem(computeSystem.handle)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsCloseComputeSystem(computeSystem.handle)
+	})
 	if err != nil {
 	if err != nil {
 		return makeSystemError(computeSystem, "Close", "", err, nil)
 		return makeSystemError(computeSystem, "Close", "", err, nil)
 	}
 	}
 
 
 	computeSystem.handle = 0
 	computeSystem.handle = 0
+	computeSystem.closedWaitOnce.Do(func() {
+		close(computeSystem.waitBlock)
+	})
 
 
-	logrus.Debugf(title + " succeeded")
 	return nil
 	return nil
 }
 }
 
 
@@ -545,7 +672,7 @@ func (computeSystem *System) unregisterCallback() error {
 	closeChannels(context.channels)
 	closeChannels(context.channels)
 
 
 	callbackMapLock.Lock()
 	callbackMapLock.Lock()
-	callbackMap[callbackNumber] = nil
+	delete(callbackMap, callbackNumber)
 	callbackMapLock.Unlock()
 	callbackMapLock.Unlock()
 
 
 	handle = 0
 	handle = 0
@@ -553,11 +680,14 @@ func (computeSystem *System) unregisterCallback() error {
 	return nil
 	return nil
 }
 }
 
 
-// Modifies the System by sending a request to HCS
-func (computeSystem *System) Modify(config interface{}) error {
+// Modify the System by sending a request to HCS
+func (computeSystem *System) Modify(config interface{}) (err error) {
 	computeSystem.handleLock.RLock()
 	computeSystem.handleLock.RLock()
 	defer computeSystem.handleLock.RUnlock()
 	defer computeSystem.handleLock.RUnlock()
-	title := "hcsshim::Modify ID=" + computeSystem.id
+
+	operation := "hcsshim::ComputeSystem::Modify"
+	computeSystem.logOperationBegin(operation)
+	defer func() { computeSystem.logOperationEnd(operation, err) }()
 
 
 	if computeSystem.handle == 0 {
 	if computeSystem.handle == 0 {
 		return makeSystemError(computeSystem, "Modify", "", ErrAlreadyClosed, nil)
 		return makeSystemError(computeSystem, "Modify", "", ErrAlreadyClosed, nil)
@@ -569,17 +699,19 @@ func (computeSystem *System) Modify(config interface{}) error {
 	}
 	}
 
 
 	requestString := string(requestJSON)
 	requestString := string(requestJSON)
-	logrus.Debugf(title + " " + requestString)
+
+	logrus.WithFields(computeSystem.logctx).
+		WithField(logfields.JSON, requestString).
+		Debug("HCS ComputeSystem Modify Document")
 
 
 	var resultp *uint16
 	var resultp *uint16
-	completed := false
-	go syscallWatcher(fmt.Sprintf("ModifyComputeSystem %s: %s", computeSystem.ID(), requestString), &completed)
-	err = hcsModifyComputeSystem(computeSystem.handle, requestString, &resultp)
-	completed = true
+	syscallWatcher(computeSystem.logctx, func() {
+		err = hcsModifyComputeSystem(computeSystem.handle, requestString, &resultp)
+	})
 	events := processHcsResult(resultp)
 	events := processHcsResult(resultp)
 	if err != nil {
 	if err != nil {
 		return makeSystemError(computeSystem, "Modify", requestString, err, events)
 		return makeSystemError(computeSystem, "Modify", requestString, err, events)
 	}
 	}
-	logrus.Debugf(title + " succeeded ")
+
 	return nil
 	return nil
 }
 }

+ 5 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/waithelper.go

@@ -17,6 +17,11 @@ func processAsyncHcsResult(err error, resultp *uint16, callbackNumber uintptr, e
 
 
 func waitForNotification(callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) error {
 func waitForNotification(callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) error {
 	callbackMapLock.RLock()
 	callbackMapLock.RLock()
+	if _, ok := callbackMap[callbackNumber]; !ok {
+		callbackMapLock.RUnlock()
+		logrus.Errorf("failed to waitForNotification: callbackNumber %d does not exist in callbackMap", callbackNumber)
+		return ErrHandleClose
+	}
 	channels := callbackMap[callbackNumber].channels
 	channels := callbackMap[callbackNumber].channels
 	callbackMapLock.RUnlock()
 	callbackMapLock.RUnlock()
 
 

+ 21 - 10
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/watcher.go

@@ -1,8 +1,9 @@
 package hcs
 package hcs
 
 
 import (
 import (
-	"time"
+	"context"
 
 
+	"github.com/Microsoft/hcsshim/internal/logfields"
 	"github.com/Microsoft/hcsshim/internal/timeout"
 	"github.com/Microsoft/hcsshim/internal/timeout"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
 )
 )
@@ -16,15 +17,25 @@ import (
 //
 //
 // Usage is:
 // Usage is:
 //
 //
-// completed := false
-// go syscallWatcher("some description", &completed)
-// <syscall>
-// completed = true
+// syscallWatcher(logContext, func() {
+//    err = <syscall>(args...)
+// })
 //
 //
-func syscallWatcher(description string, syscallCompleted *bool) {
-	time.Sleep(timeout.SyscallWatcher)
-	if *syscallCompleted {
-		return
+
+func syscallWatcher(logContext logrus.Fields, syscallLambda func()) {
+	ctx, cancel := context.WithTimeout(context.Background(), timeout.SyscallWatcher)
+	defer cancel()
+	go watchFunc(ctx, logContext)
+	syscallLambda()
+}
+
+func watchFunc(ctx context.Context, logContext logrus.Fields) {
+	select {
+	case <-ctx.Done():
+		if ctx.Err() != context.Canceled {
+			logrus.WithFields(logContext).
+				WithField(logfields.Timeout, timeout.SyscallWatcher).
+				Warning("Syscall did not complete within operation timeout. This may indicate a platform issue. If it appears to be making no forward progress, obtain the stacks and see if there is a syscall stuck in the platform API for a significant length of time.")
+		}
 	}
 	}
-	logrus.Warnf("%s: Did not complete within %s. This may indicate a platform issue. If it appears to be making no forward progress, obtain the stacks and see is there is a syscall stuck in the platform API for a significant length of time.", description, timeout.SyscallWatcher)
 }
 }

+ 123 - 31
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcs/zsyscall_windows.go

@@ -1,4 +1,4 @@
-// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
+// Code generated mksyscall_windows.exe DO NOT EDIT
 
 
 package hcs
 package hcs
 
 
@@ -6,7 +6,6 @@ import (
 	"syscall"
 	"syscall"
 	"unsafe"
 	"unsafe"
 
 
-	"github.com/Microsoft/hcsshim/internal/interop"
 	"golang.org/x/sys/windows"
 	"golang.org/x/sys/windows"
 )
 )
 
 
@@ -57,12 +56,13 @@ var (
 	procHcsOpenProcess                     = modvmcompute.NewProc("HcsOpenProcess")
 	procHcsOpenProcess                     = modvmcompute.NewProc("HcsOpenProcess")
 	procHcsCloseProcess                    = modvmcompute.NewProc("HcsCloseProcess")
 	procHcsCloseProcess                    = modvmcompute.NewProc("HcsCloseProcess")
 	procHcsTerminateProcess                = modvmcompute.NewProc("HcsTerminateProcess")
 	procHcsTerminateProcess                = modvmcompute.NewProc("HcsTerminateProcess")
-	procHcsGetProcessInfo                  = modvmcompute.NewProc("HcsGetProcessInfo")
-	procHcsGetProcessProperties            = modvmcompute.NewProc("HcsGetProcessProperties")
-	procHcsModifyProcess                   = modvmcompute.NewProc("HcsModifyProcess")
-	procHcsGetServiceProperties            = modvmcompute.NewProc("HcsGetServiceProperties")
-	procHcsRegisterProcessCallback         = modvmcompute.NewProc("HcsRegisterProcessCallback")
-	procHcsUnregisterProcessCallback       = modvmcompute.NewProc("HcsUnregisterProcessCallback")
+
+	procHcsGetProcessInfo            = modvmcompute.NewProc("HcsGetProcessInfo")
+	procHcsGetProcessProperties      = modvmcompute.NewProc("HcsGetProcessProperties")
+	procHcsModifyProcess             = modvmcompute.NewProc("HcsModifyProcess")
+	procHcsGetServiceProperties      = modvmcompute.NewProc("HcsGetServiceProperties")
+	procHcsRegisterProcessCallback   = modvmcompute.NewProc("HcsRegisterProcessCallback")
+	procHcsUnregisterProcessCallback = modvmcompute.NewProc("HcsUnregisterProcessCallback")
 )
 )
 
 
 func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) {
 func hcsEnumerateComputeSystems(query string, computeSystems **uint16, result **uint16) (hr error) {
@@ -80,7 +80,10 @@ func _hcsEnumerateComputeSystems(query *uint16, computeSystems **uint16, result
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsEnumerateComputeSystems.Addr(), 3, uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(computeSystems)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsEnumerateComputeSystems.Addr(), 3, uintptr(unsafe.Pointer(query)), uintptr(unsafe.Pointer(computeSystems)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -105,7 +108,10 @@ func _hcsCreateComputeSystem(id *uint16, configuration *uint16, identity syscall
 	}
 	}
 	r0, _, _ := syscall.Syscall6(procHcsCreateComputeSystem.Addr(), 5, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), uintptr(identity), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)), 0)
 	r0, _, _ := syscall.Syscall6(procHcsCreateComputeSystem.Addr(), 5, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(configuration)), uintptr(identity), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)), 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -125,7 +131,10 @@ func _hcsOpenComputeSystem(id *uint16, computeSystem *hcsSystem, result **uint16
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsOpenComputeSystem.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsOpenComputeSystem.Addr(), 3, uintptr(unsafe.Pointer(id)), uintptr(unsafe.Pointer(computeSystem)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -136,7 +145,10 @@ func hcsCloseComputeSystem(computeSystem hcsSystem) (hr error) {
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsCloseComputeSystem.Addr(), 1, uintptr(computeSystem), 0, 0)
 	r0, _, _ := syscall.Syscall(procHcsCloseComputeSystem.Addr(), 1, uintptr(computeSystem), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -156,7 +168,10 @@ func _hcsStartComputeSystem(computeSystem hcsSystem, options *uint16, result **u
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsStartComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsStartComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -176,7 +191,10 @@ func _hcsShutdownComputeSystem(computeSystem hcsSystem, options *uint16, result
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsShutdownComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsShutdownComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -196,7 +214,10 @@ func _hcsTerminateComputeSystem(computeSystem hcsSystem, options *uint16, result
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsTerminateComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsTerminateComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -216,7 +237,10 @@ func _hcsPauseComputeSystem(computeSystem hcsSystem, options *uint16, result **u
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsPauseComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsPauseComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -236,7 +260,10 @@ func _hcsResumeComputeSystem(computeSystem hcsSystem, options *uint16, result **
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsResumeComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsResumeComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -256,7 +283,10 @@ func _hcsGetComputeSystemProperties(computeSystem hcsSystem, propertyQuery *uint
 	}
 	}
 	r0, _, _ := syscall.Syscall6(procHcsGetComputeSystemProperties.Addr(), 4, uintptr(computeSystem), uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)), 0, 0)
 	r0, _, _ := syscall.Syscall6(procHcsGetComputeSystemProperties.Addr(), 4, uintptr(computeSystem), uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -276,7 +306,10 @@ func _hcsModifyComputeSystem(computeSystem hcsSystem, configuration *uint16, res
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsModifyComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(configuration)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsModifyComputeSystem.Addr(), 3, uintptr(computeSystem), uintptr(unsafe.Pointer(configuration)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -287,7 +320,10 @@ func hcsRegisterComputeSystemCallback(computeSystem hcsSystem, callback uintptr,
 	}
 	}
 	r0, _, _ := syscall.Syscall6(procHcsRegisterComputeSystemCallback.Addr(), 4, uintptr(computeSystem), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
 	r0, _, _ := syscall.Syscall6(procHcsRegisterComputeSystemCallback.Addr(), 4, uintptr(computeSystem), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -298,7 +334,10 @@ func hcsUnregisterComputeSystemCallback(callbackHandle hcsCallback) (hr error) {
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
 	r0, _, _ := syscall.Syscall(procHcsUnregisterComputeSystemCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -318,7 +357,10 @@ func _hcsCreateProcess(computeSystem hcsSystem, processParameters *uint16, proce
 	}
 	}
 	r0, _, _ := syscall.Syscall6(procHcsCreateProcess.Addr(), 5, uintptr(computeSystem), uintptr(unsafe.Pointer(processParameters)), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0)
 	r0, _, _ := syscall.Syscall6(procHcsCreateProcess.Addr(), 5, uintptr(computeSystem), uintptr(unsafe.Pointer(processParameters)), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -329,7 +371,10 @@ func hcsOpenProcess(computeSystem hcsSystem, pid uint32, process *hcsProcess, re
 	}
 	}
 	r0, _, _ := syscall.Syscall6(procHcsOpenProcess.Addr(), 4, uintptr(computeSystem), uintptr(pid), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0, 0)
 	r0, _, _ := syscall.Syscall6(procHcsOpenProcess.Addr(), 4, uintptr(computeSystem), uintptr(pid), uintptr(unsafe.Pointer(process)), uintptr(unsafe.Pointer(result)), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -340,7 +385,10 @@ func hcsCloseProcess(process hcsProcess) (hr error) {
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsCloseProcess.Addr(), 1, uintptr(process), 0, 0)
 	r0, _, _ := syscall.Syscall(procHcsCloseProcess.Addr(), 1, uintptr(process), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -351,7 +399,33 @@ func hcsTerminateProcess(process hcsProcess, result **uint16) (hr error) {
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 2, uintptr(process), uintptr(unsafe.Pointer(result)), 0)
 	r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 2, uintptr(process), uintptr(unsafe.Pointer(result)), 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
+	}
+	return
+}
+
+func hcsSignalProcess(process hcsProcess, options string, result **uint16) (hr error) {
+	var _p0 *uint16
+	_p0, hr = syscall.UTF16PtrFromString(options)
+	if hr != nil {
+		return
+	}
+	return _hcsSignalProcess(process, _p0, result)
+}
+
+func _hcsSignalProcess(process hcsProcess, options *uint16, result **uint16) (hr error) {
+	if hr = procHcsTerminateProcess.Find(); hr != nil {
+		return
+	}
+	r0, _, _ := syscall.Syscall(procHcsTerminateProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(options)), uintptr(unsafe.Pointer(result)))
+	if int32(r0) < 0 {
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -362,7 +436,10 @@ func hcsGetProcessInfo(process hcsProcess, processInformation *hcsProcessInforma
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsGetProcessInfo.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsGetProcessInfo.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processInformation)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -373,7 +450,10 @@ func hcsGetProcessProperties(process hcsProcess, processProperties **uint16, res
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsGetProcessProperties.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processProperties)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsGetProcessProperties.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(processProperties)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -393,7 +473,10 @@ func _hcsModifyProcess(process hcsProcess, settings *uint16, result **uint16) (h
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsModifyProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsModifyProcess.Addr(), 3, uintptr(process), uintptr(unsafe.Pointer(settings)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -413,7 +496,10 @@ func _hcsGetServiceProperties(propertyQuery *uint16, properties **uint16, result
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsGetServiceProperties.Addr(), 3, uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)))
 	r0, _, _ := syscall.Syscall(procHcsGetServiceProperties.Addr(), 3, uintptr(unsafe.Pointer(propertyQuery)), uintptr(unsafe.Pointer(properties)), uintptr(unsafe.Pointer(result)))
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -424,7 +510,10 @@ func hcsRegisterProcessCallback(process hcsProcess, callback uintptr, context ui
 	}
 	}
 	r0, _, _ := syscall.Syscall6(procHcsRegisterProcessCallback.Addr(), 4, uintptr(process), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
 	r0, _, _ := syscall.Syscall6(procHcsRegisterProcessCallback.Addr(), 4, uintptr(process), uintptr(callback), uintptr(context), uintptr(unsafe.Pointer(callbackHandle)), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }
@@ -435,7 +524,10 @@ func hcsUnregisterProcessCallback(callbackHandle hcsCallback) (hr error) {
 	}
 	}
 	r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
 	r0, _, _ := syscall.Syscall(procHcsUnregisterProcessCallback.Addr(), 1, uintptr(callbackHandle), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }

+ 0 - 4
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hcserror/hcserror.go

@@ -36,10 +36,6 @@ func New(err error, title, rest string) error {
 	return &HcsError{title, rest, err}
 	return &HcsError{title, rest, err}
 }
 }
 
 
-func Errorf(err error, title, format string, a ...interface{}) error {
-	return New(err, title, fmt.Sprintf(format, a...))
-}
-
 func Win32FromError(err error) uint32 {
 func Win32FromError(err error) uint32 {
 	if herr, ok := err.(*HcsError); ok {
 	if herr, ok := err.(*HcsError); ok {
 		return Win32FromError(herr.Err)
 		return Win32FromError(herr.Err)

+ 2 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsendpoint.go

@@ -23,7 +23,9 @@ type HNSEndpoint struct {
 	DisableICC         bool              `json:",omitempty"`
 	DisableICC         bool              `json:",omitempty"`
 	PrefixLength       uint8             `json:",omitempty"`
 	PrefixLength       uint8             `json:",omitempty"`
 	IsRemoteEndpoint   bool              `json:",omitempty"`
 	IsRemoteEndpoint   bool              `json:",omitempty"`
+	EnableLowMetric    bool              `json:",omitempty"`
 	Namespace          *Namespace        `json:",omitempty"`
 	Namespace          *Namespace        `json:",omitempty"`
+	EncapOverhead      uint16            `json:",omitempty"`
 }
 }
 
 
 //SystemType represents the type of the system on which actions are done
 //SystemType represents the type of the system on which actions are done

+ 8 - 2
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go

@@ -2,9 +2,9 @@ package hns
 
 
 import (
 import (
 	"encoding/json"
 	"encoding/json"
-	"net"
-
+	"errors"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
+	"net"
 )
 )
 
 
 // Subnet is assoicated with a network and represents a list
 // Subnet is assoicated with a network and represents a list
@@ -98,6 +98,12 @@ func (network *HNSNetwork) Create() (*HNSNetwork, error) {
 	title := "hcsshim::HNSNetwork::" + operation
 	title := "hcsshim::HNSNetwork::" + operation
 	logrus.Debugf(title+" id=%s", network.Id)
 	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)
 	jsonString, err := json.Marshal(network)
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err

+ 1 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/hnspolicylist.go

@@ -20,6 +20,7 @@ type ELBPolicy struct {
 	SourceVIP string   `json:"SourceVIP,omitempty"`
 	SourceVIP string   `json:"SourceVIP,omitempty"`
 	VIPs      []string `json:"VIPs,omitempty"`
 	VIPs      []string `json:"VIPs,omitempty"`
 	ILB       bool     `json:"ILB,omitempty"`
 	ILB       bool     `json:"ILB,omitempty"`
+	DSR       bool     `json:"IsDSR,omitempty"`
 }
 }
 
 
 // LBPolicy is a structure defining schema for LoadBalancing based Policy
 // LBPolicy is a structure defining schema for LoadBalancing based Policy

+ 5 - 3
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/hns/zsyscall_windows.go

@@ -1,4 +1,4 @@
-// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT
+// Code generated mksyscall_windows.exe DO NOT EDIT
 
 
 package hns
 package hns
 
 
@@ -6,7 +6,6 @@ import (
 	"syscall"
 	"syscall"
 	"unsafe"
 	"unsafe"
 
 
-	"github.com/Microsoft/hcsshim/internal/interop"
 	"golang.org/x/sys/windows"
 	"golang.org/x/sys/windows"
 )
 )
 
 
@@ -68,7 +67,10 @@ func __hnsCall(method *uint16, path *uint16, object *uint16, response **uint16)
 	}
 	}
 	r0, _, _ := syscall.Syscall6(procHNSCall.Addr(), 4, uintptr(unsafe.Pointer(method)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(object)), uintptr(unsafe.Pointer(response)), 0, 0)
 	r0, _, _ := syscall.Syscall6(procHNSCall.Addr(), 4, uintptr(unsafe.Pointer(method)), uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(object)), uintptr(unsafe.Pointer(response)), 0, 0)
 	if int32(r0) < 0 {
 	if int32(r0) < 0 {
-		hr = interop.Win32FromHresult(r0)
+		if r0&0x1fff0000 == 0x00070000 {
+			r0 &= 0xffff
+		}
+		hr = syscall.Errno(r0)
 	}
 	}
 	return
 	return
 }
 }

+ 2 - 2
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/interop/interop.go

@@ -5,9 +5,9 @@ import (
 	"unsafe"
 	"unsafe"
 )
 )
 
 
-//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go interop.go
+//go:generate go run ../../mksyscall_windows.go -output zsyscall_windows.go interop.go
 
 
-//sys coTaskMemFree(buffer unsafe.Pointer) = ole32.CoTaskMemFree
+//sys coTaskMemFree(buffer unsafe.Pointer) = api_ms_win_core_com_l1_1_0.CoTaskMemFree
 
 
 func ConvertAndFreeCoTaskMemString(buffer *uint16) string {
 func ConvertAndFreeCoTaskMemString(buffer *uint16) string {
 	str := syscall.UTF16ToString((*[1 << 29]uint16)(unsafe.Pointer(buffer))[:])
 	str := syscall.UTF16ToString((*[1 << 29]uint16)(unsafe.Pointer(buffer))[:])

+ 3 - 3
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/interop/zsyscall_windows.go

@@ -1,4 +1,4 @@
-// Code generated by 'go generate'; DO NOT EDIT.
+// Code generated mksyscall_windows.exe DO NOT EDIT
 
 
 package interop
 package interop
 
 
@@ -37,9 +37,9 @@ func errnoErr(e syscall.Errno) error {
 }
 }
 
 
 var (
 var (
-	modole32 = windows.NewLazySystemDLL("ole32.dll")
+	modapi_ms_win_core_com_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-com-l1-1-0.dll")
 
 
-	procCoTaskMemFree = modole32.NewProc("CoTaskMemFree")
+	procCoTaskMemFree = modapi_ms_win_core_com_l1_1_0.NewProc("CoTaskMemFree")
 )
 )
 
 
 func coTaskMemFree(buffer unsafe.Pointer) {
 func coTaskMemFree(buffer unsafe.Pointer) {

+ 32 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/logfields/fields.go

@@ -0,0 +1,32 @@
+package logfields
+
+const (
+	// Identifiers
+
+	ContainerID = "cid"
+	UVMID       = "uvm-id"
+	ProcessID   = "pid"
+
+	// Common Misc
+
+	// Timeout represents an operation timeout.
+	Timeout = "timeout"
+	JSON    = "json"
+
+	// Keys/values
+
+	Field         = "field"
+	OCIAnnotation = "oci-annotation"
+	Value         = "value"
+
+	// Golang type's
+
+	ExpectedType = "expected-type"
+	Bool         = "bool"
+	Uint32       = "uint32"
+	Uint64       = "uint64"
+
+	// runhcs
+
+	VMShimOperation = "vmshim-op"
+)

+ 1 - 1
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/safefile/safeopen.go

@@ -87,7 +87,7 @@ func OpenRoot(path string) (*os.File, error) {
 
 
 func ntRelativePath(path string) ([]uint16, error) {
 func ntRelativePath(path string) ([]uint16, error) {
 	path = filepath.Clean(path)
 	path = filepath.Clean(path)
-	if strings.Contains(":", path) {
+	if strings.Contains(path, ":") {
 		// Since alternate data streams must follow the file they
 		// Since alternate data streams must follow the file they
 		// are attached to, finding one here (out of order) is invalid.
 		// are attached to, finding one here (out of order) is invalid.
 		return nil, errors.New("path contains invalid character `:`")
 		return nil, errors.New("path contains invalid character `:`")

+ 20 - 3
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema1/schema1.go

@@ -3,6 +3,8 @@ package schema1
 import (
 import (
 	"encoding/json"
 	"encoding/json"
 	"time"
 	"time"
+
+	"github.com/Microsoft/hcsshim/internal/schema2"
 )
 )
 
 
 // ProcessConfig is used as both the input of Container.CreateProcess
 // ProcessConfig is used as both the input of Container.CreateProcess
@@ -115,9 +117,10 @@ type ComputeSystemQuery struct {
 type PropertyType string
 type PropertyType string
 
 
 const (
 const (
-	PropertyTypeStatistics        PropertyType = "Statistics"
-	PropertyTypeProcessList                    = "ProcessList"
-	PropertyTypeMappedVirtualDisk              = "MappedVirtualDisk"
+	PropertyTypeStatistics        PropertyType = "Statistics"        // V1 and V2
+	PropertyTypeProcessList                    = "ProcessList"       // V1 and V2
+	PropertyTypeMappedVirtualDisk              = "MappedVirtualDisk" // Not supported in V2 schema call
+	PropertyTypeGuestConnection                = "GuestConnection"   // V1 and V2. Nil return from HCS before RS5
 )
 )
 
 
 type PropertyQuery struct {
 type PropertyQuery struct {
@@ -142,6 +145,7 @@ type ContainerProperties struct {
 	Statistics                   Statistics                          `json:",omitempty"`
 	Statistics                   Statistics                          `json:",omitempty"`
 	ProcessList                  []ProcessListItem                   `json:",omitempty"`
 	ProcessList                  []ProcessListItem                   `json:",omitempty"`
 	MappedVirtualDiskControllers map[int]MappedVirtualDiskController `json:",omitempty"`
 	MappedVirtualDiskControllers map[int]MappedVirtualDiskController `json:",omitempty"`
+	GuestConnectionInfo          GuestConnectionInfo                 `json:",omitempty"`
 }
 }
 
 
 // MemoryStats holds the memory statistics for a container
 // MemoryStats holds the memory statistics for a container
@@ -206,6 +210,19 @@ type MappedVirtualDiskController struct {
 	MappedVirtualDisks map[int]MappedVirtualDisk `json:",omitempty"`
 	MappedVirtualDisks map[int]MappedVirtualDisk `json:",omitempty"`
 }
 }
 
 
+// GuestDefinedCapabilities is part of the GuestConnectionInfo returned by a GuestConnection call on a utility VM
+type GuestDefinedCapabilities struct {
+	NamespaceAddRequestSupported bool `json:",omitempty"`
+	SignalProcessSupported       bool `json:",omitempty"`
+}
+
+// GuestConnectionInfo is the structure of an iterm return by a GuestConnection call on a utility VM
+type GuestConnectionInfo struct {
+	SupportedSchemaVersions  []hcsschema.Version      `json:",omitempty"`
+	ProtocolVersion          uint32                   `json:",omitempty"`
+	GuestDefinedCapabilities GuestDefinedCapabilities `json:",omitempty"`
+}
+
 // Type of Request Support in ModifySystem
 // Type of Request Support in ModifySystem
 type RequestType string
 type RequestType string
 
 

+ 31 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/attachment.go

@@ -0,0 +1,31 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Attachment struct {
+
+	Type_ string `json:"Type,omitempty"`
+
+	Path string `json:"Path,omitempty"`
+
+	IgnoreFlushes bool `json:"IgnoreFlushes,omitempty"`
+
+	CachingMode string `json:"CachingMode,omitempty"`
+
+	NoWriteHardening bool `json:"NoWriteHardening,omitempty"`
+
+	DisableExpansionOptimization bool `json:"DisableExpansionOptimization,omitempty"`
+
+	IgnoreRelativeLocator bool `json:"IgnoreRelativeLocator,omitempty"`
+
+	CaptureIoAttributionContext bool `json:"CaptureIoAttributionContext,omitempty"`
+
+	ReadOnly bool `json:"ReadOnly,omitempty"`
+}

+ 13 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/battery.go

@@ -0,0 +1,13 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Battery struct {
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/cache_query_stats_response.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type CacheQueryStatsResponse struct {
+
+	L3OccupancyBytes int32 `json:"L3OccupancyBytes,omitempty"`
+
+	L3TotalBwBytes int32 `json:"L3TotalBwBytes,omitempty"`
+
+	L3LocalBwBytes int32 `json:"L3LocalBwBytes,omitempty"`
+}

+ 27 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/chipset.go

@@ -0,0 +1,27 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Chipset struct {
+	Uefi *Uefi `json:"Uefi,omitempty"`
+
+	IsNumLockDisabled bool `json:"IsNumLockDisabled,omitempty"`
+
+	BaseBoardSerialNumber string `json:"BaseBoardSerialNumber,omitempty"`
+
+	ChassisSerialNumber string `json:"ChassisSerialNumber,omitempty"`
+
+	ChassisAssetTag string `json:"ChassisAssetTag,omitempty"`
+
+	UseUtc bool `json:"UseUtc,omitempty"`
+
+	// LinuxKernelDirect - Added in v2.2 Builds >=181117
+	LinuxKernelDirect *LinuxKernelDirect `json:"LinuxKernelDirect,omitempty"`
+}

+ 15 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/close_handle.go

@@ -0,0 +1,15 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type CloseHandle struct {
+
+	Handle string `json:"Handle,omitempty"`
+}

+ 18 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/com_port.go

@@ -0,0 +1,18 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  ComPort specifies the named pipe that will be used for the port, with empty string indicating a disconnected port.
+type ComPort struct {
+
+	NamedPipe string `json:"NamedPipe,omitempty"`
+
+	OptimizeForDebugger bool `json:"OptimizeForDebugger,omitempty"`
+}

+ 27 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/compute_system.go

@@ -0,0 +1,27 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type ComputeSystem struct {
+
+	Owner string `json:"Owner,omitempty"`
+
+	SchemaVersion *Version `json:"SchemaVersion,omitempty"`
+
+	HostingSystemId string `json:"HostingSystemId,omitempty"`
+
+	HostedSystem *HostedSystem `json:"HostedSystem,omitempty"`
+
+	Container *Container `json:"Container,omitempty"`
+
+	VirtualMachine *VirtualMachine `json:"VirtualMachine,omitempty"`
+
+	ShouldTerminateOnLastHandleClosed bool `json:"ShouldTerminateOnLastHandleClosed,omitempty"`
+}

+ 72 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/configuration.go

@@ -0,0 +1,72 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+import (
+	"net/http"
+)
+
+// contextKeys are used to identify the type of value in the context.
+// Since these are string, it is possible to get a short description of the
+// context key for logging and debugging using key.String().
+
+type contextKey string
+
+func (c contextKey) String() string {
+	return "auth " + string(c)
+}
+
+var (
+	// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
+	ContextOAuth2    	= contextKey("token")
+
+	// ContextBasicAuth takes BasicAuth as authentication for the request.
+	ContextBasicAuth 	= contextKey("basic")
+
+	// ContextAccessToken takes a string oauth2 access token as authentication for the request.
+	ContextAccessToken 	= contextKey("accesstoken")
+
+	// ContextAPIKey takes an APIKey as authentication for the request
+ 	ContextAPIKey 		= contextKey("apikey")
+)
+
+// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth 
+type BasicAuth struct {
+	UserName      string            `json:"userName,omitempty"`
+	Password      string            `json:"password,omitempty"`	
+}
+
+// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
+type APIKey struct {
+	Key 	string
+	Prefix	string
+}
+
+type Configuration struct {
+	BasePath      string            	`json:"basePath,omitempty"`
+	Host          string            	`json:"host,omitempty"`
+	Scheme        string            	`json:"scheme,omitempty"`
+	DefaultHeader map[string]string 	`json:"defaultHeader,omitempty"`
+	UserAgent     string            	`json:"userAgent,omitempty"`
+	HTTPClient 	  *http.Client
+}
+
+func NewConfiguration() *Configuration {
+	cfg := &Configuration{
+		BasePath:      "https://localhost",
+		DefaultHeader: make(map[string]string),
+		UserAgent:     "Swagger-Codegen/2.1.0/go",
+	}
+	return cfg
+}
+
+func (c *Configuration) AddDefaultHeader(key string, value string) {
+	c.DefaultHeader[key] = value
+}

+ 17 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/console_size.go

@@ -0,0 +1,17 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type ConsoleSize struct {
+
+	Height int32 `json:"Height,omitempty"`
+
+	Width int32 `json:"Width,omitempty"`
+}

+ 35 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/container.go

@@ -0,0 +1,35 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Container struct {
+
+	GuestOs *GuestOs `json:"GuestOs,omitempty"`
+
+	Storage *Storage `json:"Storage,omitempty"`
+
+	MappedDirectories []MappedDirectory `json:"MappedDirectories,omitempty"`
+
+	MappedPipes []MappedPipe `json:"MappedPipes,omitempty"`
+
+	Memory *Memory `json:"Memory,omitempty"`
+
+	Processor *Processor `json:"Processor,omitempty"`
+
+	Networking *Networking `json:"Networking,omitempty"`
+
+	HvSocket *HvSocket `json:"HvSocket,omitempty"`
+
+	ContainerCredentialGuard *ContainerCredentialGuardState `json:"ContainerCredentialGuard,omitempty"`
+
+	RegistryChanges *RegistryChanges `json:"RegistryChanges,omitempty"`
+
+	AssignedDevices []Device `json:"AssignedDevices,omitempty"`
+}

+ 25 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/container_credential_guard_state.go

@@ -0,0 +1,25 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type ContainerCredentialGuardState struct {
+
+	//  Authentication cookie for calls to a Container Credential Guard instance.
+	Cookie string `json:"Cookie,omitempty"`
+
+	//  Name of the RPC endpoint of the Container Credential Guard instance.
+	RpcEndpoint string `json:"RpcEndpoint,omitempty"`
+
+	//  Transport used for the configured Container Credential Guard instance.
+	Transport string `json:"Transport,omitempty"`
+
+	//  Credential spec used for the configured Container Credential Guard instance.
+	CredentialSpec string `json:"CredentialSpec,omitempty"`
+}

+ 26 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/container_memory_information.go

@@ -0,0 +1,26 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  memory usage as viewed from within the container
+type ContainerMemoryInformation struct {
+
+	TotalPhysicalBytes int32 `json:"TotalPhysicalBytes,omitempty"`
+
+	TotalUsage int32 `json:"TotalUsage,omitempty"`
+
+	CommittedBytes int32 `json:"CommittedBytes,omitempty"`
+
+	SharedCommittedBytes int32 `json:"SharedCommittedBytes,omitempty"`
+
+	CommitLimitBytes int32 `json:"CommitLimitBytes,omitempty"`
+
+	PeakCommitmentBytes int32 `json:"PeakCommitmentBytes,omitempty"`
+}

+ 16 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/device.go

@@ -0,0 +1,16 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Device struct {
+
+	//  The interface class guid of the device to assign to container.
+	InterfaceClassGuid string `json:"InterfaceClassGuid,omitempty"`
+}

+ 43 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/devices.go

@@ -0,0 +1,43 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Devices struct {
+
+	ComPorts map[string]ComPort `json:"ComPorts,omitempty"`
+
+	Scsi map[string]Scsi `json:"Scsi,omitempty"`
+
+	VirtualPMem *VirtualPMemController `json:"VirtualPMem,omitempty"`
+
+	NetworkAdapters map[string]NetworkAdapter `json:"NetworkAdapters,omitempty"`
+
+	VideoMonitor *VideoMonitor `json:"VideoMonitor,omitempty"`
+
+	Keyboard *Keyboard `json:"Keyboard,omitempty"`
+
+	Mouse *Mouse `json:"Mouse,omitempty"`
+
+	HvSocket *HvSocket2 `json:"HvSocket,omitempty"`
+
+	EnhancedModeVideo *EnhancedModeVideo `json:"EnhancedModeVideo,omitempty"`
+
+	GuestCrashReporting *GuestCrashReporting `json:"GuestCrashReporting,omitempty"`
+
+	VirtualSmb *VirtualSmb `json:"VirtualSmb,omitempty"`
+
+	Plan9 *Plan9 `json:"Plan9,omitempty"`
+
+	Battery *Battery `json:"Battery,omitempty"`
+
+	FlexibleIov map[string]FlexibleIoDevice `json:"FlexibleIov,omitempty"`
+
+	SharedMemory *SharedMemoryConfiguration `json:"SharedMemory,omitempty"`
+}

+ 15 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/enhanced_mode_video.go

@@ -0,0 +1,15 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type EnhancedModeVideo struct {
+
+	ConnectionOptions *RdpConnectionOptions `json:"ConnectionOptions,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/flexible_io_device.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type FlexibleIoDevice struct {
+
+	EmulatorId string `json:"EmulatorId,omitempty"`
+
+	HostingModel string `json:"HostingModel,omitempty"`
+
+	Configuration []string `json:"Configuration,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_connection.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type GuestConnection struct {
+
+	//  Use Vsock rather than Hyper-V sockets to communicate with the guest service.
+	UseVsock bool `json:"UseVsock,omitempty"`
+
+	//  Don't disconnect the guest connection when pausing the virtual machine.
+	UseConnectedSuspend bool `json:"UseConnectedSuspend,omitempty"`
+}

+ 21 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_connection_info.go

@@ -0,0 +1,21 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  Information about the guest.
+type GuestConnectionInfo struct {
+
+	//  Each schema version x.y stands for the range of versions a.b where a==x  and b<=y. This list comes from the SupportedSchemaVersions field in  GcsCapabilities.
+	SupportedSchemaVersions []Version `json:"SupportedSchemaVersions,omitempty"`
+
+	ProtocolVersion int32 `json:"ProtocolVersion,omitempty"`
+
+	GuestDefinedCapabilities *interface{} `json:"GuestDefinedCapabilities,omitempty"`
+}

+ 15 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_crash_reporting.go

@@ -0,0 +1,15 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type GuestCrashReporting struct {
+
+	WindowsCrashSettings *WindowsCrashReporting `json:"WindowsCrashSettings,omitempty"`
+}

+ 15 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_os.go

@@ -0,0 +1,15 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type GuestOs struct {
+
+	HostName string `json:"HostName,omitempty"`
+}

+ 22 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/guest_state.go

@@ -0,0 +1,22 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type GuestState struct {
+
+	//  The path to an existing file uses for persistent guest state storage.  An empty string indicates the system should initialize new transient, in-memory guest state.
+	GuestStateFilePath string `json:"GuestStateFilePath,omitempty"`
+
+	//  The path to an existing file for persistent runtime state storage.  An empty string indicates the system should initialize new transient, in-memory runtime state.
+	RuntimeStateFilePath string `json:"RuntimeStateFilePath,omitempty"`
+
+	//  If true, the guest state and runtime state files will be used as templates  to populate transient, in-memory state instead of using the files as persistent backing store.
+	ForceTransientState bool `json:"ForceTransientState,omitempty"`
+}

+ 17 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hosted_system.go

@@ -0,0 +1,17 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type HostedSystem struct {
+
+	SchemaVersion *Version `json:"SchemaVersion,omitempty"`
+
+	Container *Container `json:"Container,omitempty"`
+}

+ 17 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket.go

@@ -0,0 +1,17 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type HvSocket struct {
+
+	Config *HvSocketSystemConfig `json:"Config,omitempty"`
+
+	EnablePowerShellDirect bool `json:"EnablePowerShellDirect,omitempty"`
+}

+ 16 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket_2.go

@@ -0,0 +1,16 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  HvSocket configuration for a VM
+type HvSocket2 struct {
+
+	HvSocketConfig *HvSocketSystemConfig `json:"HvSocketConfig,omitempty"`
+}

+ 22 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket_service_config.go

@@ -0,0 +1,22 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type HvSocketServiceConfig struct {
+
+	//  SDDL string that HvSocket will check before allowing a host process to bind  to this specific service.  If not specified, defaults to the system DefaultBindSecurityDescriptor, defined in  HvSocketSystemWpConfig in V1.
+	BindSecurityDescriptor string `json:"BindSecurityDescriptor,omitempty"`
+
+	//  SDDL string that HvSocket will check before allowing a host process to connect  to this specific service.  If not specified, defaults to the system DefaultConnectSecurityDescriptor, defined in  HvSocketSystemWpConfig in V1.
+	ConnectSecurityDescriptor string `json:"ConnectSecurityDescriptor,omitempty"`
+
+	//  If true, HvSocket will process wildcard binds for this service/system combination.  Wildcard binds are secured in the registry at  SOFTWARE/Microsoft/Windows NT/CurrentVersion/Virtualization/HvSocket/WildcardDescriptors
+	AllowWildcardBinds bool `json:"AllowWildcardBinds,omitempty"`
+}

+ 22 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/hv_socket_system_config.go

@@ -0,0 +1,22 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  This is the HCS Schema version of the HvSocket configuration. The VMWP version is  located in Config.Devices.IC in V1.
+type HvSocketSystemConfig struct {
+
+	//  SDDL string that HvSocket will check before allowing a host process to bind  to an unlisted service for this specific container/VM (not wildcard binds).
+	DefaultBindSecurityDescriptor string `json:"DefaultBindSecurityDescriptor,omitempty"`
+
+	//  SDDL string that HvSocket will check before allowing a host process to connect  to an unlisted service in the VM/container.
+	DefaultConnectSecurityDescriptor string `json:"DefaultConnectSecurityDescriptor,omitempty"`
+
+	ServiceTable map[string]HvSocketServiceConfig `json:"ServiceTable,omitempty"`
+}

+ 13 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/keyboard.go

@@ -0,0 +1,13 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Keyboard struct {
+}

+ 22 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/layer.go

@@ -0,0 +1,22 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Layer struct {
+
+	Id string `json:"Id,omitempty"`
+
+	Path string `json:"Path,omitempty"`
+
+	PathType string `json:"PathType,omitempty"`
+
+	//  Unspecified defaults to Enabled
+	Cache string `json:"Cache,omitempty"`
+}

+ 18 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/linux_kernel_direct.go

@@ -0,0 +1,18 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.2
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type LinuxKernelDirect struct {
+	KernelFilePath string `json:"KernelFilePath,omitempty"`
+
+	InitRdPath string `json:"InitRdPath,omitempty"`
+
+	KernelCmdLine string `json:"KernelCmdLine,omitempty"`
+}

+ 21 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/mapped_directory.go

@@ -0,0 +1,21 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type MappedDirectory struct {
+
+	HostPath string `json:"HostPath,omitempty"`
+
+	HostPathType string `json:"HostPathType,omitempty"`
+
+	ContainerPath string `json:"ContainerPath,omitempty"`
+
+	ReadOnly bool `json:"ReadOnly,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/mapped_pipe.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type MappedPipe struct {
+
+	ContainerPipeName string `json:"ContainerPipeName,omitempty"`
+
+	HostPath string `json:"HostPath,omitempty"`
+
+	HostPathType string `json:"HostPathType,omitempty"`
+}

+ 15 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory.go

@@ -0,0 +1,15 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Memory struct {
+
+	SizeInMB int32 `json:"SizeInMB,omitempty"`
+}

+ 25 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_2.go

@@ -0,0 +1,25 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Memory2 struct {
+	SizeInMB int32 `json:"SizeInMB,omitempty"`
+
+	AllowOvercommit bool `json:"AllowOvercommit,omitempty"`
+
+	EnableHotHint bool `json:"EnableHotHint,omitempty"`
+
+	EnableColdHint bool `json:"EnableColdHint,omitempty"`
+
+	EnableEpf bool `json:"EnableEpf,omitempty"`
+
+	// EnableDeferredCommit is private in the schema. If regenerated need to add back.
+	EnableDeferredCommit bool `json:"EnableDeferredCommit,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_information_for_vm.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type MemoryInformationForVm struct {
+
+	VirtualNodeCount int32 `json:"VirtualNodeCount,omitempty"`
+
+	VirtualMachineMemory *VmMemory `json:"VirtualMachineMemory,omitempty"`
+
+	VirtualNodes []VirtualNodeInfo `json:"VirtualNodes,omitempty"`
+}

+ 20 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/memory_stats.go

@@ -0,0 +1,20 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  Memory runtime statistics
+type MemoryStats struct {
+
+	MemoryUsageCommitBytes int32 `json:"MemoryUsageCommitBytes,omitempty"`
+
+	MemoryUsageCommitPeakBytes int32 `json:"MemoryUsageCommitPeakBytes,omitempty"`
+
+	MemoryUsagePrivateWorkingSetBytes int32 `json:"MemoryUsagePrivateWorkingSetBytes,omitempty"`
+}

+ 20 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/modify_setting_request.go

@@ -0,0 +1,20 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type ModifySettingRequest struct {
+	ResourcePath string `json:"ResourcePath,omitempty"`
+
+	RequestType string `json:"RequestType,omitempty"`
+
+	Settings interface{} `json:"Settings,omitempty"` // NOTE: Swagger generated as *interface{}. Locally updated
+
+	GuestRequest interface{} `json:"GuestRequest,omitempty"` // NOTE: Swagger generated as *interface{}. Locally updated
+}

+ 13 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/mouse.go

@@ -0,0 +1,13 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Mouse struct {
+}

+ 17 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/network_adapter.go

@@ -0,0 +1,17 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type NetworkAdapter struct {
+
+	EndpointId string `json:"EndpointId,omitempty"`
+
+	MacAddress string `json:"MacAddress,omitempty"`
+}

+ 24 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/networking.go

@@ -0,0 +1,24 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Networking struct {
+
+	AllowUnqualifiedDnsQuery bool `json:"AllowUnqualifiedDnsQuery,omitempty"`
+
+	DnsSearchList string `json:"DnsSearchList,omitempty"`
+
+	NetworkSharedContainerName string `json:"NetworkSharedContainerName,omitempty"`
+
+	//  Guid in windows; string in linux
+	Namespace string `json:"Namespace,omitempty"`
+
+	NetworkAdapters []string `json:"NetworkAdapters,omitempty"`
+}

+ 16 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/pause_notification.go

@@ -0,0 +1,16 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  Notification data that is indicated to components running in the Virtual Machine.
+type PauseNotification struct {
+
+	Reason string `json:"Reason,omitempty"`
+}

+ 18 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/pause_options.go

@@ -0,0 +1,18 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  Options for HcsPauseComputeSystem
+type PauseOptions struct {
+
+	SuspensionLevel string `json:"SuspensionLevel,omitempty"`
+
+	HostedNotification *PauseNotification `json:"HostedNotification,omitempty"`
+}

+ 15 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/plan9.go

@@ -0,0 +1,15 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Plan9 struct {
+
+	Shares []Plan9Share `json:"Shares,omitempty"`
+}

+ 34 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/plan9_share.go

@@ -0,0 +1,34 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Plan9Share struct {
+	Name string `json:"Name,omitempty"`
+
+	//  The name by which the guest operation system can access this share, via  the aname parameter in the Plan9 protocol.
+	AccessName string `json:"AccessName,omitempty"`
+
+	Path string `json:"Path,omitempty"`
+
+	Port int32 `json:"Port,omitempty"`
+
+	// Flags are marked private. Until they are exported correctly
+	//
+	// ReadOnly      0x00000001
+	// LinuxMetadata 0x00000004
+	// CaseSensitive 0x00000008
+	Flags int32 `json:"Flags,omitempty"`
+
+	ReadOnly bool `json:"ReadOnly,omitempty"`
+
+	UseShareRootIdentity bool `json:"UseShareRootIdentity,omitempty"`
+
+	AllowedFiles []string `json:"AllowedFiles,omitempty"`
+}

+ 34 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_details.go

@@ -0,0 +1,34 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+import (
+	"time"
+)
+
+//  Information about a process running in a container
+type ProcessDetails struct {
+
+	ProcessId int32 `json:"ProcessId,omitempty"`
+
+	ImageName string `json:"ImageName,omitempty"`
+
+	CreateTimestamp time.Time `json:"CreateTimestamp,omitempty"`
+
+	UserTime100ns int32 `json:"UserTime100ns,omitempty"`
+
+	KernelTime100ns int32 `json:"KernelTime100ns,omitempty"`
+
+	MemoryCommitBytes int32 `json:"MemoryCommitBytes,omitempty"`
+
+	MemoryWorkingSetPrivateBytes int32 `json:"MemoryWorkingSetPrivateBytes,omitempty"`
+
+	MemoryWorkingSetSharedBytes int32 `json:"MemoryWorkingSetSharedBytes,omitempty"`
+}

+ 20 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_modify_request.go

@@ -0,0 +1,20 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  Passed to HcsRpc_ModifyProcess
+type ProcessModifyRequest struct {
+
+	Operation string `json:"Operation,omitempty"`
+
+	ConsoleSize *ConsoleSize `json:"ConsoleSize,omitempty"`
+
+	CloseHandle *CloseHandle `json:"CloseHandle,omitempty"`
+}

+ 47 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_parameters.go

@@ -0,0 +1,47 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type ProcessParameters struct {
+
+	ApplicationName string `json:"ApplicationName,omitempty"`
+
+	CommandLine string `json:"CommandLine,omitempty"`
+
+	//  optional alternative to CommandLine, currently only supported by Linux GCS
+	CommandArgs []string `json:"CommandArgs,omitempty"`
+
+	User string `json:"User,omitempty"`
+
+	WorkingDirectory string `json:"WorkingDirectory,omitempty"`
+
+	Environment map[string]string `json:"Environment,omitempty"`
+
+	//  if set, will run as low-privilege process
+	RestrictedToken bool `json:"RestrictedToken,omitempty"`
+
+	//  if set, ignore StdErrPipe
+	EmulateConsole bool `json:"EmulateConsole,omitempty"`
+
+	CreateStdInPipe bool `json:"CreateStdInPipe,omitempty"`
+
+	CreateStdOutPipe bool `json:"CreateStdOutPipe,omitempty"`
+
+	CreateStdErrPipe bool `json:"CreateStdErrPipe,omitempty"`
+
+	//  height then width
+	ConsoleSize []int32 `json:"ConsoleSize,omitempty"`
+
+	//  if set, find an existing session for the user and create the process in it
+	UseExistingLogin bool `json:"UseExistingLogin,omitempty"`
+
+	//  if set, use the legacy console instead of conhost
+	UseLegacyConsole bool `json:"UseLegacyConsole,omitempty"`
+}

+ 22 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/process_status.go

@@ -0,0 +1,22 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  Status of a process running in a container
+type ProcessStatus struct {
+
+	ProcessId int32 `json:"ProcessId,omitempty"`
+
+	Exited bool `json:"Exited,omitempty"`
+
+	ExitCode int32 `json:"ExitCode,omitempty"`
+
+	LastWaitResult int32 `json:"LastWaitResult,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/processor.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Processor struct {
+
+	Count int32 `json:"Count,omitempty"`
+
+	Maximum int32 `json:"Maximum,omitempty"`
+
+	Weight int32 `json:"Weight,omitempty"`
+}

+ 21 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/processor_2.go

@@ -0,0 +1,21 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Processor2 struct {
+
+	Count int32 `json:"Count,omitempty"`
+
+	Limit int32 `json:"Limit,omitempty"`
+
+	Weight int32 `json:"Weight,omitempty"`
+
+	ExposeVirtualizationExtensions bool `json:"ExposeVirtualizationExtensions,omitempty"`
+}

+ 20 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/processor_stats.go

@@ -0,0 +1,20 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//  CPU runtime statistics
+type ProcessorStats struct {
+
+	TotalRuntime100ns int32 `json:"TotalRuntime100ns,omitempty"`
+
+	RuntimeUser100ns int32 `json:"RuntimeUser100ns,omitempty"`
+
+	RuntimeKernel100ns int32 `json:"RuntimeKernel100ns,omitempty"`
+}

+ 47 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/properties.go

@@ -0,0 +1,47 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Properties struct {
+
+	Id string `json:"Id,omitempty"`
+
+	SystemType string `json:"SystemType,omitempty"`
+
+	RuntimeOsType string `json:"RuntimeOsType,omitempty"`
+
+	Name string `json:"Name,omitempty"`
+
+	Owner string `json:"Owner,omitempty"`
+
+	RuntimeId string `json:"RuntimeId,omitempty"`
+
+	RuntimeTemplateId string `json:"RuntimeTemplateId,omitempty"`
+
+	State string `json:"State,omitempty"`
+
+	Stopped bool `json:"Stopped,omitempty"`
+
+	ExitType string `json:"ExitType,omitempty"`
+
+	Memory *MemoryInformationForVm `json:"Memory,omitempty"`
+
+	Statistics *Statistics `json:"Statistics,omitempty"`
+
+	ProcessList []ProcessDetails `json:"ProcessList,omitempty"`
+
+	TerminateOnLastHandleClosed bool `json:"TerminateOnLastHandleClosed,omitempty"`
+
+	HostingSystemId string `json:"HostingSystemId,omitempty"`
+
+	SharedMemoryRegionInfo []SharedMemoryRegionInfo `json:"SharedMemoryRegionInfo,omitempty"`
+
+	GuestConnectionInfo *GuestConnectionInfo `json:"GuestConnectionInfo,omitempty"`
+}

+ 16 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/property_query.go

@@ -0,0 +1,16 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+//   By default the basic properties will be returned. This query provides a way to  request specific properties. 
+type PropertyQuery struct {
+
+	PropertyTypes []string `json:"PropertyTypes,omitempty"`
+}

+ 17 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/rdp_connection_options.go

@@ -0,0 +1,17 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type RdpConnectionOptions struct {
+
+	AccessSids []string `json:"AccessSids,omitempty"`
+
+	NamedPipe string `json:"NamedPipe,omitempty"`
+}

+ 17 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/registry_changes.go

@@ -0,0 +1,17 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type RegistryChanges struct {
+
+	AddValues []RegistryValue `json:"AddValues,omitempty"`
+
+	DeleteKeys []RegistryKey `json:"DeleteKeys,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/registry_key.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type RegistryKey struct {
+
+	Hive string `json:"Hive,omitempty"`
+
+	Name string `json:"Name,omitempty"`
+
+	Volatile bool `json:"Volatile,omitempty"`
+}

+ 31 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/registry_value.go

@@ -0,0 +1,31 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type RegistryValue struct {
+
+	Key *RegistryKey `json:"Key,omitempty"`
+
+	Name string `json:"Name,omitempty"`
+
+	Type_ string `json:"Type,omitempty"`
+
+	//  One and only one value type must be set.
+	StringValue string `json:"StringValue,omitempty"`
+
+	BinaryValue string `json:"BinaryValue,omitempty"`
+
+	DWordValue int32 `json:"DWordValue,omitempty"`
+
+	QWordValue int32 `json:"QWordValue,omitempty"`
+
+	//  Only used if RegistryValueType is CustomType  The data is in BinaryValue
+	CustomType int32 `json:"CustomType,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/restore_state.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type RestoreState struct {
+
+	//  The path to the save state file to restore the system from.
+	SaveStateFilePath string `json:"SaveStateFilePath,omitempty"`
+
+	//  The ID of the template system to clone this new system off of. An empty  string indicates the system should not be cloned from a template.
+	TemplateSystemId string `json:"TemplateSystemId,omitempty"`
+}

+ 19 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/save_options.go

@@ -0,0 +1,19 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type SaveOptions struct {
+
+	//  The type of save operation to be performed.
+	SaveType string `json:"SaveType,omitempty"`
+
+	//  The path to the file that will container the saved state.
+	SaveStateFilePath string `json:"SaveStateFilePath,omitempty"`
+}

+ 16 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/scsi.go

@@ -0,0 +1,16 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type Scsi struct {
+
+	//  Map of attachments, where the key is the integer LUN number on the controller.
+	Attachments map[string]Attachment `json:"Attachments,omitempty"`
+}

+ 15 - 0
libnetwork/vendor/github.com/Microsoft/hcsshim/internal/schema2/shared_memory_configuration.go

@@ -0,0 +1,15 @@
+/*
+ * HCS API
+ *
+ * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
+ *
+ * API version: 2.1
+ * Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
+ */
+
+package hcsschema
+
+type SharedMemoryConfiguration struct {
+
+	Regions []SharedMemoryRegion `json:"Regions,omitempty"`
+}

Some files were not shown because too many files changed in this diff