Fix execution build

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-12-05 16:17:46 -08:00
parent e31a99c08a
commit 723a72bdf8
9 changed files with 212 additions and 250 deletions

View file

@ -84,10 +84,9 @@ func (*StartProcessResponse) ProtoMessage() {}
func (*StartProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{2} } func (*StartProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptorContainer, []int{2} }
type Container struct { type Container struct {
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
BundlePath string `protobuf:"bytes,2,opt,name=bundle_path,json=bundlePath,proto3" json:"bundle_path,omitempty"` BundlePath string `protobuf:"bytes,2,opt,name=bundle_path,json=bundlePath,proto3" json:"bundle_path,omitempty"`
Process *Process `protobuf:"bytes,3,opt,name=process" json:"process,omitempty"` Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.Status" json:"status,omitempty"`
Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.Status" json:"status,omitempty"`
} }
func (m *Container) Reset() { *m = Container{} } func (m *Container) Reset() { *m = Container{} }
@ -102,8 +101,7 @@ type Process struct {
User *User `protobuf:"bytes,5,opt,name=user" json:"user,omitempty"` User *User `protobuf:"bytes,5,opt,name=user" json:"user,omitempty"`
Cwd string `protobuf:"bytes,6,opt,name=cwd,proto3" json:"cwd,omitempty"` Cwd string `protobuf:"bytes,6,opt,name=cwd,proto3" json:"cwd,omitempty"`
Terminal bool `protobuf:"varint,7,opt,name=terminal,proto3" json:"terminal,omitempty"` Terminal bool `protobuf:"varint,7,opt,name=terminal,proto3" json:"terminal,omitempty"`
Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.Status" json:"status,omitempty"` ExitStatus uint32 `protobuf:"varint,8,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
ExitStatus uint32 `protobuf:"varint,9,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
} }
func (m *Process) Reset() { *m = Process{} } func (m *Process) Reset() { *m = Process{} }
@ -163,7 +161,7 @@ func (*ResumeContainerRequest) Descriptor() ([]byte, []int) { return fileDescrip
type GetProcessRequest struct { type GetProcessRequest struct {
Container *Container `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"` Container *Container `protobuf:"bytes,1,opt,name=container" json:"container,omitempty"`
Pid int64 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` ProcessId string `protobuf:"bytes,2,opt,name=process_id,json=processId,proto3" json:"process_id,omitempty"`
} }
func (m *GetProcessRequest) Reset() { *m = GetProcessRequest{} } func (m *GetProcessRequest) Reset() { *m = GetProcessRequest{} }
@ -275,13 +273,10 @@ func (this *Container) GoString() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
s := make([]string, 0, 8) s := make([]string, 0, 7)
s = append(s, "&execution.Container{") s = append(s, "&execution.Container{")
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n") s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n")
s = append(s, "BundlePath: "+fmt.Sprintf("%#v", this.BundlePath)+",\n") s = append(s, "BundlePath: "+fmt.Sprintf("%#v", this.BundlePath)+",\n")
if this.Process != nil {
s = append(s, "Process: "+fmt.Sprintf("%#v", this.Process)+",\n")
}
s = append(s, "Status: "+fmt.Sprintf("%#v", this.Status)+",\n") s = append(s, "Status: "+fmt.Sprintf("%#v", this.Status)+",\n")
s = append(s, "}") s = append(s, "}")
return strings.Join(s, "") return strings.Join(s, "")
@ -290,7 +285,7 @@ func (this *Process) GoString() string {
if this == nil { if this == nil {
return "nil" return "nil"
} }
s := make([]string, 0, 13) s := make([]string, 0, 12)
s = append(s, "&execution.Process{") s = append(s, "&execution.Process{")
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n") s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\n")
s = append(s, "Pid: "+fmt.Sprintf("%#v", this.Pid)+",\n") s = append(s, "Pid: "+fmt.Sprintf("%#v", this.Pid)+",\n")
@ -301,7 +296,6 @@ func (this *Process) GoString() string {
} }
s = append(s, "Cwd: "+fmt.Sprintf("%#v", this.Cwd)+",\n") s = append(s, "Cwd: "+fmt.Sprintf("%#v", this.Cwd)+",\n")
s = append(s, "Terminal: "+fmt.Sprintf("%#v", this.Terminal)+",\n") s = append(s, "Terminal: "+fmt.Sprintf("%#v", this.Terminal)+",\n")
s = append(s, "Status: "+fmt.Sprintf("%#v", this.Status)+",\n")
s = append(s, "ExitStatus: "+fmt.Sprintf("%#v", this.ExitStatus)+",\n") s = append(s, "ExitStatus: "+fmt.Sprintf("%#v", this.ExitStatus)+",\n")
s = append(s, "}") s = append(s, "}")
return strings.Join(s, "") return strings.Join(s, "")
@ -382,7 +376,7 @@ func (this *GetProcessRequest) GoString() string {
if this.Container != nil { if this.Container != nil {
s = append(s, "Container: "+fmt.Sprintf("%#v", this.Container)+",\n") s = append(s, "Container: "+fmt.Sprintf("%#v", this.Container)+",\n")
} }
s = append(s, "Pid: "+fmt.Sprintf("%#v", this.Pid)+",\n") s = append(s, "ProcessId: "+fmt.Sprintf("%#v", this.ProcessId)+",\n")
s = append(s, "}") s = append(s, "}")
return strings.Join(s, "") return strings.Join(s, "")
} }
@ -980,16 +974,6 @@ func (m *Container) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintContainer(dAtA, i, uint64(len(m.BundlePath))) i = encodeVarintContainer(dAtA, i, uint64(len(m.BundlePath)))
i += copy(dAtA[i:], m.BundlePath) i += copy(dAtA[i:], m.BundlePath)
} }
if m.Process != nil {
dAtA[i] = 0x1a
i++
i = encodeVarintContainer(dAtA, i, uint64(m.Process.Size()))
n3, err := m.Process.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n3
}
if m.Status != 0 { if m.Status != 0 {
dAtA[i] = 0x20 dAtA[i] = 0x20
i++ i++
@ -1058,11 +1042,11 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x2a dAtA[i] = 0x2a
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.User.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.User.Size()))
n4, err := m.User.MarshalTo(dAtA[i:]) n3, err := m.User.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n4 i += n3
} }
if len(m.Cwd) > 0 { if len(m.Cwd) > 0 {
dAtA[i] = 0x32 dAtA[i] = 0x32
@ -1080,13 +1064,8 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) {
} }
i++ i++
} }
if m.Status != 0 {
dAtA[i] = 0x40
i++
i = encodeVarintContainer(dAtA, i, uint64(m.Status))
}
if m.ExitStatus != 0 { if m.ExitStatus != 0 {
dAtA[i] = 0x48 dAtA[i] = 0x40
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.ExitStatus)) i = encodeVarintContainer(dAtA, i, uint64(m.ExitStatus))
} }
@ -1119,21 +1098,21 @@ func (m *User) MarshalTo(dAtA []byte) (int, error) {
i = encodeVarintContainer(dAtA, i, uint64(m.Gid)) i = encodeVarintContainer(dAtA, i, uint64(m.Gid))
} }
if len(m.AdditionalGids) > 0 { if len(m.AdditionalGids) > 0 {
dAtA6 := make([]byte, len(m.AdditionalGids)*10) dAtA5 := make([]byte, len(m.AdditionalGids)*10)
var j5 int var j4 int
for _, num := range m.AdditionalGids { for _, num := range m.AdditionalGids {
for num >= 1<<7 { for num >= 1<<7 {
dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80) dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7 num >>= 7
j5++ j4++
} }
dAtA6[j5] = uint8(num) dAtA5[j4] = uint8(num)
j5++ j4++
} }
dAtA[i] = 0x1a dAtA[i] = 0x1a
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(j5)) i = encodeVarintContainer(dAtA, i, uint64(j4))
i += copy(dAtA[i:], dAtA6[:j5]) i += copy(dAtA[i:], dAtA5[:j4])
} }
return i, nil return i, nil
} }
@ -1181,11 +1160,11 @@ func (m *GetContainerResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size()))
n7, err := m.Container.MarshalTo(dAtA[i:]) n6, err := m.Container.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n7 i += n6
} }
return i, nil return i, nil
} }
@ -1209,11 +1188,11 @@ func (m *UpdateContainerRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size()))
n8, err := m.Container.MarshalTo(dAtA[i:]) n7, err := m.Container.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n8 i += n7
} }
if len(m.BundlePath) > 0 { if len(m.BundlePath) > 0 {
dAtA[i] = 0x12 dAtA[i] = 0x12
@ -1291,16 +1270,17 @@ func (m *GetProcessRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size()))
n9, err := m.Container.MarshalTo(dAtA[i:]) n8, err := m.Container.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n9 i += n8
} }
if m.Pid != 0 { if len(m.ProcessId) > 0 {
dAtA[i] = 0x10 dAtA[i] = 0x12
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Pid)) i = encodeVarintContainer(dAtA, i, uint64(len(m.ProcessId)))
i += copy(dAtA[i:], m.ProcessId)
} }
return i, nil return i, nil
} }
@ -1324,11 +1304,11 @@ func (m *GetProcessResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Process.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Process.Size()))
n10, err := m.Process.MarshalTo(dAtA[i:]) n9, err := m.Process.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n10 i += n9
} }
return i, nil return i, nil
} }
@ -1352,21 +1332,21 @@ func (m *SignalProcessRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size()))
n11, err := m.Container.MarshalTo(dAtA[i:]) n10, err := m.Container.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n11 i += n10
} }
if m.Process != nil { if m.Process != nil {
dAtA[i] = 0x12 dAtA[i] = 0x12
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Process.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Process.Size()))
n12, err := m.Process.MarshalTo(dAtA[i:]) n11, err := m.Process.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n12 i += n11
} }
if m.Signal != 0 { if m.Signal != 0 {
dAtA[i] = 0x18 dAtA[i] = 0x18
@ -1395,21 +1375,21 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size()))
n13, err := m.Container.MarshalTo(dAtA[i:]) n12, err := m.Container.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n13 i += n12
} }
if m.Process != nil { if m.Process != nil {
dAtA[i] = 0x12 dAtA[i] = 0x12
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Process.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Process.Size()))
n14, err := m.Process.MarshalTo(dAtA[i:]) n13, err := m.Process.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n14 i += n13
} }
return i, nil return i, nil
} }
@ -1433,11 +1413,11 @@ func (m *ListProcessesRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa dAtA[i] = 0xa
i++ i++
i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size())) i = encodeVarintContainer(dAtA, i, uint64(m.Container.Size()))
n15, err := m.Container.MarshalTo(dAtA[i:]) n14, err := m.Container.MarshalTo(dAtA[i:])
if err != nil { if err != nil {
return 0, err return 0, err
} }
i += n15 i += n14
} }
return i, nil return i, nil
} }
@ -1556,10 +1536,6 @@ func (m *Container) Size() (n int) {
if l > 0 { if l > 0 {
n += 1 + l + sovContainer(uint64(l)) n += 1 + l + sovContainer(uint64(l))
} }
if m.Process != nil {
l = m.Process.Size()
n += 1 + l + sovContainer(uint64(l))
}
if m.Status != 0 { if m.Status != 0 {
n += 1 + sovContainer(uint64(m.Status)) n += 1 + sovContainer(uint64(m.Status))
} }
@ -1599,9 +1575,6 @@ func (m *Process) Size() (n int) {
if m.Terminal { if m.Terminal {
n += 2 n += 2
} }
if m.Status != 0 {
n += 1 + sovContainer(uint64(m.Status))
}
if m.ExitStatus != 0 { if m.ExitStatus != 0 {
n += 1 + sovContainer(uint64(m.ExitStatus)) n += 1 + sovContainer(uint64(m.ExitStatus))
} }
@ -1688,8 +1661,9 @@ func (m *GetProcessRequest) Size() (n int) {
l = m.Container.Size() l = m.Container.Size()
n += 1 + l + sovContainer(uint64(l)) n += 1 + l + sovContainer(uint64(l))
} }
if m.Pid != 0 { l = len(m.ProcessId)
n += 1 + sovContainer(uint64(m.Pid)) if l > 0 {
n += 1 + l + sovContainer(uint64(l))
} }
return n return n
} }
@ -1811,7 +1785,6 @@ func (this *Container) String() string {
s := strings.Join([]string{`&Container{`, s := strings.Join([]string{`&Container{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`, `ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`BundlePath:` + fmt.Sprintf("%v", this.BundlePath) + `,`, `BundlePath:` + fmt.Sprintf("%v", this.BundlePath) + `,`,
`Process:` + strings.Replace(fmt.Sprintf("%v", this.Process), "Process", "Process", 1) + `,`,
`Status:` + fmt.Sprintf("%v", this.Status) + `,`, `Status:` + fmt.Sprintf("%v", this.Status) + `,`,
`}`, `}`,
}, "") }, "")
@ -1829,7 +1802,6 @@ func (this *Process) String() string {
`User:` + strings.Replace(fmt.Sprintf("%v", this.User), "User", "User", 1) + `,`, `User:` + strings.Replace(fmt.Sprintf("%v", this.User), "User", "User", 1) + `,`,
`Cwd:` + fmt.Sprintf("%v", this.Cwd) + `,`, `Cwd:` + fmt.Sprintf("%v", this.Cwd) + `,`,
`Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`, `Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`,
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`, `ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`}`, `}`,
}, "") }, "")
@ -1904,7 +1876,7 @@ func (this *GetProcessRequest) String() string {
} }
s := strings.Join([]string{`&GetProcessRequest{`, s := strings.Join([]string{`&GetProcessRequest{`,
`Container:` + strings.Replace(fmt.Sprintf("%v", this.Container), "Container", "Container", 1) + `,`, `Container:` + strings.Replace(fmt.Sprintf("%v", this.Container), "Container", "Container", 1) + `,`,
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`, `ProcessId:` + fmt.Sprintf("%v", this.ProcessId) + `,`,
`}`, `}`,
}, "") }, "")
return s return s
@ -2418,39 +2390,6 @@ func (m *Container) Unmarshal(dAtA []byte) error {
} }
m.BundlePath = string(dAtA[iNdEx:postIndex]) m.BundlePath = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Process", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthContainer
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
if m.Process == nil {
m.Process = &Process{}
}
if err := m.Process.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4: case 4:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
@ -2709,25 +2648,6 @@ func (m *Process) Unmarshal(dAtA []byte) error {
} }
m.Terminal = bool(v != 0) m.Terminal = bool(v != 0)
case 8: case 8:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType)
}
m.Status = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Status |= (Status(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 9:
if wireType != 0 { if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType)
} }
@ -3412,10 +3332,10 @@ func (m *GetProcessRequest) Unmarshal(dAtA []byte) error {
} }
iNdEx = postIndex iNdEx = postIndex
case 2: case 2:
if wireType != 0 { if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType) return fmt.Errorf("proto: wrong wireType = %d for field ProcessId", wireType)
} }
m.Pid = 0 var stringLen uint64
for shift := uint(0); ; shift += 7 { for shift := uint(0); ; shift += 7 {
if shift >= 64 { if shift >= 64 {
return ErrIntOverflowContainer return ErrIntOverflowContainer
@ -3425,11 +3345,21 @@ func (m *GetProcessRequest) Unmarshal(dAtA []byte) error {
} }
b := dAtA[iNdEx] b := dAtA[iNdEx]
iNdEx++ iNdEx++
m.Pid |= (int64(b) & 0x7F) << shift stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 { if b < 0x80 {
break break
} }
} }
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthContainer
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ProcessId = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default: default:
iNdEx = preIndex iNdEx = preIndex
skippy, err := skipContainer(dAtA[iNdEx:]) skippy, err := skipContainer(dAtA[iNdEx:])
@ -4057,59 +3987,59 @@ var (
func init() { proto.RegisterFile("container.proto", fileDescriptorContainer) } func init() { proto.RegisterFile("container.proto", fileDescriptorContainer) }
var fileDescriptorContainer = []byte{ var fileDescriptorContainer = []byte{
// 855 bytes of a gzipped FileDescriptorProto // 856 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x6e, 0xeb, 0x44, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x93, 0xe2, 0x44,
0x10, 0xee, 0xc6, 0xa9, 0xd3, 0x4c, 0x8e, 0x0f, 0x61, 0x9b, 0x46, 0x56, 0x40, 0x39, 0x39, 0xe6, 0x14, 0x9e, 0x26, 0x4c, 0x18, 0x1e, 0x9b, 0x15, 0x7b, 0x18, 0x2a, 0x85, 0xca, 0xb2, 0x71, 0x55,
0x00, 0x11, 0x52, 0x93, 0x12, 0x10, 0x37, 0x5c, 0xb5, 0x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 0x92, 0xb1, 0x47, 0xd6, 0x2a, 0x3f, 0x07, 0x65, 0x21, 0x21, 0x4f, 0x41, 0xdb, 0xe8, 0x14, 0x38, 0x45, 0x24, 0xa3, 0x8f, 0x6c, 0xcd, 0xfc, 0x14,
0x65, 0xb8, 0x53, 0x68, 0x59, 0xa3, 0xbf, 0x16, 0xed, 0x1b, 0x50, 0x56, 0x06, 0x2b, 0x85, 0x96, 0xb4, 0x0d, 0x71, 0xa7, 0xd0, 0xb2, 0xa4, 0xbf, 0x15, 0xed, 0x6b, 0xd0, 0x36, 0x84, 0x95, 0x42,
0x35, 0xc6, 0xb5, 0x57, 0x9b, 0x93, 0x02, 0xdd, 0x27, 0x6f, 0x3f, 0x3c, 0xd6, 0x77, 0x7e, 0x7f, 0xcb, 0x92, 0x71, 0xed, 0xc9, 0xee, 0xa0, 0x30, 0xef, 0x17, 0x6f, 0xde, 0xdc, 0xd6, 0x0f, 0x7e,
0xac, 0xef, 0xfc, 0xf5, 0x58, 0x47, 0xf7, 0xf3, 0x3a, 0x7a, 0x98, 0xd7, 0xd1, 0x6f, 0xf3, 0x3a, 0xbb, 0xad, 0x1f, 0xfc, 0x79, 0x5b, 0x47, 0xd7, 0xab, 0x3a, 0xba, 0x59, 0xd5, 0xd1, 0x2f, 0xab,
0xfa, 0x73, 0x5e, 0x47, 0x57, 0xb2, 0x60, 0xf2, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81, 0x3a, 0xfa, 0x63, 0x55, 0x47, 0x67, 0xaa, 0x60, 0xf2, 0xe1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff,
0x9a, 0x9a, 0xae, 0xc5, 0x0a, 0x00, 0x00, 0xc5, 0xc3, 0xa7, 0x16, 0x70, 0x0a, 0x00, 0x00,
} }

View file

@ -38,7 +38,6 @@ message StartProcessResponse {
message Container { message Container {
string id = 1 [(gogoproto.customname) = "ID"]; string id = 1 [(gogoproto.customname) = "ID"];
string bundle_path = 2; string bundle_path = 2;
Process process = 3;
Status status = 4; Status status = 4;
} }
@ -50,8 +49,7 @@ message Process {
User user = 5; User user = 5;
string cwd = 6; string cwd = 6;
bool terminal = 7; bool terminal = 7;
Status status = 8; uint32 exit_status = 8;
uint32 exit_status = 9;
} }
enum Status { enum Status {
@ -90,7 +88,7 @@ message ResumeContainerRequest {
message GetProcessRequest { message GetProcessRequest {
Container container = 1; Container container = 1;
int64 pid = 2; string process_id = 2;
} }
message GetProcessResponse { message GetProcessResponse {

View file

@ -14,6 +14,7 @@ import (
"github.com/docker/containerd" "github.com/docker/containerd"
api "github.com/docker/containerd/api/execution" api "github.com/docker/containerd/api/execution"
"github.com/docker/containerd/execution" "github.com/docker/containerd/execution"
"github.com/docker/containerd/execution/executors/oci"
// metrics "github.com/docker/go-metrics" // metrics "github.com/docker/go-metrics"
"github.com/urfave/cli" "github.com/urfave/cli"
) )
@ -80,10 +81,13 @@ high performance container runtime
return err return err
} }
execService, err := execution.New(execution.Opts{ var executor execution.Executor
Root: context.GlobalString("root"), switch context.GlobalString("runtime") {
Runtime: context.GlobalString("runtime"), case "runc":
}) executor = oci.New(context.GlobalString("root"))
}
execService, err := execution.New(executor)
if err != nil { if err != nil {
return err return err
} }

View file

@ -15,7 +15,7 @@ func NewContainer(stateRoot, id, bundle string) (*Container, error) {
}, nil }, nil
} }
func LoadContainer(dir StateDir, id, bundle string, initPid int) *Container { func LoadContainer(dir StateDir, id, bundle string, initPid int64) *Container {
return &Container{ return &Container{
id: id, id: id,
stateDir: dir, stateDir: dir,
@ -29,7 +29,7 @@ type Container struct {
id string id string
bundle string bundle string
stateDir StateDir stateDir StateDir
initPid int initPid int64
processes map[string]Process processes map[string]Process
} }
@ -52,7 +52,7 @@ func (c *Container) Wait() (uint32, error) {
return p.Wait() return p.Wait()
} }
} }
return nil, fmt.Errorf("no init process") return 0, fmt.Errorf("no init process")
} }
func (c *Container) AddProcess(p Process, isInit bool) { func (c *Container) AddProcess(p Process, isInit bool) {

View file

@ -32,6 +32,6 @@ type Executor interface {
Start(*Container) error Start(*Container) error
StartProcess(*Container, CreateProcessOpts) (Process, error) StartProcess(*Container, CreateProcessOpts) (Process, error)
SignalProcess(*Container, os.Signal) error SignalProcess(*Container, string, os.Signal) error
DeleteProcess(*Container, string) error DeleteProcess(*Container, string) error
} }

View file

@ -3,7 +3,6 @@ package oci
import ( import (
"errors" "errors"
"fmt" "fmt"
"io/ioutil"
"os" "os"
"path/filepath" "path/filepath"
"syscall" "syscall"
@ -17,7 +16,7 @@ var ErrRootEmpty = errors.New("oci: runtime root cannot be an empty string")
func New(root string) *OCIRuntime { func New(root string) *OCIRuntime {
return &OCIRuntime{ return &OCIRuntime{
root: root, root: root,
Runc: &runc.Runc{ runc: &runc.Runc{
Root: filepath.Join(root, "runc"), Root: filepath.Join(root, "runc"),
}, },
} }
@ -38,20 +37,23 @@ func (r *OCIRuntime) Create(id string, o execution.CreateOpts) (container *execu
container.StateDir().Delete() container.StateDir().Delete()
} }
}() }()
var ( initDir, err := container.StateDir().NewProcess()
initDir = container.StateDir().NewProcess() if err != nil {
pidFile = filepath.Join(initDir, "pid") return nil, err
) }
pidFile := filepath.Join(initDir, "pid")
err = r.runc.Create(id, o.Bundle, &runc.CreateOpts{ err = r.runc.Create(id, o.Bundle, &runc.CreateOpts{
Pidfile: pidfile, PidFile: pidFile,
Stdin: o.Stdin, IO: runc.IO{
Stdout: o.Stdout, Stdin: o.Stdin,
Stderr: o.Stderr, Stdout: o.Stdout,
Stderr: o.Stderr,
},
}) })
if err != nil { if err != nil {
return nil, err return nil, err
} }
pid, err := runc.ReadPifFile(pidfile) pid, err := runc.ReadPidFile(pidFile)
if err != nil { if err != nil {
// TODO: kill the container if we are going to return // TODO: kill the container if we are going to return
return nil, err return nil, err
@ -66,14 +68,27 @@ func (r *OCIRuntime) Create(id string, o execution.CreateOpts) (container *execu
return container, nil return container, nil
} }
func (r *OCIRuntime) Start(c *execution.Container) error {
return r.runc.Start(c.ID())
}
func (r *OCIRuntime) Status(c *execution.Container) (execution.Status, error) {
state, err := r.runc.State(c.ID())
if err != nil {
return "", err
}
return execution.Status(state.Status), nil
}
func (r *OCIRuntime) load(runcC *runc.Container) (*execution.Container, error) { func (r *OCIRuntime) load(runcC *runc.Container) (*execution.Container, error) {
container := execution.LoadContainer( container := execution.LoadContainer(
execution.StateDir(filepath.Join(r.root, runcC.ID)), execution.StateDir(filepath.Join(r.root, runcC.ID)),
runcC.ID, runcC.ID,
runcC.Bundle, runcC.Bundle,
int64(runcC.Pid),
) )
dirs, err := ioutil.ReadDir(filepath.Join(container.StateDir().Processes())) dirs, err := container.StateDir().Processes()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -98,7 +113,7 @@ func (r *OCIRuntime) List() ([]*execution.Container, error) {
return nil, err return nil, err
} }
containers := make([]*execution.Container) var containers []*execution.Container
for _, c := range runcCs { for _, c := range runcCs {
container, err := r.load(c) container, err := r.load(c)
if err != nil { if err != nil {
@ -120,56 +135,55 @@ func (r *OCIRuntime) Load(id string) (*execution.Container, error) {
} }
func (r *OCIRuntime) Delete(c *execution.Container) error { func (r *OCIRuntime) Delete(c *execution.Container) error {
if err := r.runc.Delete(c.ID); err != nil { if err := r.runc.Delete(c.ID()); err != nil {
return err return err
} }
c.StateDir.Delete() c.StateDir().Delete()
return nil return nil
} }
func (r *OCIRuntime) Pause(c *execution.Container) error { func (r *OCIRuntime) Pause(c *execution.Container) error {
return r.runc.Pause(c.ID) return r.runc.Pause(c.ID())
} }
func (r *OCIRuntime) Resume(c *execution.Container) error { func (r *OCIRuntime) Resume(c *execution.Container) error {
return r.runc.Resume(c.ID) return r.runc.Resume(c.ID())
} }
func (r *OCIRuntime) StartProcess(c *execution.Container, o CreateProcessOpts) (execution.Process, error) { func (r *OCIRuntime) StartProcess(c *execution.Container, o execution.CreateProcessOpts) (p execution.Process, err error) {
var err error processStateDir, err := c.StateDir().NewProcess()
processStateDir, err := c.StateDir.NewProcess()
if err != nil { if err != nil {
return nil, err return nil, err
} }
defer func() { defer func() {
if err != nil { if err != nil {
c.StateDir.DeleteProcess(filepath.Base(processStateDir)) c.StateDir().DeleteProcess(filepath.Base(processStateDir))
} }
}() }()
pidFile := filepath.Join(processStateDir, id) pidFile := filepath.Join(processStateDir, "pid")
err := r.runc.ExecProcess(c.ID, o.spec, &runc.ExecOpts{ if err := r.runc.ExecProcess(c.ID(), o.Spec, &runc.ExecOpts{
PidFile: pidfile, PidFile: pidFile,
Detach: true, Detach: true,
Stdin: o.stdin, IO: runc.IO{
Stdout: o.stdout, Stdin: o.Stdin,
Stderr: o.stderr, Stdout: o.Stdout,
}) Stderr: o.Stderr,
if err != nil { },
}); err != nil {
return nil, err return nil, err
} }
pid, err := runc.ReadPidFile(pidfile) pid, err := runc.ReadPidFile(pidFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }
process, err := newProcess(pid) process, err := newProcess(filepath.Base(processStateDir), pid)
if err != nil { if err != nil {
return nil, err return nil, err
} }
container.AddProcess(process, false) c.AddProcess(process, false)
return process, nil return process, nil
} }
@ -179,14 +193,9 @@ func (r *OCIRuntime) SignalProcess(c *execution.Container, id string, sig os.Sig
if process == nil { if process == nil {
return fmt.Errorf("Make a Process Not Found error") return fmt.Errorf("Make a Process Not Found error")
} }
return syscall.Kill(int(process.Pid()), os.Signal) return syscall.Kill(int(process.Pid()), sig.(syscall.Signal))
}
func (r *OCIRuntime) GetProcess(c *execution.Container, id string) process {
return c.GetProcess(id)
} }
func (r *OCIRuntime) DeleteProcess(c *execution.Container, id string) error { func (r *OCIRuntime) DeleteProcess(c *execution.Container, id string) error {
c.StateDir.DeleteProcess(id) return c.StateDir().DeleteProcess(id)
return nil
} }

View file

@ -27,8 +27,8 @@ func (p *process) ID() string {
return p.id return p.id
} }
func (p *process) Pid() int { func (p *process) Pid() int64 {
return p.proc.Pid return int64(p.proc.Pid)
} }
func (p *process) Wait() (uint32, error) { func (p *process) Wait() (uint32, error) {

View file

@ -2,6 +2,7 @@ package execution
import ( import (
"fmt" "fmt"
"syscall"
api "github.com/docker/containerd/api/execution" api "github.com/docker/containerd/api/execution"
google_protobuf "github.com/golang/protobuf/ptypes/empty" google_protobuf "github.com/golang/protobuf/ptypes/empty"
@ -9,21 +10,15 @@ import (
"golang.org/x/net/context" "golang.org/x/net/context"
) )
type ServiceOpts struct { func New(executor Executor) (*Service, error) {
Root string
Runtime string
}
func New(opts ServiceOpts, executor Executor) (*Service, error) {
return &Service{ return &Service{
o: opts,
executor: executor, executor: executor,
}, nil }, nil
} }
type Service struct { type Service struct {
o ServiceOpts executor Executor
executor Executor supervisor *Supervisor
} }
func (s *Service) Create(ctx context.Context, r *api.CreateContainerRequest) (*api.CreateContainerResponse, error) { func (s *Service) Create(ctx context.Context, r *api.CreateContainerRequest) (*api.CreateContainerResponse, error) {
@ -138,7 +133,7 @@ func (s *Service) GetProcess(ctx context.Context, r *api.GetProcessRequest) (*ap
if err != nil { if err != nil {
return nil, err return nil, err
} }
process := s.executor.GetProcess(r.Pid) process := container.GetProcess(r.ProcessId)
if process == nil { if process == nil {
return nil, fmt.Errorf("Make me a constant! Process not foumd!") return nil, fmt.Errorf("Make me a constant! Process not foumd!")
} }
@ -152,7 +147,11 @@ func (s *Service) SignalProcess(ctx context.Context, r *api.SignalProcessRequest
if err != nil { if err != nil {
return nil, err return nil, err
} }
return nil, s.executor.SignalProcess(container, r.Process.ID, r.Signal) process := container.GetProcess(r.Process.ID)
if process == nil {
return nil, fmt.Errorf("Make me a constant! Process not foumd!")
}
return nil, process.Signal(syscall.Signal(r.Signal))
} }
func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest) (*google_protobuf.Empty, error) { func (s *Service) DeleteProcess(ctx context.Context, r *api.DeleteProcessRequest) (*google_protobuf.Empty, error) {
@ -181,3 +180,25 @@ var (
_ = (api.ExecutionServiceServer)(&Service{}) _ = (api.ExecutionServiceServer)(&Service{})
_ = (api.ContainerServiceServer)(&Service{}) _ = (api.ContainerServiceServer)(&Service{})
) )
func toGRPCContainer(container *Container) *api.Container {
return &api.Container{
ID: container.ID(),
BundlePath: container.Bundle(),
}
}
func toGRPCProcesses(processes []Process) []*api.Process {
var out []*api.Process
for _, p := range processes {
out = append(out, toGRPCProcess(p))
}
return out
}
func toGRPCProcess(process Process) *api.Process {
return &api.Process{
ID: process.ID(),
Pid: process.Pid(),
}
}

View file

@ -19,7 +19,7 @@ func NewStateDir(root, id string) (StateDir, error) {
os.RemoveAll(path) os.RemoveAll(path)
return "", err return "", err
} }
return StateDir(path), err return StateDir(path), nil
} }
func (s StateDir) Delete() error { func (s StateDir) Delete() error {