mirror of
https://github.com/docker/cli.git
synced 2026-01-13 18:22:35 +03:00
Merge pull request #36056 from Microsoft/jjh/opengcsv0.3.5
Revendor Microsoft/opengcs @ v0.3.5 Upstream-commit: e60b68ad21ea47d02a125e7ab5a917331de22ea7 Component: engine
This commit is contained in:
@@ -7,7 +7,7 @@ github.com/docker/libtrust 9cbd2a1374f46905c68a4eb3694a130610adc62a
|
||||
github.com/go-check/check 4ed411733c5785b40214c70bce814c3a3a689609 https://github.com/cpuguy83/check.git
|
||||
github.com/gorilla/context v1.1
|
||||
github.com/gorilla/mux v1.1
|
||||
github.com/Microsoft/opengcs v0.3.4
|
||||
github.com/Microsoft/opengcs v0.3.5
|
||||
github.com/kr/pty 5cf931ef8f
|
||||
github.com/mattn/go-shellwords v1.0.3
|
||||
github.com/sirupsen/logrus v1.0.3
|
||||
|
||||
24
components/engine/vendor/github.com/Microsoft/opengcs/client/init.go
generated
vendored
Normal file
24
components/engine/vendor/github.com/Microsoft/opengcs/client/init.go
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
// +build windows
|
||||
|
||||
package client
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
var (
|
||||
logDataFromUVM int64
|
||||
)
|
||||
|
||||
func init() {
|
||||
bytes := os.Getenv("OPENGCS_LOG_DATA_FROM_UVM")
|
||||
if len(bytes) == 0 {
|
||||
return
|
||||
}
|
||||
u, err := strconv.ParseUint(bytes, 10, 32)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
logDataFromUVM = int64(u)
|
||||
}
|
||||
8
components/engine/vendor/github.com/Microsoft/opengcs/client/process.go
generated
vendored
8
components/engine/vendor/github.com/Microsoft/opengcs/client/process.go
generated
vendored
@@ -130,13 +130,17 @@ func (config *Config) DebugGCS() {
|
||||
cmd := os.Getenv("OPENGCS_DEBUG_COMMAND")
|
||||
if cmd == "" {
|
||||
cmd = `sh -c "`
|
||||
cmd += debugCommand("kill -10 `pidof gcs`") // SIGUSR1 for stackdump
|
||||
cmd += debugCommand("ls -l /tmp")
|
||||
cmd += debugCommand("cat /tmp/gcs.log")
|
||||
cmd += debugCommand("cat /tmp/gcs/gcs-stacks*")
|
||||
cmd += debugCommand("cat /tmp/gcs/paniclog*")
|
||||
cmd += debugCommand("ls -l /tmp/gcs")
|
||||
cmd += debugCommand("ls -l /tmp/gcs/*")
|
||||
cmd += debugCommand("cat /tmp/gcs/*/config.json")
|
||||
cmd += debugCommand("ls -lR /var/run/gcsrunc")
|
||||
cmd += debugCommand("cat /var/run/gcsrunc/log.log")
|
||||
cmd += debugCommand("cat /tmp/gcs/global-runc.log")
|
||||
cmd += debugCommand("cat /tmp/gcs/*/runc.log")
|
||||
cmd += debugCommand("ps -ef")
|
||||
cmd += `"`
|
||||
}
|
||||
@@ -153,5 +157,5 @@ func (config *Config) DebugGCS() {
|
||||
if proc != nil {
|
||||
proc.WaitTimeout(time.Duration(int(time.Second) * 30))
|
||||
}
|
||||
logrus.Debugf("GCS Debugging:\n%s\n\nEnd GCS Debugging\n", strings.TrimSpace(out.String()))
|
||||
logrus.Debugf("GCS Debugging:\n%s\n\nEnd GCS Debugging", strings.TrimSpace(out.String()))
|
||||
}
|
||||
|
||||
25
components/engine/vendor/github.com/Microsoft/opengcs/client/utilities.go
generated
vendored
25
components/engine/vendor/github.com/Microsoft/opengcs/client/utilities.go
generated
vendored
@@ -3,6 +3,8 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
@@ -40,7 +42,28 @@ func copyWithTimeout(dst io.Writer, src io.Reader, size int64, timeoutSeconds in
|
||||
done := make(chan resultType, 1)
|
||||
go func() {
|
||||
result := resultType{}
|
||||
result.bytes, result.err = io.Copy(dst, src)
|
||||
if logrus.GetLevel() < logrus.DebugLevel || logDataFromUVM == 0 {
|
||||
result.bytes, result.err = io.Copy(dst, src)
|
||||
} else {
|
||||
// In advanced debug mode where we log (hexdump format) what is copied
|
||||
// up to the number of bytes defined by environment variable
|
||||
// OPENGCS_LOG_DATA_FROM_UVM
|
||||
var buf bytes.Buffer
|
||||
tee := io.TeeReader(src, &buf)
|
||||
result.bytes, result.err = io.Copy(dst, tee)
|
||||
if result.err == nil {
|
||||
size := result.bytes
|
||||
if size > logDataFromUVM {
|
||||
size = logDataFromUVM
|
||||
}
|
||||
if size > 0 {
|
||||
bytes := make([]byte, size)
|
||||
if _, err := buf.Read(bytes); err == nil {
|
||||
logrus.Debugf(fmt.Sprintf("opengcs: copyWithTimeout\n%s", hex.Dump(bytes)))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
done <- result
|
||||
}()
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@ func ExportedToError(ee *ExportedError) error {
|
||||
return os.ErrExist
|
||||
} else if ee.Error() == os.ErrPermission.Error() {
|
||||
return os.ErrPermission
|
||||
} else if ee.Error() == io.EOF.Error() {
|
||||
return io.EOF
|
||||
}
|
||||
return ee
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user