Browse code

Vendor hcsshim to v0.4.2

Signed-off-by: Darren Stahl <darst@microsoft.com>

Darren Stahl authored on 2016/08/19 04:53:01
Showing 3 changed files
... ...
@@ -43,7 +43,7 @@ esac
43 43
 
44 44
 # the following lines are in sorted order, FYI
45 45
 clone git github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
46
-clone git github.com/Microsoft/hcsshim v0.4.1
46
+clone git github.com/Microsoft/hcsshim v0.4.2
47 47
 clone git github.com/Microsoft/go-winio v0.3.4
48 48
 clone git github.com/Sirupsen/logrus v0.10.0 # logrus is a common dependency among multiple deps
49 49
 clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
... ...
@@ -16,6 +16,7 @@ var (
16 16
 const (
17 17
 	pendingUpdatesQuery = `{ "PropertyTypes" : ["PendingUpdates"]}`
18 18
 	statisticsQuery     = `{ "PropertyTypes" : ["Statistics"]}`
19
+	processListQuery    = `{ "PropertyTypes" : ["ProcessList"]}`
19 20
 )
20 21
 
21 22
 type container struct {
... ...
@@ -29,14 +30,15 @@ type containerProperties struct {
29 29
 	Name              string
30 30
 	SystemType        string
31 31
 	Owner             string
32
-	SiloGUID          string     `json:"SiloGuid,omitempty"`
33
-	IsDummy           bool       `json:",omitempty"`
34
-	RuntimeID         string     `json:"RuntimeId,omitempty"`
35
-	Stopped           bool       `json:",omitempty"`
36
-	ExitType          string     `json:",omitempty"`
37
-	AreUpdatesPending bool       `json:",omitempty"`
38
-	ObRoot            string     `json:",omitempty"`
39
-	Statistics        Statistics `json:",omitempty"`
32
+	SiloGUID          string            `json:"SiloGuid,omitempty"`
33
+	IsDummy           bool              `json:",omitempty"`
34
+	RuntimeID         string            `json:"RuntimeId,omitempty"`
35
+	Stopped           bool              `json:",omitempty"`
36
+	ExitType          string            `json:",omitempty"`
37
+	AreUpdatesPending bool              `json:",omitempty"`
38
+	ObRoot            string            `json:",omitempty"`
39
+	Statistics        Statistics        `json:",omitempty"`
40
+	ProcessList       []ProcessListItem `json:",omitempty"`
40 41
 }
41 42
 
42 43
 // MemoryStats holds the memory statistics for a container
... ...
@@ -84,6 +86,18 @@ type Statistics struct {
84 84
 	Network            []NetworkStats `json:",omitempty"`
85 85
 }
86 86
 
87
+// ProcessList is the structure of an item returned by a ProcessList call on a container
88
+type ProcessListItem struct {
89
+	CreateTimestamp              time.Time `json:",omitempty"`
90
+	ImageName                    string    `json:",omitempty"`
91
+	KernelTime100ns              uint64    `json:",omitempty"`
92
+	MemoryCommitBytes            uint64    `json:",omitempty"`
93
+	MemoryWorkingSetPrivateBytes uint64    `json:",omitempty"`
94
+	MemoryWorkingSetSharedBytes  uint64    `json:",omitempty"`
95
+	ProcessId                    uint32    `json:",omitempty"`
96
+	UserTime100ns                uint64    `json:",omitempty"`
97
+}
98
+
87 99
 // CreateContainer creates a new container with the given configuration but does not start it.
88 100
 func CreateContainer(id string, c *ContainerConfig) (Container, error) {
89 101
 	operation := "CreateContainer"
... ...
@@ -326,6 +340,20 @@ func (container *container) Statistics() (Statistics, error) {
326 326
 	return properties.Statistics, nil
327 327
 }
328 328
 
329
+// ProcessList returns an array of ProcessListItems for the container
330
+func (container *container) ProcessList() ([]ProcessListItem, error) {
331
+	operation := "ProcessList"
332
+	title := "HCSShim::Container::" + operation
333
+	logrus.Debugf(title+" id=%s", container.id)
334
+	properties, err := container.properties(processListQuery)
335
+	if err != nil {
336
+		return nil, makeContainerError(container, operation, "", err)
337
+	}
338
+
339
+	logrus.Debugf(title+" succeeded id=%s", container.id)
340
+	return properties.ProcessList, nil
341
+}
342
+
329 343
 // Pause pauses the execution of the container. This feature is not enabled in TP5.
330 344
 func (container *container) Pause() error {
331 345
 	operation := "Pause"
... ...
@@ -436,8 +464,10 @@ func (container *container) OpenProcess(pid int) (Process, error) {
436 436
 		container: container,
437 437
 	}
438 438
 
439
-	if err := process.registerCallback(); err != nil {
440
-		return nil, makeContainerError(container, operation, "", err)
439
+	if hcsCallbacksSupported {
440
+		if err := process.registerCallback(); err != nil {
441
+			return nil, makeContainerError(container, operation, "", err)
442
+		}
441 443
 	}
442 444
 
443 445
 	logrus.Debugf(title+" succeeded id=%s processid=%s", container.id, process.processID)
... ...
@@ -93,6 +93,9 @@ type Container interface {
93 93
 	// Statistics returns statistics for a container.
94 94
 	Statistics() (Statistics, error)
95 95
 
96
+	// ProcessList returns details for the processes in a container.
97
+	ProcessList() ([]ProcessListItem, error)
98
+
96 99
 	// CreateProcess launches a new process within the container.
97 100
 	CreateProcess(c *ProcessConfig) (Process, error)
98 101