mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #25843 from darrenstahlmsft/RevendorHcsshim
Vendor hcsshim to v0.4.2
This commit is contained in:
commit
09e1de2080
3 changed files with 44 additions and 11 deletions
|
@ -43,7 +43,7 @@ esac
|
||||||
|
|
||||||
# the following lines are in sorted order, FYI
|
# the following lines are in sorted order, FYI
|
||||||
clone git github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
|
clone git github.com/Azure/go-ansiterm 388960b655244e76e24c75f48631564eaefade62
|
||||||
clone git github.com/Microsoft/hcsshim v0.4.1
|
clone git github.com/Microsoft/hcsshim v0.4.2
|
||||||
clone git github.com/Microsoft/go-winio v0.3.4
|
clone git github.com/Microsoft/go-winio v0.3.4
|
||||||
clone git github.com/Sirupsen/logrus v0.10.0 # logrus is a common dependency among multiple deps
|
clone git github.com/Sirupsen/logrus v0.10.0 # logrus is a common dependency among multiple deps
|
||||||
clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
clone git github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
||||||
|
|
|
@ -16,6 +16,7 @@ var (
|
||||||
const (
|
const (
|
||||||
pendingUpdatesQuery = `{ "PropertyTypes" : ["PendingUpdates"]}`
|
pendingUpdatesQuery = `{ "PropertyTypes" : ["PendingUpdates"]}`
|
||||||
statisticsQuery = `{ "PropertyTypes" : ["Statistics"]}`
|
statisticsQuery = `{ "PropertyTypes" : ["Statistics"]}`
|
||||||
|
processListQuery = `{ "PropertyTypes" : ["ProcessList"]}`
|
||||||
)
|
)
|
||||||
|
|
||||||
type container struct {
|
type container struct {
|
||||||
|
@ -29,14 +30,15 @@ type containerProperties struct {
|
||||||
Name string
|
Name string
|
||||||
SystemType string
|
SystemType string
|
||||||
Owner string
|
Owner string
|
||||||
SiloGUID string `json:"SiloGuid,omitempty"`
|
SiloGUID string `json:"SiloGuid,omitempty"`
|
||||||
IsDummy bool `json:",omitempty"`
|
IsDummy bool `json:",omitempty"`
|
||||||
RuntimeID string `json:"RuntimeId,omitempty"`
|
RuntimeID string `json:"RuntimeId,omitempty"`
|
||||||
Stopped bool `json:",omitempty"`
|
Stopped bool `json:",omitempty"`
|
||||||
ExitType string `json:",omitempty"`
|
ExitType string `json:",omitempty"`
|
||||||
AreUpdatesPending bool `json:",omitempty"`
|
AreUpdatesPending bool `json:",omitempty"`
|
||||||
ObRoot string `json:",omitempty"`
|
ObRoot string `json:",omitempty"`
|
||||||
Statistics Statistics `json:",omitempty"`
|
Statistics Statistics `json:",omitempty"`
|
||||||
|
ProcessList []ProcessListItem `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MemoryStats holds the memory statistics for a container
|
// MemoryStats holds the memory statistics for a container
|
||||||
|
@ -84,6 +86,18 @@ type Statistics struct {
|
||||||
Network []NetworkStats `json:",omitempty"`
|
Network []NetworkStats `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ProcessList is the structure of an item returned by a ProcessList call on a container
|
||||||
|
type ProcessListItem struct {
|
||||||
|
CreateTimestamp time.Time `json:",omitempty"`
|
||||||
|
ImageName string `json:",omitempty"`
|
||||||
|
KernelTime100ns uint64 `json:",omitempty"`
|
||||||
|
MemoryCommitBytes uint64 `json:",omitempty"`
|
||||||
|
MemoryWorkingSetPrivateBytes uint64 `json:",omitempty"`
|
||||||
|
MemoryWorkingSetSharedBytes uint64 `json:",omitempty"`
|
||||||
|
ProcessId uint32 `json:",omitempty"`
|
||||||
|
UserTime100ns uint64 `json:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// CreateContainer creates a new container with the given configuration but does not start it.
|
// CreateContainer creates a new container with the given configuration but does not start it.
|
||||||
func CreateContainer(id string, c *ContainerConfig) (Container, error) {
|
func CreateContainer(id string, c *ContainerConfig) (Container, error) {
|
||||||
operation := "CreateContainer"
|
operation := "CreateContainer"
|
||||||
|
@ -326,6 +340,20 @@ func (container *container) Statistics() (Statistics, error) {
|
||||||
return properties.Statistics, nil
|
return properties.Statistics, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ProcessList returns an array of ProcessListItems for the container
|
||||||
|
func (container *container) ProcessList() ([]ProcessListItem, error) {
|
||||||
|
operation := "ProcessList"
|
||||||
|
title := "HCSShim::Container::" + operation
|
||||||
|
logrus.Debugf(title+" id=%s", container.id)
|
||||||
|
properties, err := container.properties(processListQuery)
|
||||||
|
if err != nil {
|
||||||
|
return nil, makeContainerError(container, operation, "", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
logrus.Debugf(title+" succeeded id=%s", container.id)
|
||||||
|
return properties.ProcessList, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Pause pauses the execution of the container. This feature is not enabled in TP5.
|
// Pause pauses the execution of the container. This feature is not enabled in TP5.
|
||||||
func (container *container) Pause() error {
|
func (container *container) Pause() error {
|
||||||
operation := "Pause"
|
operation := "Pause"
|
||||||
|
@ -436,8 +464,10 @@ func (container *container) OpenProcess(pid int) (Process, error) {
|
||||||
container: container,
|
container: container,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := process.registerCallback(); err != nil {
|
if hcsCallbacksSupported {
|
||||||
return nil, makeContainerError(container, operation, "", err)
|
if err := process.registerCallback(); err != nil {
|
||||||
|
return nil, makeContainerError(container, operation, "", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logrus.Debugf(title+" succeeded id=%s processid=%s", container.id, process.processID)
|
logrus.Debugf(title+" succeeded id=%s processid=%s", container.id, process.processID)
|
||||||
|
|
|
@ -93,6 +93,9 @@ type Container interface {
|
||||||
// Statistics returns statistics for a container.
|
// Statistics returns statistics for a container.
|
||||||
Statistics() (Statistics, error)
|
Statistics() (Statistics, error)
|
||||||
|
|
||||||
|
// ProcessList returns details for the processes in a container.
|
||||||
|
ProcessList() ([]ProcessListItem, error)
|
||||||
|
|
||||||
// CreateProcess launches a new process within the container.
|
// CreateProcess launches a new process within the container.
|
||||||
CreateProcess(c *ProcessConfig) (Process, error)
|
CreateProcess(c *ProcessConfig) (Process, error)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue