Vendor Microsoft/hcsshim@8abdbb82
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
68c44f8cc8
commit
e16e995939
@ -34,7 +34,7 @@ golang.org/x/sync 42b317875d0fa942474b76e1b46a6060d720ae6e
|
||||
github.com/BurntSushi/toml a368813c5e648fee92e5f6c30e3944ff9d5e8895
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus 6b7015e65d366bf3f19b2b2a000a831940f0f7e0
|
||||
github.com/Microsoft/go-winio c599b533b43b1363d7d7c6cfda5ede70ed73ff13
|
||||
github.com/Microsoft/hcsshim v0.8.5
|
||||
github.com/Microsoft/hcsshim 8abdbb8205e4192c68b5f84c31197156f31be517
|
||||
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
|
||||
golang.org/x/text 19e51611da83d6be54ddafce4a4af510cb3e9ea4
|
||||
github.com/containerd/ttrpc f02858b1457c5ca3aaec3a0803eb0d59f96e41d6
|
||||
|
9
vendor/github.com/Microsoft/hcsshim/internal/hcs/log.go
generated
vendored
9
vendor/github.com/Microsoft/hcsshim/internal/hcs/log.go
generated
vendored
@ -7,9 +7,14 @@ func logOperationBegin(ctx logrus.Fields, msg string) {
|
||||
}
|
||||
|
||||
func logOperationEnd(ctx logrus.Fields, msg string, err error) {
|
||||
// Copy the log and fields first.
|
||||
log := logrus.WithFields(ctx)
|
||||
if err == nil {
|
||||
logrus.WithFields(ctx).Debug(msg)
|
||||
log.Debug(msg)
|
||||
} else {
|
||||
logrus.WithFields(ctx).WithError(err).Error(msg)
|
||||
// Edit only the copied field data to avoid race conditions on the
|
||||
// write.
|
||||
log.Data[logrus.ErrorKey] = err
|
||||
log.Error(msg)
|
||||
}
|
||||
}
|
||||
|
80
vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
generated
vendored
80
vendor/github.com/Microsoft/hcsshim/internal/hcs/process.go
generated
vendored
@ -23,6 +23,9 @@ type Process struct {
|
||||
callbackNumber uintptr
|
||||
|
||||
logctx logrus.Fields
|
||||
|
||||
waitBlock chan struct{}
|
||||
waitError error
|
||||
}
|
||||
|
||||
func newProcess(process hcsProcess, processID int, computeSystem *System) *Process {
|
||||
@ -31,10 +34,10 @@ func newProcess(process hcsProcess, processID int, computeSystem *System) *Proce
|
||||
processID: processID,
|
||||
system: computeSystem,
|
||||
logctx: logrus.Fields{
|
||||
logfields.HCSOperation: "",
|
||||
logfields.ContainerID: computeSystem.ID(),
|
||||
logfields.ProcessID: processID,
|
||||
},
|
||||
waitBlock: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,13 +91,12 @@ func (process *Process) SystemID() string {
|
||||
}
|
||||
|
||||
func (process *Process) logOperationBegin(operation string) {
|
||||
process.logctx[logfields.HCSOperation] = operation
|
||||
logOperationBegin(
|
||||
process.logctx,
|
||||
"hcsshim::Process - Begin Operation")
|
||||
operation+" - Begin Operation")
|
||||
}
|
||||
|
||||
func (process *Process) logOperationEnd(err error) {
|
||||
func (process *Process) logOperationEnd(operation string, err error) {
|
||||
var result string
|
||||
if err == nil {
|
||||
result = "Success"
|
||||
@ -104,9 +106,8 @@ func (process *Process) logOperationEnd(err error) {
|
||||
|
||||
logOperationEnd(
|
||||
process.logctx,
|
||||
"hcsshim::Process - End Operation - "+result,
|
||||
operation+" - End Operation - "+result,
|
||||
err)
|
||||
process.logctx[logfields.HCSOperation] = ""
|
||||
}
|
||||
|
||||
// Signal signals the process with `options`.
|
||||
@ -116,7 +117,7 @@ func (process *Process) Signal(options guestrequest.SignalProcessOptions) (err e
|
||||
|
||||
operation := "hcsshim::Process::Signal"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
if process.handle == 0 {
|
||||
return makeProcessError(process, operation, ErrAlreadyClosed, nil)
|
||||
@ -148,7 +149,7 @@ func (process *Process) Kill() (err error) {
|
||||
|
||||
operation := "hcsshim::Process::Kill"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
if process.handle == 0 {
|
||||
return makeProcessError(process, operation, ErrAlreadyClosed, nil)
|
||||
@ -166,33 +167,47 @@ func (process *Process) Kill() (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Wait waits for the process to exit.
|
||||
// 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)
|
||||
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(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
err = waitForNotification(process.callbackNumber, hcsNotificationProcessExited, nil)
|
||||
if err != nil {
|
||||
<-process.waitBlock
|
||||
if process.waitError != nil {
|
||||
return makeProcessError(process, operation, err, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WaitTimeout waits for the process to exit or the duration to elapse. It returns
|
||||
// false if timeout occurs.
|
||||
// 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(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
err = waitForNotification(process.callbackNumber, hcsNotificationProcessExited, &timeout)
|
||||
if err != nil {
|
||||
return makeProcessError(process, operation, err, nil)
|
||||
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.
|
||||
@ -202,7 +217,7 @@ func (process *Process) ResizeConsole(width, height uint16) (err error) {
|
||||
|
||||
operation := "hcsshim::Process::ResizeConsole"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
if process.handle == 0 {
|
||||
return makeProcessError(process, operation, ErrAlreadyClosed, nil)
|
||||
@ -239,7 +254,7 @@ func (process *Process) Properties() (_ *ProcessStatus, err error) {
|
||||
|
||||
operation := "hcsshim::Process::Properties"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
if process.handle == 0 {
|
||||
return nil, makeProcessError(process, operation, ErrAlreadyClosed, nil)
|
||||
@ -275,19 +290,24 @@ func (process *Process) Properties() (_ *ProcessStatus, err error) {
|
||||
func (process *Process) ExitCode() (_ int, err error) {
|
||||
operation := "hcsshim::Process::ExitCode"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
properties, err := process.Properties()
|
||||
if err != nil {
|
||||
return 0, makeProcessError(process, operation, err, nil)
|
||||
return -1, makeProcessError(process, operation, err, nil)
|
||||
}
|
||||
|
||||
if properties.Exited == false {
|
||||
return 0, makeProcessError(process, operation, ErrInvalidProcessState, nil)
|
||||
return -1, makeProcessError(process, operation, ErrInvalidProcessState, nil)
|
||||
}
|
||||
|
||||
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
|
||||
@ -302,7 +322,7 @@ func (process *Process) Stdio() (_ io.WriteCloser, _ io.ReadCloser, _ io.ReadClo
|
||||
|
||||
operation := "hcsshim::Process::Stdio"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
if process.handle == 0 {
|
||||
return nil, nil, nil, makeProcessError(process, operation, ErrAlreadyClosed, nil)
|
||||
@ -346,7 +366,7 @@ func (process *Process) CloseStdin() (err error) {
|
||||
|
||||
operation := "hcsshim::Process::CloseStdin"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
if process.handle == 0 {
|
||||
return makeProcessError(process, operation, ErrAlreadyClosed, nil)
|
||||
@ -384,7 +404,7 @@ func (process *Process) Close() (err error) {
|
||||
|
||||
operation := "hcsshim::Process::Close"
|
||||
process.logOperationBegin(operation)
|
||||
defer func() { process.logOperationEnd(err) }()
|
||||
defer func() { process.logOperationEnd(operation, err) }()
|
||||
|
||||
// Don't double free this
|
||||
if process.handle == 0 {
|
||||
@ -453,7 +473,7 @@ func (process *Process) unregisterCallback() error {
|
||||
closeChannels(context.channels)
|
||||
|
||||
callbackMapLock.Lock()
|
||||
callbackMap[callbackNumber] = nil
|
||||
delete(callbackMap, callbackNumber)
|
||||
callbackMapLock.Unlock()
|
||||
|
||||
handle = 0
|
||||
|
113
vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
generated
vendored
113
vendor/github.com/Microsoft/hcsshim/internal/hcs/system.go
generated
vendored
@ -43,26 +43,28 @@ type System struct {
|
||||
callbackNumber uintptr
|
||||
|
||||
logctx logrus.Fields
|
||||
|
||||
waitBlock chan struct{}
|
||||
waitError error
|
||||
}
|
||||
|
||||
func newSystem(id string) *System {
|
||||
return &System{
|
||||
id: id,
|
||||
logctx: logrus.Fields{
|
||||
logfields.HCSOperation: "",
|
||||
logfields.ContainerID: id,
|
||||
},
|
||||
waitBlock: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (computeSystem *System) logOperationBegin(operation string) {
|
||||
computeSystem.logctx[logfields.HCSOperation] = operation
|
||||
logOperationBegin(
|
||||
computeSystem.logctx,
|
||||
"hcsshim::ComputeSystem - Begin Operation")
|
||||
operation+" - Begin Operation")
|
||||
}
|
||||
|
||||
func (computeSystem *System) logOperationEnd(err error) {
|
||||
func (computeSystem *System) logOperationEnd(operation string, err error) {
|
||||
var result string
|
||||
if err == nil {
|
||||
result = "Success"
|
||||
@ -72,9 +74,8 @@ func (computeSystem *System) logOperationEnd(err error) {
|
||||
|
||||
logOperationEnd(
|
||||
computeSystem.logctx,
|
||||
"hcsshim::ComputeSystem - End Operation - "+result,
|
||||
operation+" - End Operation - "+result,
|
||||
err)
|
||||
computeSystem.logctx[logfields.HCSOperation] = ""
|
||||
}
|
||||
|
||||
// CreateComputeSystem creates a new compute system with the given configuration but does not start it.
|
||||
@ -83,7 +84,7 @@ func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System
|
||||
|
||||
computeSystem := newSystem(id)
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
hcsDocumentB, err := json.Marshal(hcsDocumentInterface)
|
||||
if err != nil {
|
||||
@ -124,6 +125,8 @@ func CreateComputeSystem(id string, hcsDocumentInterface interface{}) (_ *System
|
||||
return nil, makeSystemError(computeSystem, operation, hcsDocument, err, events)
|
||||
}
|
||||
|
||||
go computeSystem.waitBackground()
|
||||
|
||||
return computeSystem, nil
|
||||
}
|
||||
|
||||
@ -135,9 +138,9 @@ func OpenComputeSystem(id string) (_ *System, err error) {
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() {
|
||||
if IsNotExist(err) {
|
||||
computeSystem.logOperationEnd(nil)
|
||||
computeSystem.logOperationEnd(operation, nil)
|
||||
} else {
|
||||
computeSystem.logOperationEnd(err)
|
||||
computeSystem.logOperationEnd(operation, err)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -156,6 +159,7 @@ func OpenComputeSystem(id string) (_ *System, err error) {
|
||||
if err = computeSystem.registerCallback(); err != nil {
|
||||
return nil, makeSystemError(computeSystem, operation, "", err, nil)
|
||||
}
|
||||
go computeSystem.waitBackground()
|
||||
|
||||
return computeSystem, nil
|
||||
}
|
||||
@ -163,12 +167,10 @@ func OpenComputeSystem(id string) (_ *System, err error) {
|
||||
// GetComputeSystems gets a list of the compute systems on the system that match the query
|
||||
func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerProperties, err error) {
|
||||
operation := "hcsshim::GetComputeSystems"
|
||||
fields := logrus.Fields{
|
||||
logfields.HCSOperation: operation,
|
||||
}
|
||||
fields := logrus.Fields{}
|
||||
logOperationBegin(
|
||||
fields,
|
||||
"hcsshim::ComputeSystem - Begin Operation")
|
||||
operation+" - Begin Operation")
|
||||
|
||||
defer func() {
|
||||
var result string
|
||||
@ -180,7 +182,7 @@ func GetComputeSystems(q schema1.ComputeSystemQuery) (_ []schema1.ContainerPrope
|
||||
|
||||
logOperationEnd(
|
||||
fields,
|
||||
"hcsshim::ComputeSystem - End Operation - "+result,
|
||||
operation+" - End Operation - "+result,
|
||||
err)
|
||||
}()
|
||||
|
||||
@ -227,7 +229,7 @@ func (computeSystem *System) Start() (err error) {
|
||||
|
||||
operation := "hcsshim::ComputeSystem::Start"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
if computeSystem.handle == 0 {
|
||||
return makeSystemError(computeSystem, "Start", "", ErrAlreadyClosed, nil)
|
||||
@ -285,10 +287,10 @@ func (computeSystem *System) Shutdown() (err error) {
|
||||
operation := "hcsshim::ComputeSystem::Shutdown"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() {
|
||||
if IsAlreadyStopped(err) {
|
||||
computeSystem.logOperationEnd(nil)
|
||||
if IsAlreadyStopped(err) || IsPending(err) {
|
||||
computeSystem.logOperationEnd(operation, nil)
|
||||
} else {
|
||||
computeSystem.logOperationEnd(err)
|
||||
computeSystem.logOperationEnd(operation, err)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -318,9 +320,9 @@ func (computeSystem *System) Terminate() (err error) {
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() {
|
||||
if IsPending(err) {
|
||||
computeSystem.logOperationEnd(nil)
|
||||
computeSystem.logOperationEnd(operation, nil)
|
||||
} else {
|
||||
computeSystem.logOperationEnd(err)
|
||||
computeSystem.logOperationEnd(operation, err)
|
||||
}
|
||||
}()
|
||||
|
||||
@ -340,48 +342,65 @@ func (computeSystem *System) Terminate() (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Wait synchronously waits for the compute system to shutdown or terminate.
|
||||
// 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)
|
||||
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(err) }()
|
||||
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)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WaitExpectedError synchronously waits for the compute system to shutdown or
|
||||
// terminate, and ignores the passed error if it occurs.
|
||||
// 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(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
err = waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, nil)
|
||||
if err != nil && err != expected {
|
||||
return makeSystemError(computeSystem, "WaitExpectedError", "", err, nil)
|
||||
<-computeSystem.waitBlock
|
||||
if computeSystem.waitError != nil && getInnerError(computeSystem.waitError) != expected {
|
||||
return makeSystemError(computeSystem, "WaitExpectedError", "", computeSystem.waitError, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// WaitTimeout synchronously waits for the compute system to terminate or the duration to elapse.
|
||||
// If the timeout expires, IsTimeout(err) == true
|
||||
// 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(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
err = waitForNotification(computeSystem.callbackNumber, hcsNotificationSystemExited, &timeout)
|
||||
if err != nil {
|
||||
return makeSystemError(computeSystem, "WaitTimeout", "", err, nil)
|
||||
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) {
|
||||
@ -390,7 +409,7 @@ func (computeSystem *System) Properties(types ...schema1.PropertyType) (_ *schem
|
||||
|
||||
operation := "hcsshim::ComputeSystem::Properties"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
queryj, err := json.Marshal(schema1.PropertyQuery{types})
|
||||
if err != nil {
|
||||
@ -429,7 +448,7 @@ func (computeSystem *System) Pause() (err error) {
|
||||
|
||||
operation := "hcsshim::ComputeSystem::Pause"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
if computeSystem.handle == 0 {
|
||||
return makeSystemError(computeSystem, "Pause", "", ErrAlreadyClosed, nil)
|
||||
@ -454,7 +473,7 @@ func (computeSystem *System) Resume() (err error) {
|
||||
|
||||
operation := "hcsshim::ComputeSystem::Resume"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
if computeSystem.handle == 0 {
|
||||
return makeSystemError(computeSystem, "Resume", "", ErrAlreadyClosed, nil)
|
||||
@ -479,7 +498,7 @@ func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error
|
||||
|
||||
operation := "hcsshim::ComputeSystem::CreateProcess"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
var (
|
||||
processInfo hcsProcessInformation
|
||||
@ -524,6 +543,7 @@ func (computeSystem *System) CreateProcess(c interface{}) (_ *Process, err error
|
||||
if err = process.registerCallback(); err != nil {
|
||||
return nil, makeSystemError(computeSystem, "CreateProcess", "", err, nil)
|
||||
}
|
||||
go process.waitBackground()
|
||||
|
||||
return process, nil
|
||||
}
|
||||
@ -539,7 +559,7 @@ func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) {
|
||||
|
||||
operation := "hcsshim::ComputeSystem::OpenProcess"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
var (
|
||||
processHandle hcsProcess
|
||||
@ -562,6 +582,7 @@ func (computeSystem *System) OpenProcess(pid int) (_ *Process, err error) {
|
||||
if err = process.registerCallback(); err != nil {
|
||||
return nil, makeSystemError(computeSystem, "OpenProcess", "", err, nil)
|
||||
}
|
||||
go process.waitBackground()
|
||||
|
||||
return process, nil
|
||||
}
|
||||
@ -573,7 +594,7 @@ func (computeSystem *System) Close() (err error) {
|
||||
|
||||
operation := "hcsshim::ComputeSystem::Close"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
// Don't double free this
|
||||
if computeSystem.handle == 0 {
|
||||
@ -645,7 +666,7 @@ func (computeSystem *System) unregisterCallback() error {
|
||||
closeChannels(context.channels)
|
||||
|
||||
callbackMapLock.Lock()
|
||||
callbackMap[callbackNumber] = nil
|
||||
delete(callbackMap, callbackNumber)
|
||||
callbackMapLock.Unlock()
|
||||
|
||||
handle = 0
|
||||
@ -660,7 +681,7 @@ func (computeSystem *System) Modify(config interface{}) (err error) {
|
||||
|
||||
operation := "hcsshim::ComputeSystem::Modify"
|
||||
computeSystem.logOperationBegin(operation)
|
||||
defer func() { computeSystem.logOperationEnd(err) }()
|
||||
defer func() { computeSystem.logOperationEnd(operation, err) }()
|
||||
|
||||
if computeSystem.handle == 0 {
|
||||
return makeSystemError(computeSystem, "Modify", "", ErrAlreadyClosed, nil)
|
||||
|
5
vendor/github.com/Microsoft/hcsshim/internal/hcs/waithelper.go
generated
vendored
5
vendor/github.com/Microsoft/hcsshim/internal/hcs/waithelper.go
generated
vendored
@ -17,6 +17,11 @@ func processAsyncHcsResult(err error, resultp *uint16, callbackNumber uintptr, e
|
||||
|
||||
func waitForNotification(callbackNumber uintptr, expectedNotification hcsNotification, timeout *time.Duration) error {
|
||||
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
|
||||
callbackMapLock.RUnlock()
|
||||
|
||||
|
10
vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go
generated
vendored
10
vendor/github.com/Microsoft/hcsshim/internal/hns/hnsnetwork.go
generated
vendored
@ -2,9 +2,9 @@ package hns
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net"
|
||||
|
||||
"errors"
|
||||
"github.com/sirupsen/logrus"
|
||||
"net"
|
||||
)
|
||||
|
||||
// Subnet is assoicated with a network and represents a list
|
||||
@ -98,6 +98,12 @@ func (network *HNSNetwork) Create() (*HNSNetwork, error) {
|
||||
title := "hcsshim::HNSNetwork::" + operation
|
||||
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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
5
vendor/github.com/Microsoft/hcsshim/internal/logfields/fields.go
generated
vendored
5
vendor/github.com/Microsoft/hcsshim/internal/logfields/fields.go
generated
vendored
@ -26,11 +26,6 @@ const (
|
||||
Uint32 = "uint32"
|
||||
Uint64 = "uint64"
|
||||
|
||||
// HCS
|
||||
|
||||
HCSOperation = "hcs-op"
|
||||
HCSOperationResult = "hcs-op-result"
|
||||
|
||||
// runhcs
|
||||
|
||||
VMShimOperation = "vmshim-op"
|
||||
|
2
vendor/github.com/Microsoft/hcsshim/internal/safefile/safeopen.go
generated
vendored
2
vendor/github.com/Microsoft/hcsshim/internal/safefile/safeopen.go
generated
vendored
@ -87,7 +87,7 @@ func OpenRoot(path string) (*os.File, error) {
|
||||
|
||||
func ntRelativePath(path string) ([]uint16, error) {
|
||||
path = filepath.Clean(path)
|
||||
if strings.Contains(":", path) {
|
||||
if strings.Contains(path, ":") {
|
||||
// Since alternate data streams must follow the file they
|
||||
// are attached to, finding one here (out of order) is invalid.
|
||||
return nil, errors.New("path contains invalid character `:`")
|
||||
|
3
vendor/github.com/Microsoft/hcsshim/internal/schema2/plan9_share.go
generated
vendored
3
vendor/github.com/Microsoft/hcsshim/internal/schema2/plan9_share.go
generated
vendored
@ -10,7 +10,6 @@
|
||||
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.
|
||||
@ -30,4 +29,6 @@ type Plan9Share struct {
|
||||
ReadOnly bool `json:"ReadOnly,omitempty"`
|
||||
|
||||
UseShareRootIdentity bool `json:"UseShareRootIdentity,omitempty"`
|
||||
|
||||
AllowedFiles []string `json:"AllowedFiles,omitempty"`
|
||||
}
|
||||
|
16
vendor/github.com/Microsoft/hcsshim/vendor.conf
generated
vendored
16
vendor/github.com/Microsoft/hcsshim/vendor.conf
generated
vendored
@ -1,13 +1,20 @@
|
||||
github.com/blang/semver v3.1.0
|
||||
github.com/containerd/console c12b1e7919c14469339a5d38f2f8ed9b64a9de23
|
||||
github.com/containerd/containerd faec567304bbdf6864b1663d4f813641b5880a4a
|
||||
github.com/containerd/go-runc 5a6d9f37cfa36b15efba46dc7ea349fa9b7143c3
|
||||
github.com/containerd/ttrpc 2a805f71863501300ae1976d29f0454ae003e85a
|
||||
github.com/containerd/typeurl a93fcdb778cd272c6e9b3028b2f42d813e785d40
|
||||
github.com/gogo/protobuf v1.0.0
|
||||
github.com/golang/protobuf v1.1.0
|
||||
github.com/hashicorp/errwrap 7554cd9344cec97297fa6649b055a8c98c2a1e55
|
||||
github.com/hashicorp/go-multierror ed905158d87462226a13fe39ddf685ea65f1c11f
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1
|
||||
github.com/linuxkit/virtsock 8e79449dea0735c1c056d814934dd035734cc97c
|
||||
github.com/Microsoft/go-winio 16cfc975803886a5e47c4257a24c8d8c52e178b2
|
||||
github.com/Microsoft/go-winio c599b533b43b1363d7d7c6cfda5ede70ed73ff13
|
||||
github.com/Microsoft/opengcs v0.3.9
|
||||
github.com/opencontainers/runtime-spec eba862dc2470385a233c7507392675cbeadf7353
|
||||
github.com/opencontainers/go-digest c9281466c8b2f606084ac71339773efd177436e7
|
||||
github.com/opencontainers/runc 12f6a991201fdb8f82579582d5e00e28fba06d0a
|
||||
github.com/opencontainers/runtime-spec 29686dbc5559d93fb1ef402eeda3e35c38d75af4
|
||||
github.com/opencontainers/runtime-tools 1d69bd0f9c39677d0630e50664fbc3154ae61b88
|
||||
github.com/pkg/errors v0.8.1
|
||||
github.com/sirupsen/logrus v1.3.0
|
||||
@ -17,5 +24,10 @@ github.com/xeipuuv/gojsonpointer 4e3ac2762d5f479393488629ee9370b50873b3a6
|
||||
github.com/xeipuuv/gojsonreference bd5ef7bd5415a7ac448318e64f11a24cd21e594b
|
||||
github.com/xeipuuv/gojsonschema 1d523034197ff1f222f6429836dd36a2457a1874
|
||||
golang.org/x/crypto ff983b9c42bc9fbf91556e191cc8efb585c16908
|
||||
golang.org/x/net ed066c81e75eba56dd9bd2139ade88125b855585
|
||||
golang.org/x/sync 37e7f081c4d4c64e13b10787722085407fe5d15f
|
||||
golang.org/x/sys e5ecc2a6747ce8d4af18ed98b3de5ae30eb3a5bb
|
||||
golang.org/x/text d14c52b222ee852cdba8b07206ca0c614b389876
|
||||
google.golang.org/genproto d80a6e20e776b0b17a324d0ba1ab50a39c8e8944
|
||||
google.golang.org/grpc v1.12.0
|
||||
k8s.io/kubernetes v1.13.0
|
||||
|
Loading…
Reference in New Issue
Block a user