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} }
type Container struct {
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"`
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"`
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"`
Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.Status" json:"status,omitempty"`
}
func (m *Container) Reset() { *m = Container{} }
@ -102,8 +101,7 @@ type Process struct {
User *User `protobuf:"bytes,5,opt,name=user" json:"user,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"`
Status Status `protobuf:"varint,8,opt,name=status,proto3,enum=containerd.v1.Status" json:"status,omitempty"`
ExitStatus uint32 `protobuf:"varint,9,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
ExitStatus uint32 `protobuf:"varint,8,opt,name=exit_status,json=exitStatus,proto3" json:"exit_status,omitempty"`
}
func (m *Process) Reset() { *m = Process{} }
@ -163,7 +161,7 @@ func (*ResumeContainerRequest) Descriptor() ([]byte, []int) { return fileDescrip
type GetProcessRequest struct {
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{} }
@ -275,13 +273,10 @@ func (this *Container) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 8)
s := make([]string, 0, 7)
s = append(s, "&execution.Container{")
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\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, "}")
return strings.Join(s, "")
@ -290,7 +285,7 @@ func (this *Process) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 13)
s := make([]string, 0, 12)
s = append(s, "&execution.Process{")
s = append(s, "ID: "+fmt.Sprintf("%#v", this.ID)+",\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, "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, "}")
return strings.Join(s, "")
@ -382,7 +376,7 @@ func (this *GetProcessRequest) GoString() string {
if this.Container != nil {
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, "}")
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 += 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 {
dAtA[i] = 0x20
i++
@ -1058,11 +1042,11 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0x2a
i++
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 {
return 0, err
}
i += n4
i += n3
}
if len(m.Cwd) > 0 {
dAtA[i] = 0x32
@ -1080,13 +1064,8 @@ func (m *Process) MarshalTo(dAtA []byte) (int, error) {
}
i++
}
if m.Status != 0 {
dAtA[i] = 0x40
i++
i = encodeVarintContainer(dAtA, i, uint64(m.Status))
}
if m.ExitStatus != 0 {
dAtA[i] = 0x48
dAtA[i] = 0x40
i++
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))
}
if len(m.AdditionalGids) > 0 {
dAtA6 := make([]byte, len(m.AdditionalGids)*10)
var j5 int
dAtA5 := make([]byte, len(m.AdditionalGids)*10)
var j4 int
for _, num := range m.AdditionalGids {
for num >= 1<<7 {
dAtA6[j5] = uint8(uint64(num)&0x7f | 0x80)
dAtA5[j4] = uint8(uint64(num)&0x7f | 0x80)
num >>= 7
j5++
j4++
}
dAtA6[j5] = uint8(num)
j5++
dAtA5[j4] = uint8(num)
j4++
}
dAtA[i] = 0x1a
i++
i = encodeVarintContainer(dAtA, i, uint64(j5))
i += copy(dAtA[i:], dAtA6[:j5])
i = encodeVarintContainer(dAtA, i, uint64(j4))
i += copy(dAtA[i:], dAtA5[:j4])
}
return i, nil
}
@ -1181,11 +1160,11 @@ func (m *GetContainerResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
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 {
return 0, err
}
i += n7
i += n6
}
return i, nil
}
@ -1209,11 +1188,11 @@ func (m *UpdateContainerRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
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 {
return 0, err
}
i += n8
i += n7
}
if len(m.BundlePath) > 0 {
dAtA[i] = 0x12
@ -1291,16 +1270,17 @@ func (m *GetProcessRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
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 {
return 0, err
}
i += n9
i += n8
}
if m.Pid != 0 {
dAtA[i] = 0x10
if len(m.ProcessId) > 0 {
dAtA[i] = 0x12
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
}
@ -1324,11 +1304,11 @@ func (m *GetProcessResponse) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
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 {
return 0, err
}
i += n10
i += n9
}
return i, nil
}
@ -1352,21 +1332,21 @@ func (m *SignalProcessRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
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 {
return 0, err
}
i += n11
i += n10
}
if m.Process != nil {
dAtA[i] = 0x12
i++
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 {
return 0, err
}
i += n12
i += n11
}
if m.Signal != 0 {
dAtA[i] = 0x18
@ -1395,21 +1375,21 @@ func (m *DeleteProcessRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
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 {
return 0, err
}
i += n13
i += n12
}
if m.Process != nil {
dAtA[i] = 0x12
i++
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 {
return 0, err
}
i += n14
i += n13
}
return i, nil
}
@ -1433,11 +1413,11 @@ func (m *ListProcessesRequest) MarshalTo(dAtA []byte) (int, error) {
dAtA[i] = 0xa
i++
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 {
return 0, err
}
i += n15
i += n14
}
return i, nil
}
@ -1556,10 +1536,6 @@ func (m *Container) Size() (n int) {
if l > 0 {
n += 1 + l + sovContainer(uint64(l))
}
if m.Process != nil {
l = m.Process.Size()
n += 1 + l + sovContainer(uint64(l))
}
if m.Status != 0 {
n += 1 + sovContainer(uint64(m.Status))
}
@ -1599,9 +1575,6 @@ func (m *Process) Size() (n int) {
if m.Terminal {
n += 2
}
if m.Status != 0 {
n += 1 + sovContainer(uint64(m.Status))
}
if m.ExitStatus != 0 {
n += 1 + sovContainer(uint64(m.ExitStatus))
}
@ -1688,8 +1661,9 @@ func (m *GetProcessRequest) Size() (n int) {
l = m.Container.Size()
n += 1 + l + sovContainer(uint64(l))
}
if m.Pid != 0 {
n += 1 + sovContainer(uint64(m.Pid))
l = len(m.ProcessId)
if l > 0 {
n += 1 + l + sovContainer(uint64(l))
}
return n
}
@ -1811,7 +1785,6 @@ func (this *Container) String() string {
s := strings.Join([]string{`&Container{`,
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
`BundlePath:` + fmt.Sprintf("%v", this.BundlePath) + `,`,
`Process:` + strings.Replace(fmt.Sprintf("%v", this.Process), "Process", "Process", 1) + `,`,
`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) + `,`,
`Cwd:` + fmt.Sprintf("%v", this.Cwd) + `,`,
`Terminal:` + fmt.Sprintf("%v", this.Terminal) + `,`,
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
`ExitStatus:` + fmt.Sprintf("%v", this.ExitStatus) + `,`,
`}`,
}, "")
@ -1904,7 +1876,7 @@ func (this *GetProcessRequest) String() string {
}
s := strings.Join([]string{`&GetProcessRequest{`,
`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
@ -2418,39 +2390,6 @@ func (m *Container) Unmarshal(dAtA []byte) error {
}
m.BundlePath = string(dAtA[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:
if wireType != 0 {
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)
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 {
return fmt.Errorf("proto: wrong wireType = %d for field ExitStatus", wireType)
}
@ -3412,10 +3332,10 @@ func (m *GetProcessRequest) Unmarshal(dAtA []byte) error {
}
iNdEx = postIndex
case 2:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Pid", wireType)
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ProcessId", wireType)
}
m.Pid = 0
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowContainer
@ -3425,11 +3345,21 @@ func (m *GetProcessRequest) Unmarshal(dAtA []byte) error {
}
b := dAtA[iNdEx]
iNdEx++
m.Pid |= (int64(b) & 0x7F) << shift
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
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:
iNdEx = preIndex
skippy, err := skipContainer(dAtA[iNdEx:])
@ -4057,59 +3987,59 @@ var (
func init() { proto.RegisterFile("container.proto", fileDescriptorContainer) }
var fileDescriptorContainer = []byte{
// 855 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0xdd, 0x6e, 0xeb, 0x44,
0x10, 0xee, 0xc6, 0xa9, 0xd3, 0x4c, 0x8e, 0x0f, 0x61, 0x9b, 0x46, 0x56, 0x40, 0x39, 0x39, 0xe6,
0x00, 0x11, 0x52, 0x93, 0x12, 0x10, 0x37, 0x5c, 0xb5, 0x4d, 0x08, 0x95, 0x4a, 0x08, 0x9b, 0x46,
0x48, 0x48, 0xa8, 0x72, 0xe3, 0x25, 0xb5, 0x94, 0xda, 0xae, 0xbd, 0x2e, 0x70, 0xd7, 0xc7, 0xe0,
0x05, 0xe0, 0x9a, 0xc7, 0xe8, 0x25, 0x97, 0x5c, 0x21, 0x9a, 0x27, 0xe0, 0x11, 0xd0, 0xae, 0x7f,
0x92, 0xd8, 0x4e, 0x08, 0x05, 0xe9, 0xdc, 0xcd, 0x8c, 0x67, 0x3e, 0x7f, 0xdf, 0x78, 0x67, 0xd6,
0xf0, 0xc6, 0xc4, 0xb6, 0x98, 0x6e, 0x5a, 0xd4, 0x6d, 0x39, 0xae, 0xcd, 0x6c, 0xac, 0xc4, 0x01,
0xa3, 0x75, 0xf7, 0x61, 0xed, 0xad, 0xa9, 0x6d, 0x4f, 0x67, 0xb4, 0x2d, 0x1e, 0x5e, 0xf9, 0xdf,
0xb5, 0xe9, 0x8d, 0xc3, 0x7e, 0x0c, 0x72, 0x6b, 0x95, 0xa9, 0x3d, 0xb5, 0x85, 0xd9, 0xe6, 0x56,
0x10, 0xd5, 0xda, 0x70, 0x30, 0x62, 0xba, 0xcb, 0x4e, 0x23, 0x20, 0x42, 0x6f, 0x7d, 0xea, 0x31,
0x5c, 0x85, 0x9c, 0x69, 0xa8, 0xa8, 0x81, 0x9a, 0x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 0x30,
0xc7, 0x29, 0x3e, 0xd9, 0xe3, 0xbd, 0x89, 0x8f, 0xb8, 0x7c, 0x53, 0x7c, 0x32, 0x7f, 0x3b, 0xd6,
0xc2, 0x7c, 0x0d, 0xcf, 0x96, 0xef, 0xf0, 0x54, 0xe3, 0x33, 0x7e, 0x49, 0x52, 0x8d, 0xcf, 0xfc,
0x09, 0xf8, 0x0a, 0x60, 0xb1, 0x1f, 0x70, 0x23, 0xfd, 0xad, 0x12, 0xa0, 0x2f, 0x37, 0x64, 0x84,
0x90, 0xe7, 0xa0, 0xac, 0x6c, 0x0a, 0x9c, 0x22, 0x92, 0xb1, 0x47, 0xd6, 0x2a, 0x3f, 0x07, 0x65,
0x65, 0xb8, 0x53, 0x68, 0x59, 0xa3, 0xbf, 0x16, 0xed, 0x1b, 0x50, 0x56, 0x06, 0x2b, 0x85, 0x96,
0x35, 0xc6, 0xb5, 0x57, 0x9b, 0x93, 0x02, 0xdd, 0x27, 0x6f, 0x3f, 0x3c, 0xd6, 0x77, 0x7e, 0x7f,
0xac, 0xef, 0xfc, 0xf5, 0x58, 0x47, 0xf7, 0xf3, 0x3a, 0x7a, 0x98, 0xd7, 0xd1, 0x6f, 0xf3, 0x3a,
0xfa, 0x73, 0x5e, 0x47, 0x57, 0xb2, 0x60, 0xf2, 0xd1, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x81,
0x9a, 0x9a, 0xae, 0xc5, 0x0a, 0x00, 0x00,
// 856 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xc4, 0x56, 0x41, 0x93, 0xe2, 0x44,
0x14, 0x9e, 0x26, 0x4c, 0x18, 0x1e, 0x9b, 0x15, 0x7b, 0x18, 0x2a, 0x85, 0xca, 0xb2, 0x71, 0x55,
0xca, 0xaa, 0x85, 0x15, 0x2d, 0x2f, 0x9e, 0x76, 0x17, 0x44, 0xaa, 0x46, 0xc4, 0x66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xfc, 0x14,
0xb4, 0x0d, 0x71, 0xa7, 0xd0, 0xb2, 0xa4, 0xbf, 0x15, 0xed, 0x6b, 0xd0, 0x36, 0x84, 0x95, 0x42,
0xcb, 0x92, 0x71, 0xed, 0xc9, 0xee, 0xa0, 0x30, 0xef, 0x17, 0x6f, 0xde, 0xdc, 0xd6, 0x0f, 0x7e,
0xbb, 0xad, 0x1f, 0xfc, 0x79, 0x5b, 0x47, 0xd7, 0xab, 0x3a, 0xba, 0x59, 0xd5, 0xd1, 0x2f, 0xab,
0x3a, 0xfa, 0x63, 0x55, 0x47, 0x67, 0xaa, 0x60, 0xf2, 0xe1, 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff,
0xc5, 0xc3, 0xa7, 0x16, 0x70, 0x0a, 0x00, 0x00,
}

View File

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

View File

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

View File

@ -15,7 +15,7 @@ func NewContainer(stateRoot, id, bundle string) (*Container, error) {
}, nil
}
func LoadContainer(dir StateDir, id, bundle string, initPid int) *Container {
func LoadContainer(dir StateDir, id, bundle string, initPid int64) *Container {
return &Container{
id: id,
stateDir: dir,
@ -29,7 +29,7 @@ type Container struct {
id string
bundle string
stateDir StateDir
initPid int
initPid int64
processes map[string]Process
}
@ -52,7 +52,7 @@ func (c *Container) Wait() (uint32, error) {
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) {

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@ package execution
import (
"fmt"
"syscall"
api "github.com/docker/containerd/api/execution"
google_protobuf "github.com/golang/protobuf/ptypes/empty"
@ -9,21 +10,15 @@ import (
"golang.org/x/net/context"
)
type ServiceOpts struct {
Root string
Runtime string
}
func New(opts ServiceOpts, executor Executor) (*Service, error) {
func New(executor Executor) (*Service, error) {
return &Service{
o: opts,
executor: executor,
}, nil
}
type Service struct {
o ServiceOpts
executor Executor
executor Executor
supervisor *Supervisor
}
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 {
return nil, err
}
process := s.executor.GetProcess(r.Pid)
process := container.GetProcess(r.ProcessId)
if process == nil {
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 {
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) {
@ -181,3 +180,25 @@ var (
_ = (api.ExecutionServiceServer)(&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)
return "", err
}
return StateDir(path), err
return StateDir(path), nil
}
func (s StateDir) Delete() error {