mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Revendor Microsoft/opengcs @ v0.3.8
Signed-off-by: John Howard (VM) <jhoward@ntdev.microsoft.com>
This commit is contained in:
parent
d4e48af48d
commit
25aaf9772b
3 changed files with 34 additions and 2 deletions
|
@ -7,7 +7,7 @@ github.com/go-check/check 4ed411733c5785b40214c70bce814c3a3a689609 https://githu
|
||||||
github.com/golang/gddo 9b12a26f3fbd7397dee4e20939ddca719d840d2a
|
github.com/golang/gddo 9b12a26f3fbd7397dee4e20939ddca719d840d2a
|
||||||
github.com/gorilla/context v1.1
|
github.com/gorilla/context v1.1
|
||||||
github.com/gorilla/mux v1.1
|
github.com/gorilla/mux v1.1
|
||||||
github.com/Microsoft/opengcs v0.3.6
|
github.com/Microsoft/opengcs v0.3.8
|
||||||
github.com/kr/pty 5cf931ef8f
|
github.com/kr/pty 5cf931ef8f
|
||||||
github.com/mattn/go-shellwords v1.0.3
|
github.com/mattn/go-shellwords v1.0.3
|
||||||
github.com/sirupsen/logrus v1.0.3
|
github.com/sirupsen/logrus v1.0.3
|
||||||
|
|
2
vendor/github.com/Microsoft/opengcs/client/config.go
generated
vendored
2
vendor/github.com/Microsoft/opengcs/client/config.go
generated
vendored
|
@ -110,7 +110,7 @@ func ParseOptions(options []string) (Options, error) {
|
||||||
rOpts.Vhdx = filepath.Join(rOpts.KirdPath, `uvm.vhdx`)
|
rOpts.Vhdx = filepath.Join(rOpts.KirdPath, `uvm.vhdx`)
|
||||||
}
|
}
|
||||||
if rOpts.KernelFile == "" {
|
if rOpts.KernelFile == "" {
|
||||||
rOpts.KernelFile = `bootx64.efi`
|
rOpts.KernelFile = `kernel`
|
||||||
}
|
}
|
||||||
if rOpts.InitrdFile == "" {
|
if rOpts.InitrdFile == "" {
|
||||||
rOpts.InitrdFile = `initrd.img`
|
rOpts.InitrdFile = `initrd.img`
|
||||||
|
|
32
vendor/github.com/Microsoft/opengcs/service/gcsutils/remotefs/remotefs.go
generated
vendored
32
vendor/github.com/Microsoft/opengcs/service/gcsutils/remotefs/remotefs.go
generated
vendored
|
@ -13,6 +13,7 @@ import (
|
||||||
|
|
||||||
"github.com/docker/docker/pkg/archive"
|
"github.com/docker/docker/pkg/archive"
|
||||||
"github.com/docker/docker/pkg/symlink"
|
"github.com/docker/docker/pkg/symlink"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -287,83 +288,107 @@ func Mkfifo(in io.Reader, out io.Writer, args []string) error {
|
||||||
// - args[1] = flag in base 10
|
// - args[1] = flag in base 10
|
||||||
// - args[2] = permission mode in octal (like 0755)
|
// - args[2] = permission mode in octal (like 0755)
|
||||||
func OpenFile(in io.Reader, out io.Writer, args []string) (err error) {
|
func OpenFile(in io.Reader, out io.Writer, args []string) (err error) {
|
||||||
|
logrus.Debugf("OpenFile: %v", args)
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("OpenFile: return is non-nil, so writing cmdFailed back: %v", err)
|
||||||
// error code will be serialized by the caller, so don't write it here
|
// error code will be serialized by the caller, so don't write it here
|
||||||
WriteFileHeader(out, &FileHeader{Cmd: CmdFailed}, nil)
|
WriteFileHeader(out, &FileHeader{Cmd: CmdFailed}, nil)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if len(args) < 3 {
|
if len(args) < 3 {
|
||||||
|
logrus.Errorf("OpenFile: Not enough parameters")
|
||||||
return ErrInvalid
|
return ErrInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
flag, err := strconv.ParseInt(args[1], 10, 32)
|
flag, err := strconv.ParseInt(args[1], 10, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Invalid flag: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
perm, err := strconv.ParseUint(args[2], 8, 32)
|
perm, err := strconv.ParseUint(args[2], 8, 32)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Invalid permission: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := os.OpenFile(args[0], int(flag), os.FileMode(perm))
|
f, err := os.OpenFile(args[0], int(flag), os.FileMode(perm))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Failed to open: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Signal the client that OpenFile succeeded
|
// Signal the client that OpenFile succeeded
|
||||||
|
logrus.Debugf("OpenFile: Sending OK header")
|
||||||
if err := WriteFileHeader(out, &FileHeader{Cmd: CmdOK}, nil); err != nil {
|
if err := WriteFileHeader(out, &FileHeader{Cmd: CmdOK}, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
logrus.Debugf("OpenFile: reading header")
|
||||||
hdr, err := ReadFileHeader(in)
|
hdr, err := ReadFileHeader(in)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Failed to ReadFileHeader: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
logrus.Debugf("OpenFile: Header: %+v", hdr)
|
||||||
|
|
||||||
var buf []byte
|
var buf []byte
|
||||||
switch hdr.Cmd {
|
switch hdr.Cmd {
|
||||||
case Read:
|
case Read:
|
||||||
|
logrus.Debugf("OpenFile: Read command")
|
||||||
buf = make([]byte, hdr.Size, hdr.Size)
|
buf = make([]byte, hdr.Size, hdr.Size)
|
||||||
n, err := f.Read(buf)
|
n, err := f.Read(buf)
|
||||||
|
logrus.Debugf("OpenFile: Issued a read for %d, got %d bytes and error %v", hdr.Size, n, err)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Read failed: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buf = buf[:n]
|
buf = buf[:n]
|
||||||
case Write:
|
case Write:
|
||||||
|
logrus.Debugf("OpenFile: Write command")
|
||||||
if _, err := io.CopyN(f, in, int64(hdr.Size)); err != nil {
|
if _, err := io.CopyN(f, in, int64(hdr.Size)); err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Write CopyN() failed: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
case Seek:
|
case Seek:
|
||||||
|
logrus.Debugf("OpenFile: Seek command")
|
||||||
seekHdr := &SeekHeader{}
|
seekHdr := &SeekHeader{}
|
||||||
if err := binary.Read(in, binary.BigEndian, seekHdr); err != nil {
|
if err := binary.Read(in, binary.BigEndian, seekHdr); err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Seek Read() failed: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
res, err := f.Seek(seekHdr.Offset, int(seekHdr.Whence))
|
res, err := f.Seek(seekHdr.Offset, int(seekHdr.Whence))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Seek Seek() failed: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buffer := &bytes.Buffer{}
|
buffer := &bytes.Buffer{}
|
||||||
if err := binary.Write(buffer, binary.BigEndian, res); err != nil {
|
if err := binary.Write(buffer, binary.BigEndian, res); err != nil {
|
||||||
|
logrus.Errorf("OpenFile: Seek Write() failed: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
buf = buffer.Bytes()
|
buf = buffer.Bytes()
|
||||||
case Close:
|
case Close:
|
||||||
|
logrus.Debugf("OpenFile: Close command")
|
||||||
if err := f.Close(); err != nil {
|
if err := f.Close(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
logrus.Errorf("OpenFile: unknown command")
|
||||||
return ErrUnknown
|
return ErrUnknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logrus.Debugf("OpenFile: Writing back OK header of size %d", len(buf))
|
||||||
retHdr := &FileHeader{
|
retHdr := &FileHeader{
|
||||||
Cmd: CmdOK,
|
Cmd: CmdOK,
|
||||||
Size: uint64(len(buf)),
|
Size: uint64(len(buf)),
|
||||||
}
|
}
|
||||||
if err := WriteFileHeader(out, retHdr, buf); err != nil {
|
if err := WriteFileHeader(out, retHdr, buf); err != nil {
|
||||||
|
logrus.Errorf("OpenFile: WriteFileHeader() failed: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,6 +396,7 @@ func OpenFile(in io.Reader, out io.Writer, args []string) (err error) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
logrus.Debugf("OpenFile: Done, no error")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -503,18 +529,24 @@ func ResolvePath(in io.Reader, out io.Writer, args []string) error {
|
||||||
// - in = size of json | json of archive.TarOptions | input tar stream
|
// - in = size of json | json of archive.TarOptions | input tar stream
|
||||||
// - args[0] = extract directory name
|
// - args[0] = extract directory name
|
||||||
func ExtractArchive(in io.Reader, out io.Writer, args []string) error {
|
func ExtractArchive(in io.Reader, out io.Writer, args []string) error {
|
||||||
|
logrus.Debugln("ExtractArchive:", args)
|
||||||
if len(args) < 1 {
|
if len(args) < 1 {
|
||||||
|
logrus.Errorln("ExtractArchive: invalid args")
|
||||||
return ErrInvalid
|
return ErrInvalid
|
||||||
}
|
}
|
||||||
|
|
||||||
opts, err := ReadTarOptions(in)
|
opts, err := ReadTarOptions(in)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
logrus.Errorf("ExtractArchive: Failed to read tar options: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logrus.Debugf("ExtractArchive: Tar options: %+v", opts)
|
||||||
if err := archive.Untar(in, args[0], opts); err != nil {
|
if err := archive.Untar(in, args[0], opts); err != nil {
|
||||||
|
logrus.Errorf("ExtractArchive: Failed to Untar: %v", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
logrus.Debugf("ExtractArchive: Success")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue