api: implement fetching the container status
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
This commit is contained in:
parent
a7ef3e5313
commit
899a52d655
8 changed files with 190 additions and 112 deletions
|
@ -169,7 +169,8 @@ type StateResponse struct {
|
|||
ID string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Bundle string `protobuf:"bytes,2,opt,name=bundle,proto3" json:"bundle,omitempty"`
|
||||
Pid uint32 `protobuf:"varint,3,opt,name=pid,proto3" json:"pid,omitempty"`
|
||||
Processes []*containerd_v1_types1.Process `protobuf:"bytes,4,rep,name=processes" json:"processes,omitempty"`
|
||||
Status containerd_v1_types1.Status `protobuf:"varint,4,opt,name=status,proto3,enum=containerd.v1.types.Status" json:"status,omitempty"`
|
||||
Processes []*containerd_v1_types1.Process `protobuf:"bytes,5,rep,name=processes" json:"processes,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StateResponse) Reset() { *m = StateResponse{} }
|
||||
|
@ -1084,9 +1085,14 @@ func (m *StateResponse) MarshalTo(dAtA []byte) (int, error) {
|
|||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(m.Pid))
|
||||
}
|
||||
if m.Status != 0 {
|
||||
dAtA[i] = 0x20
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(m.Status))
|
||||
}
|
||||
if len(m.Processes) > 0 {
|
||||
for _, msg := range m.Processes {
|
||||
dAtA[i] = 0x22
|
||||
dAtA[i] = 0x2a
|
||||
i++
|
||||
i = encodeVarintShim(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
|
@ -1385,6 +1391,9 @@ func (m *StateResponse) Size() (n int) {
|
|||
if m.Pid != 0 {
|
||||
n += 1 + sovShim(uint64(m.Pid))
|
||||
}
|
||||
if m.Status != 0 {
|
||||
n += 1 + sovShim(uint64(m.Status))
|
||||
}
|
||||
if len(m.Processes) > 0 {
|
||||
for _, e := range m.Processes {
|
||||
l = e.Size()
|
||||
|
@ -1564,6 +1573,7 @@ func (this *StateResponse) String() string {
|
|||
`ID:` + fmt.Sprintf("%v", this.ID) + `,`,
|
||||
`Bundle:` + fmt.Sprintf("%v", this.Bundle) + `,`,
|
||||
`Pid:` + fmt.Sprintf("%v", this.Pid) + `,`,
|
||||
`Status:` + fmt.Sprintf("%v", this.Status) + `,`,
|
||||
`Processes:` + strings.Replace(fmt.Sprintf("%v", this.Processes), "Process", "containerd_v1_types1.Process", 1) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
|
@ -3071,6 +3081,25 @@ func (m *StateResponse) Unmarshal(dAtA []byte) error {
|
|||
}
|
||||
}
|
||||
case 4:
|
||||
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 ErrIntOverflowShim
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.Status |= (containerd_v1_types1.Status(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
case 5:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Processes", wireType)
|
||||
}
|
||||
|
@ -3382,63 +3411,64 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptorShim = []byte{
|
||||
// 922 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x41, 0x6f, 0xe3, 0x44,
|
||||
0x14, 0x5e, 0x27, 0xa9, 0xdb, 0xbc, 0xc6, 0xed, 0x32, 0x5a, 0x55, 0xde, 0x2c, 0xca, 0x06, 0xef,
|
||||
0x81, 0xb4, 0x08, 0x87, 0x2d, 0x17, 0x40, 0x42, 0x42, 0x4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, 0x9d, 0x5e, 0xf3, 0x95, 0x3b, 0xff, 0xeb, 0x79,
|
||||
0xed, 0xab, 0x33, 0x5a, 0x63, 0x31, 0x39, 0x02, 0x77, 0x54, 0x64, 0x71, 0x82, 0x7e, 0x4d, 0xbf,
|
||||
0xa3, 0xe5, 0x8a, 0xf8, 0xb0, 0x2b, 0x8a, 0x4c, 0xb1, 0x14, 0xfd, 0xba, 0x79, 0x51, 0x2d, 0xc9,
|
||||
0x53, 0xd8, 0xcb, 0xf8, 0x30, 0x67, 0x33, 0xae, 0xfc, 0x46, 0xd7, 0xe9, 0xed, 0xd1, 0xdd, 0x8c,
|
||||
0x0f, 0xf4, 0x92, 0xb4, 0x61, 0x4f, 0xa1, 0x48, 0x59, 0x16, 0x25, 0xfe, 0x8e, 0x79, 0xb5, 0x58,
|
||||
0x93, 0x27, 0xb0, 0x23, 0x55, 0xcc, 0x32, 0xdf, 0x35, 0xdb, 0xd9, 0x85, 0x3e, 0x5e, 0xaa, 0x98,
|
||||
0x17, 0xca, 0xdf, 0xb5, 0xc7, 0xdb, 0x55, 0x89, 0xa3, 0x10, 0xfe, 0xde, 0x02, 0x47, 0x21, 0xc8,
|
||||
0x29, 0xb8, 0x82, 0x73, 0x75, 0x25, 0xfd, 0x66, 0xb7, 0xde, 0xdb, 0x3f, 0x6d, 0x87, 0xab, 0x5d,
|
||||
0x33, 0xc2, 0x84, 0xdf, 0x68, 0x31, 0x69, 0xc9, 0x0c, 0x02, 0x38, 0xa8, 0xb4, 0x90, 0x39, 0xcf,
|
||||
0x24, 0x92, 0xc7, 0x50, 0xcf, 0x4b, 0x35, 0x3c, 0xaa, 0xc3, 0xe0, 0x00, 0x5a, 0x97, 0x2a, 0x12,
|
||||
0xaa, 0x94, 0x2b, 0x78, 0x07, 0xbc, 0x33, 0x4c, 0x70, 0xa9, 0xdf, 0x7f, 0x53, 0x5e, 0xc2, 0x41,
|
||||
0x45, 0x29, 0xb7, 0x7d, 0x0e, 0xfb, 0x78, 0xc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0x48, 0xa4, 0x5c, 0x0c, 0x73, 0xc1, 0xaf, 0x58, 0x82, 0xbe,
|
||||
0x67, 0xaa, 0x3d, 0xac, 0xf0, 0x81, 0x85, 0x83, 0x33, 0x70, 0xed, 0x49, 0xfa, 0xdb, 0xb5, 0x1e,
|
||||
0xf6, 0x22, 0x51, 0x13, 0x6b, 0x6c, 0x1a, 0x89, 0xd8, 0x34, 0xaa, 0x41, 0x4d, 0xac, 0x31, 0xc9,
|
||||
0xaf, 0x6c, 0x97, 0x1a, 0xd4, 0xc4, 0x41, 0x17, 0x5a, 0xb6, 0xf9, 0x6b, 0x5d, 0x78, 0x01, 0x30,
|
||||
0x50, 0xb7, 0x6b, 0x2d, 0xa7, 0x3d, 0x71, 0xcd, 0x62, 0x35, 0x35, 0x47, 0x79, 0xd4, 0x2e, 0x74,
|
||||
0xef, 0xa7, 0xc8, 0x26, 0x53, 0x7b, 0x9a, 0x47, 0xcb, 0x55, 0x70, 0x08, 0xde, 0xf9, 0x0c, 0x33,
|
||||
0x25, 0x2b, 0x53, 0x5b, 0x93, 0x2f, 0x3c, 0x1d, 0xfc, 0xea, 0x80, 0x57, 0x02, 0x65, 0x49, 0xff,
|
||||
0x77, 0x4a, 0x94, 0x25, 0xd6, 0x97, 0x25, 0x7e, 0x02, 0xcd, 0x5c, 0xf0, 0x31, 0x4a, 0x89, 0xd2,
|
||||
0x6f, 0x98, 0x16, 0xbe, 0x7d, 0xaf, 0xa1, 0x06, 0x96, 0x45, 0x97, 0x74, 0x5d, 0xdf, 0x20, 0x2a,
|
||||
0xe4, 0xa2, 0xbe, 0x43, 0xf0, 0x28, 0xca, 0x22, 0x5d, 0x00, 0x9e, 0xbe, 0x3e, 0xac, 0xba, 0xa4,
|
||||
0xa7, 0x7f, 0xb8, 0xd0, 0xb8, 0x9c, 0xb2, 0x94, 0x44, 0xe0, 0xda, 0x1b, 0x4e, 0x4e, 0x36, 0xda,
|
||||
0x65, 0x65, 0x24, 0xb6, 0xdf, 0x7b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 0xec, 0x91, 0xac, 0xeb, 0x67, 0x09, 0x00, 0x00,
|
||||
// 940 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x6f, 0xe3, 0x44,
|
||||
0x14, 0x5e, 0x27, 0xa9, 0xdb, 0xbc, 0xc4, 0xed, 0x32, 0x5a, 0x55, 0xb3, 0x29, 0xca, 0x06, 0xef,
|
||||
0x81, 0xb4, 0x08, 0x87, 0xcd, 0x5e, 0x00, 0x09, 0x09, 0x2d, 0x2d, 0x02, 0x54, 0x50, 0x34, 0x15,
|
||||
0x27, 0x24, 0x22, 0x27, 0x9e, 0x26, 0x23, 0x6c, 0x8f, 0x99, 0x19, 0xa7, 0xed, 0x8d, 0x33, 0xff,
|
||||
0x0f, 0xff, 0x00, 0xa7, 0x3d, 0x72, 0x41, 0xe2, 0x84, 0xd8, 0xfc, 0x25, 0x68, 0x66, 0xec, 0xa4,
|
||||
0x81, 0xfc, 0xe8, 0x5e, 0xac, 0x37, 0x9f, 0xbf, 0x37, 0x3f, 0xbe, 0xf7, 0xcd, 0x1b, 0xf8, 0x64,
|
||||
0xc2, 0xd4, 0x34, 0x1f, 0x05, 0x63, 0x9e, 0xf4, 0x22, 0x3e, 0xfe, 0x89, 0x8a, 0xde, 0x98, 0xa7,
|
||||
0x2a, 0x64, 0x29, 0x15, 0x51, 0x2f, 0xcc, 0x58, 0x4f, 0x52, 0x31, 0x63, 0x63, 0x2a, 0x7b, 0x72,
|
||||
0xca, 0x12, 0xf3, 0x09, 0x32, 0xc1, 0x15, 0x47, 0x27, 0x4b, 0x62, 0x30, 0x7b, 0x11, 0x94, 0xbc,
|
||||
0x40, 0x53, 0x5a, 0x27, 0x13, 0xce, 0x27, 0x31, 0xed, 0x19, 0xea, 0x28, 0xbf, 0xee, 0xd1, 0x24,
|
||||
0x53, 0x77, 0x36, 0xb3, 0xf5, 0x64, 0xc2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, 0x2f, 0x62, 0x96, 0x30, 0x25, 0x71, 0xc3, 0x14, 0xf8, 0x79, 0xb0, 0xe5,
|
||||
0x5a, 0x06, 0xc4, 0x70, 0x49, 0x99, 0x83, 0xce, 0xe0, 0x9d, 0x94, 0x0f, 0x53, 0x7a, 0x33, 0xcc,
|
||||
0x04, 0x9b, 0xb1, 0x98, 0x4e, 0xa8, 0xc4, 0x4d, 0xa3, 0xec, 0x51, 0xca, 0xbf, 0xa3, 0x37, 0x83,
|
||||
0x05, 0x8c, 0x4e, 0xe1, 0x71, 0x98, 0x65, 0xa1, 0x48, 0xb8, 0x18, 0x66, 0x82, 0x5f, 0xb3, 0x98,
|
||||
0x62, 0xcf, 0xec, 0xf6, 0xa8, 0xc4, 0x07, 0x16, 0xf6, 0xcf, 0xc1, 0xb5, 0x2b, 0xe9, 0xb3, 0x6b,
|
||||
0x3d, 0xec, 0x45, 0x22, 0x26, 0xd6, 0xd8, 0x34, 0x14, 0x91, 0x29, 0x54, 0x8d, 0x98, 0x58, 0x63,
|
||||
0x92, 0x5f, 0xdb, 0x2a, 0xd5, 0x88, 0x89, 0xfd, 0x0e, 0x34, 0x6d, 0xf1, 0x37, 0xba, 0xf0, 0x12,
|
||||
0x60, 0xa0, 0xee, 0x36, 0x5a, 0x4e, 0x7b, 0xe2, 0x86, 0x45, 0x6a, 0x6a, 0x96, 0xf2, 0x88, 0x1d,
|
||||
0xe8, 0xda, 0x4f, 0x29, 0x9b, 0x4c, 0xed, 0x6a, 0x1e, 0x29, 0x46, 0xfe, 0x11, 0x78, 0x17, 0x33,
|
||||
0x9a, 0x2a, 0x59, 0x9a, 0xda, 0x9a, 0x7c, 0xe1, 0x69, 0xff, 0x77, 0x07, 0xbc, 0x02, 0x28, 0xb6,
|
||||
0xf4, 0xb6, 0x5d, 0xa2, 0xd8, 0x62, 0x75, 0xb9, 0xc5, 0x97, 0xda, 0x88, 0xc6, 0xfe, 0xda, 0x88,
|
||||
0x87, 0xfd, 0x93, 0xb5,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 0xc0, 0x78, 0x74, 0xc7, 0xfc, 0xf7, 0x7d, 0xbc, 0xf1, 0xfc, 0x97, 0xe0, 0x5a, 0x7f, 0xef,
|
||||
0x38, 0xff, 0xca, 0x25, 0xd8, 0x38, 0xdb, 0x57, 0xba, 0xe4, 0x4c, 0xed, 0x2c, 0x39, 0xdb, 0xe5,
|
||||
0xcf, 0x57, 0xf8, 0xf5, 0x9b, 0xf6, 0xa3, 0xbf, 0xde, 0xb4, 0x1f, 0xfd, 0x32, 0x6f, 0x3b, 0xaf,
|
||||
0xe7, 0x6d, 0xe7, 0x8f, 0x79, 0xdb, 0xf9, 0x67, 0xde, 0x76, 0x46, 0xae, 0x61, 0xbe, 0xfc, 0x37,
|
||||
0x00, 0x00, 0xff, 0xff, 0x76, 0x3b, 0x6e, 0x21, 0x9c, 0x09, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -89,7 +89,8 @@ message StateResponse {
|
|||
string id = 1 [(gogoproto.customname) = "ID"];
|
||||
string bundle = 2;
|
||||
uint32 pid = 3;
|
||||
repeated containerd.v1.types.Process processes = 4;
|
||||
containerd.v1.types.Status status = 4;
|
||||
repeated containerd.v1.types.Process processes = 5;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,23 +40,26 @@ const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
|||
type Status int32
|
||||
|
||||
const (
|
||||
Status_CREATED Status = 0
|
||||
Status_RUNNING Status = 1
|
||||
Status_STOPPED Status = 2
|
||||
Status_PAUSED Status = 3
|
||||
Status_UNKNOWN Status = 0
|
||||
Status_CREATED Status = 1
|
||||
Status_RUNNING Status = 2
|
||||
Status_STOPPED Status = 3
|
||||
Status_PAUSED Status = 4
|
||||
)
|
||||
|
||||
var Status_name = map[int32]string{
|
||||
0: "CREATED",
|
||||
1: "RUNNING",
|
||||
2: "STOPPED",
|
||||
3: "PAUSED",
|
||||
0: "UNKNOWN",
|
||||
1: "CREATED",
|
||||
2: "RUNNING",
|
||||
3: "STOPPED",
|
||||
4: "PAUSED",
|
||||
}
|
||||
var Status_value = map[string]int32{
|
||||
"CREATED": 0,
|
||||
"RUNNING": 1,
|
||||
"STOPPED": 2,
|
||||
"PAUSED": 3,
|
||||
"UNKNOWN": 0,
|
||||
"CREATED": 1,
|
||||
"RUNNING": 2,
|
||||
"STOPPED": 3,
|
||||
"PAUSED": 4,
|
||||
}
|
||||
|
||||
func (x Status) String() string {
|
||||
|
@ -1312,37 +1315,38 @@ func init() {
|
|||
}
|
||||
|
||||
var fileDescriptorContainer = []byte{
|
||||
// 512 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x52, 0xc1, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0xcd, 0xda, 0x8e, 0x93, 0x4c, 0xd4, 0x60, 0x2d, 0x08, 0x99, 0x22, 0xb9, 0x56, 0x84, 0x84,
|
||||
0x85, 0x84, 0x23, 0xd2, 0x0b, 0x12, 0x17, 0xd2, 0xd8, 0xaa, 0x72, 0x20, 0x09, 0x1b, 0x47, 0xea,
|
||||
0x2d, 0x72, 0xb3, 0x2b, 0xb3, 0xd0, 0xda, 0x91, 0xbd, 0x09, 0xf4, 0xc6, 0xe7, 0xf5, 0xc8, 0x91,
|
||||
0x13, 0xd0, 0x7c, 0x03, 0x1f, 0x80, 0x76, 0x93, 0xd4, 0x55, 0x15, 0xa4, 0x5e, 0xa2, 0x37, 0x93,
|
||||
0x37, 0x6f, 0xe7, 0xbd, 0x31, 0xbc, 0x4f, 0xb8, 0xf8, 0xb4, 0x3c, 0xf7, 0xe7, 0xd9, 0x65, 0x87,
|
||||
0x66, 0xf3, 0x2f, 0x2c, 0xef, 0xcc, 0xb3, 0x54, 0xc4, 0x3c, 0x65, 0x39, 0xed, 0xc4, 0x0b, 0xde,
|
||||
0x11, 0x57, 0x0b, 0x56, 0x94, 0xcd, 0x12, 0xf9, 0x8b, 0x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 0x27, 0xf6, 0xf5, 0x8d, 0x53, 0xf9, 0x79, 0xe3, 0x54, 0xbe,
|
||||
0xaf, 0x1d, 0x74, 0xbd, 0x76, 0xd0, 0x8f, 0xb5, 0x83, 0xfe, 0xac, 0x1d, 0x74, 0x6e, 0xaa, 0xef,
|
||||
0xfe, 0xf8, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x35, 0x2b, 0xb0, 0x86, 0x66, 0x03, 0x00, 0x00,
|
||||
// 521 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x41, 0x6f, 0xd3, 0x4c,
|
||||
0x10, 0xcd, 0xda, 0x8e, 0x93, 0x4c, 0xd5, 0x7c, 0xab, 0xfd, 0x10, 0x32, 0x45, 0x72, 0xad, 0x08,
|
||||
0x09, 0x0b, 0x09, 0x47, 0xb4, 0x17, 0x8e, 0xa4, 0xb1, 0x55, 0x22, 0x84, 0x13, 0x36, 0x8e, 0xe8,
|
||||
0x2d, 0x72, 0xb3, 0x2b, 0xb3, 0xd0, 0xda, 0x91, 0xed, 0x04, 0x7a, 0xe3, 0xe7, 0xf5, 0xc8, 0x91,
|
||||
0x13, 0xd0, 0xfc, 0x06, 0x7e, 0x00, 0xda, 0x4d, 0x52, 0x57, 0x55, 0x90, 0xb8, 0x58, 0x6f, 0xc6,
|
||||
0xcf, 0x6f, 0xe6, 0xbd, 0x91, 0xe1, 0x55, 0x22, 0xca, 0x0f, 0x8b, 0x73, 0x6f, 0x96, 0x5d, 0x76,
|
||||
0x59, 0x36, 0xfb, 0xc4, 0xf3, 0xee, 0x2c, 0x4b, 0xcb, 0x58, 0xa4, 0x3c, 0x67, 0xdd, 0x78, 0x2e,
|
||||
0xba, 0xe5, 0xd5, 0x9c, 0x17, 0x55, 0xb3, 0x42, 0xde, 0x3c, 0xcf, 0xca, 0x8c, 0xfc, 0x5f, 0xf1,
|
||||
0xbd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b, 0x77, 0x94, 0x8c,
|
||||
0x13, 0xeb, 0xfa, 0xc6, 0xae, 0x7d, 0xbf, 0xb1, 0x6b, 0x5f, 0x57, 0x36, 0xba, 0x5e, 0xd9, 0xe8,
|
||||
0xdb, 0xca, 0x46, 0xbf, 0x56, 0x36, 0x3a, 0x37, 0xd5, 0x4f, 0x70, 0xfc, 0x27, 0x00, 0x00, 0xff,
|
||||
0xff, 0xf6, 0xd9, 0x16, 0xff, 0x73, 0x03, 0x00, 0x00,
|
||||
}
|
||||
|
|
|
@ -5,10 +5,11 @@ package containerd.v1.types;
|
|||
import "gogoproto/gogo.proto";
|
||||
|
||||
enum Status {
|
||||
CREATED = 0;
|
||||
RUNNING = 1;
|
||||
STOPPED = 2;
|
||||
PAUSED = 3;
|
||||
UNKNOWN = 0;
|
||||
CREATED = 1;
|
||||
RUNNING = 2;
|
||||
STOPPED = 3;
|
||||
PAUSED = 4;
|
||||
}
|
||||
|
||||
message Container {
|
||||
|
|
|
@ -3,6 +3,7 @@ package linux
|
|||
import (
|
||||
"github.com/docker/containerd"
|
||||
"github.com/docker/containerd/api/services/shim"
|
||||
"github.com/docker/containerd/api/types/container"
|
||||
"golang.org/x/net/context"
|
||||
)
|
||||
|
||||
|
@ -42,7 +43,20 @@ func (c *Container) State(ctx context.Context) (containerd.State, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var status containerd.ContainerStatus
|
||||
switch response.Status {
|
||||
case container.Status_CREATED:
|
||||
status = containerd.CreatedStatus
|
||||
case container.Status_RUNNING:
|
||||
status = containerd.RunningStatus
|
||||
case container.Status_STOPPED:
|
||||
status = containerd.StoppedStatus
|
||||
case container.Status_PAUSED:
|
||||
status = containerd.PausedStatus
|
||||
// TODO: containerd.DeletedStatus
|
||||
}
|
||||
return &State{
|
||||
pid: response.Pid,
|
||||
pid: response.Pid,
|
||||
status: status,
|
||||
}, nil
|
||||
}
|
||||
|
|
|
@ -106,6 +106,15 @@ func (p *initProcess) Status() int {
|
|||
return p.status
|
||||
}
|
||||
|
||||
// ContainerStatus return the state of the container (created, running, paused, stopped)
|
||||
func (p *initProcess) ContainerStatus(ctx context.Context) (string, error) {
|
||||
c, err := p.runc.State(ctx, p.id)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return c.Status, nil
|
||||
}
|
||||
|
||||
func (p *initProcess) Start(context context.Context) error {
|
||||
return p.runc.Start(context, p.id)
|
||||
}
|
||||
|
|
|
@ -136,10 +136,26 @@ func (s *Service) Events(r *shimapi.EventsRequest, stream shimapi.Shim_EventsSer
|
|||
}
|
||||
|
||||
func (s *Service) State(ctx context.Context, r *shimapi.StateRequest) (*shimapi.StateResponse, error) {
|
||||
st, err := s.initProcess.ContainerStatus(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
status := container.Status_UNKNOWN
|
||||
switch st {
|
||||
case "created":
|
||||
status = container.Status_CREATED
|
||||
case "running":
|
||||
status = container.Status_RUNNING
|
||||
case "stopped":
|
||||
status = container.Status_STOPPED
|
||||
case "paused":
|
||||
status = container.Status_PAUSED
|
||||
}
|
||||
o := &shimapi.StateResponse{
|
||||
ID: s.id,
|
||||
Bundle: s.bundle,
|
||||
Pid: uint32(s.initProcess.Pid()),
|
||||
Status: status,
|
||||
Processes: []*container.Process{},
|
||||
}
|
||||
s.mu.Lock()
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/docker/containerd"
|
||||
api "github.com/docker/containerd/api/services/execution"
|
||||
"github.com/docker/containerd/api/types/container"
|
||||
"github.com/docker/containerd/log"
|
||||
google_protobuf "github.com/golang/protobuf/ptypes/empty"
|
||||
"golang.org/x/net/context"
|
||||
"google.golang.org/grpc"
|
||||
|
@ -151,6 +152,8 @@ func containerFromContainerd(ctx context.Context, c containerd.Container) (*cont
|
|||
status = container.Status_STOPPED
|
||||
case containerd.PausedStatus:
|
||||
status = container.Status_PAUSED
|
||||
default:
|
||||
log.G(ctx).WithField("status", state.Status()).Warn("unknown status")
|
||||
}
|
||||
return &container.Container{
|
||||
ID: c.Info().ID,
|
||||
|
|
Loading…
Reference in a new issue