From 90f827ca1066b3b6584ce7450989b96b576b1baf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kenfe-Micka=C3=ABl=20Laventure?= Date: Wed, 13 Jul 2016 11:01:07 -0700 Subject: [PATCH] Streamline events (#287) * Sync process.State() with the matching events Signed-off-by: Kenfe-Mickael Laventure * Allow requesting events for a specific container Signed-off-by: Kenfe-Mickael Laventure * Sync container state retrieval with other events Signed-off-by: Kenfe-Mickael Laventure * Let containerd take care of calling runtime delete on exit Signed-off-by: Kenfe-Mickael Laventure * Take care of possible race in TestBusyboxTopExecTopKillInit Signed-off-by: Kenfe-Mickael Laventure --- api/grpc/server/server.go | 37 +-- api/grpc/types/api.pb.go | 307 ++++++++++++----------- api/grpc/types/api.proto | 2 + containerd-shim/main.go | 2 +- integration-test/container_utils_test.go | 18 ++ integration-test/events_test.go | 63 +++++ integration-test/exec_test.go | 46 ++-- runtime/process.go | 20 +- supervisor/exit.go | 4 +- supervisor/get_containers.go | 19 +- supervisor/supervisor.go | 36 +-- 11 files changed, 342 insertions(+), 212 deletions(-) create mode 100644 integration-test/events_test.go diff --git a/api/grpc/server/server.go b/api/grpc/server/server.go index 59e7c3c..bb7ad02 100644 --- a/api/grpc/server/server.go +++ b/api/grpc/server/server.go @@ -160,8 +160,14 @@ func (s *apiServer) Signal(ctx context.Context, r *types.SignalRequest) (*types. } func (s *apiServer) State(ctx context.Context, r *types.StateRequest) (*types.StateResponse, error) { + + getState := func(c runtime.Container) (interface{}, error) { + return createAPIContainer(c, true) + } + e := &supervisor.GetContainersTask{} e.ID = r.Id + e.GetState = getState s.sv.SendTask(e) if err := <-e.ErrorCh(); err != nil { return nil, err @@ -173,12 +179,8 @@ func (s *apiServer) State(ctx context.Context, r *types.StateRequest) (*types.St Memory: uint64(m.Memory), }, } - for _, c := range e.Containers { - apiC, err := createAPIContainer(c, true) - if err != nil { - return nil, err - } - state.Containers = append(state.Containers, apiC) + for idx := range e.Containers { + state.Containers = append(state.Containers, e.States[idx].(*types.Container)) } return state, nil } @@ -318,21 +320,26 @@ func (s *apiServer) Events(r *types.EventsRequest, stream types.API_EventsServer } t = from } - events := s.sv.Events(t) + if r.StoredOnly && t.IsZero() { + return fmt.Errorf("invalid parameter: StoredOnly cannot be specified without setting a valid Timestamp") + } + events := s.sv.Events(t, r.StoredOnly, r.Id) defer s.sv.Unsubscribe(events) for e := range events { tsp, err := ptypes.TimestampProto(e.Timestamp) if err != nil { return err } - if err := stream.Send(&types.Event{ - Id: e.ID, - Type: e.Type, - Timestamp: tsp, - Pid: e.PID, - Status: uint32(e.Status), - }); err != nil { - return err + if r.Id == "" || e.ID == r.Id { + if err := stream.Send(&types.Event{ + Id: e.ID, + Type: e.Type, + Timestamp: tsp, + Pid: e.PID, + Status: uint32(e.Status), + }); err != nil { + return err + } } } return nil diff --git a/api/grpc/types/api.pb.go b/api/grpc/types/api.pb.go index 9f74665..8d5f6bf 100644 --- a/api/grpc/types/api.pb.go +++ b/api/grpc/types/api.pb.go @@ -482,7 +482,9 @@ func (*UpdateContainerResponse) Descriptor() ([]byte, []int) { return fileDescri type EventsRequest struct { // Tag 1 is deprecated (old uint64 timestamp) - Timestamp *google_protobuf.Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp,omitempty"` + Timestamp *google_protobuf.Timestamp `protobuf:"bytes,2,opt,name=timestamp" json:"timestamp,omitempty"` + StoredOnly bool `protobuf:"varint,3,opt,name=storedOnly" json:"storedOnly,omitempty"` + Id string `protobuf:"bytes,4,opt,name=id" json:"id,omitempty"` } func (m *EventsRequest) Reset() { *m = EventsRequest{} } @@ -1341,155 +1343,156 @@ var _API_serviceDesc = grpc.ServiceDesc{ } var fileDescriptor0 = []byte{ - // 2396 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x59, 0x4b, 0x93, 0x1b, 0x49, - 0xf1, 0xb7, 0x1e, 0xa3, 0x19, 0xa5, 0x1e, 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2a, 0x49, 0x94, 0x08, - 0xa7, 0x0d, 0x5b, 0x09, 0x3b, 0x0f, 0x84, 0xd4, 0x56, 0x19, 0x27, 0xaa, 0x9e, 0xa1, 0xdd, 0x5f, - 0x15, 0x60, 0xef, 0x24, 0x1e, 0xfa, 0x9c, 0xf5, 0x92, 0x68, 0xc0, 0xd2, 0x54, 0x99, 0xe4, 0x34, - 0xa1, 0x18, 0x0c, 0x49, 0x67, 0xd5, 0xc3, 0x91, 0xb3, 0x03, 0xa5, 0x18, 0x81, 0x22, 0x01, 0x62, - 0xe8, 0xdc, 0x03, 0x18, 0x4c, 0xa2, 0x94, 0x1d, 0xf1, 0x61, 0x10, 0x92, 0xc6, 0x2d, 0xcf, 0x42, - 0x84, 0x31, 0x17, 0xc1, 0x90, 0x8f, 0x49, 0x27, 0x1a, 0x43, 0x84, 0xb3, 0x0f, 0x95, 0x31, 0x0b, - 0x46, 0x63, 0xde, 0xda, 0x20, 0x58, 0x51, 0xee, 0x6d, 0xb8, 0xb5, 0x60, 0x87, 0xdc, 0xbf, 0xfb, - 0xf7, 0x22, 0xec, 0x1f, 0x24, 0x0c, 0x67, 0x0e, 0xa2, 0x90, 0xfb, 0x41, 0xc8, 0x92, 0x75, 0x36, - 0xa2, 0x45, 0xa7, 0xb3, 0x70, 0x38, 0x61, 0x3d, 0x1f, 0xd5, 0x4a, 0x53, 0x2d, 0x84, 0x2c, 0x1e, - 0xb3, 0xc1, 0x59, 0x1c, 0x05, 0x21, 0x27, 0x8b, 0x71, 0x3e, 0x43, 0x84, 0xc5, 0x29, 0x6d, 0x46, - 0x7a, 0x49, 0x12, 0xc2, 0x62, 0x1c, 0x44, 0x33, 0x69, 0x71, 0xd5, 0x53, 0x94, 0xc2, 0x59, 0x92, - 0xb4, 0x2a, 0x06, 0x47, 0x4a, 0xe0, 0x13, 0xff, 0x94, 0x4d, 0xd2, 0xd6, 0xe6, 0x83, 0x92, 0xc0, - 0x25, 0xe5, 0x3c, 0x80, 0x5a, 0x18, 0xf5, 0x82, 0xf3, 0x88, 0x7b, 0x51, 0xc4, 0x5b, 0x5b, 0xe4, - 0x30, 0x1b, 0x72, 0x5a, 0xb0, 0x99, 0xcc, 0x42, 0x11, 0x37, 0xad, 0x2a, 0x89, 0xd4, 0xa4, 0x58, - 0xab, 0x86, 0xcf, 0x92, 0x51, 0xda, 0x02, 0x12, 0x6c, 0x43, 0xce, 0x27, 0xd0, 0xc8, 0x76, 0xf2, - 0x22, 0x48, 0x5a, 0x35, 0x92, 0x90, 0x07, 0xdd, 0x57, 0x70, 0x7b, 0xc9, 0x97, 0x2a, 0xce, 0x3a, - 0x50, 0x1d, 0x68, 0x90, 0x7c, 0x5a, 0xeb, 0xee, 0x74, 0x28, 0xb4, 0x3b, 0x19, 0x73, 0xc6, 0x82, - 0xa2, 0x1a, 0x47, 0xc1, 0x28, 0xf4, 0x27, 0xef, 0x1f, 0x31, 0xc2, 0x63, 0xb4, 0x44, 0xc5, 0xa7, - 0xa2, 0xdc, 0x1d, 0x68, 0x6a, 0x51, 0xea, 0xd0, 0xff, 0x5c, 0x82, 0xdd, 0x67, 0xc3, 0xe1, 0x35, - 0x31, 0x89, 0x81, 0xcd, 0x59, 0x82, 0xa1, 0x8f, 0x12, 0x8b, 0xe4, 0x4e, 0x43, 0x3b, 0xf7, 0xa1, - 0x3c, 0x4b, 0x71, 0x27, 0x25, 0xda, 0x49, 0x4d, 0xed, 0xe4, 0x04, 0x21, 0x8f, 0x26, 0x1c, 0x07, - 0xca, 0xbe, 0xf0, 0x65, 0x99, 0x7c, 0x49, 0x63, 0x61, 0x32, 0x0b, 0xcf, 0xf1, 0x9c, 0x05, 0x24, - 0x86, 0x02, 0x19, 0x5c, 0x0c, 0xd5, 0x09, 0x8b, 0xa1, 0xde, 0xd6, 0x66, 0xb6, 0x2d, 0x13, 0x36, - 0x5b, 0xab, 0xc3, 0xa6, 0xba, 0x26, 0x6c, 0x20, 0x17, 0x36, 0x2e, 0xd4, 0x07, 0x7e, 0xec, 0x9f, - 0x06, 0x93, 0x80, 0x07, 0x2c, 0xc5, 0xf3, 0x13, 0x46, 0xe4, 0x30, 0xe7, 0x21, 0x6c, 0xfb, 0x71, - 0xec, 0x27, 0xd3, 0x28, 0x41, 0xd7, 0xbc, 0x0b, 0x26, 0xac, 0x55, 0x27, 0x21, 0x8b, 0xb0, 0x90, - 0x96, 0xb2, 0x49, 0x10, 0xce, 0xe6, 0xaf, 0x45, 0xf4, 0xb5, 0x1a, 0xc4, 0x96, 0xc3, 0x84, 0xb4, - 0x30, 0x7a, 0xc3, 0x2e, 0x7a, 0x49, 0x70, 0x8e, 0x6b, 0x46, 0xa8, 0xb4, 0x49, 0x5e, 0x5c, 0x84, - 0x9d, 0x6f, 0x62, 0x60, 0x4e, 0x82, 0x69, 0xc0, 0xd3, 0xd6, 0x36, 0x9a, 0x55, 0xeb, 0x36, 0x94, - 0x3f, 0x3d, 0x42, 0x3d, 0x3d, 0xeb, 0xbe, 0x80, 0x8a, 0x84, 0x84, 0x7b, 0x05, 0x8b, 0x3a, 0x2d, - 0x1a, 0x0b, 0x2c, 0x8d, 0xde, 0x71, 0x3a, 0xab, 0xb2, 0x47, 0x63, 0x81, 0x8d, 0xfd, 0x64, 0x48, - 0xe7, 0x84, 0x98, 0x18, 0xbb, 0x1e, 0x94, 0xc5, 0x41, 0x09, 0x57, 0xcf, 0xd4, 0x81, 0x37, 0x3c, - 0x31, 0x14, 0xc8, 0x48, 0xc5, 0x14, 0x22, 0x38, 0x74, 0xbe, 0x01, 0x4d, 0x7f, 0x38, 0x44, 0xf7, - 0x44, 0x78, 0xea, 0x5f, 0x04, 0xc3, 0x14, 0x25, 0x95, 0x70, 0x72, 0x01, 0x75, 0xf7, 0xc0, 0xb1, - 0x03, 0x4a, 0xc5, 0xd9, 0x2f, 0x0b, 0x26, 0x21, 0x4c, 0x9e, 0xac, 0x8b, 0xb6, 0xef, 0xe6, 0xaa, - 0x47, 0x91, 0xe2, 0x6a, 0x57, 0x67, 0x48,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, 0x86, 0x6a, 0x7a, - 0x99, 0x72, 0x36, 0xed, 0xa9, 0x52, 0xd8, 0xf0, 0x32, 0xe0, 0x7f, 0x05, 0x31, 0x2b, 0x88, 0x7f, - 0x2b, 0x40, 0xd5, 0x1c, 0xf3, 0x07, 0x37, 0x2c, 0x9f, 0x42, 0x35, 0x96, 0x07, 0xcf, 0x64, 0x5d, - 0xab, 0x75, 0x9b, 0x4a, 0x91, 0xae, 0x64, 0x19, 0x83, 0x15, 0x3f, 0x65, 0x3b, 0x7e, 0xac, 0x86, - 0x64, 0x23, 0xd7, 0x90, 0xe0, 0xe1, 0xc7, 0xa2, 0x60, 0x56, 0xa8, 0x60, 0xd2, 0xd8, 0x6e, 0x41, - 0x36, 0x73, 0x2d, 0x88, 0xfb, 0x39, 0x6c, 0x1e, 0xfa, 0x83, 0x31, 0xee, 0x43, 0x2c, 0x1c, 0xc4, - 0x2a, 0x4c, 0x71, 0xa1, 0x18, 0x0b, 0x25, 0x53, 0x86, 0xfe, 0xbe, 0x54, 0xd5, 0x5d, 0x51, 0xee, - 0x19, 0xb6, 0x09, 0x32, 0x0d, 0x54, 0x32, 0x3d, 0xc6, 0x32, 0xaa, 0x1d, 0xa2, 0x73, 0x69, 0xb9, - 0xd1, 0xb0, 0x78, 0xf0, 0x58, 0x36, 0xa7, 0x52, 0xb3, 0xaa, 0xba, 0xda, 0x07, 0xca, 0x1e, 0x4f, - 0x4f, 0xbb, 0xbf, 0x2e, 0xc0, 0xbe, 0xec, 0x22, 0xaf, 0xed, 0x15, 0x57, 0x77, 0x27, 0xd2, 0x7d, - 0xa5, 0x9c, 0xfb, 0x9e, 0x40, 0x35, 0x61, 0x69, 0x34, 0x4b, 0xd0, 0xcd, 0xe4, 0xd9, 0x5a, 0xf7, - 0x96, 0xce, 0x24, 0xd2, 0xe5, 0xa9, 0x59, 0x2f, 0xe3, 0x73, 0xff, 0x50, 0x82, 0x66, 0x7e, 0x56, - 0x54, 0xac, 0xd3, 0xc9, 0x59,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, 0xae, 0xfe, - 0x66, 0x34, 0x32, 0xd7, 0x7d, 0x2a, 0xdc, 0x70, 0xbe, 0x07, 0x15, 0xf9, 0x72, 0xed, 0xec, 0x29, - 0xde, 0xdc, 0x9b, 0x78, 0xfb, 0xd6, 0x02, 0x6a, 0x16, 0xbe, 0x86, 0x46, 0xee, 0xef, 0x0e, 0xe7, - 0xa3, 0x9c, 0xae, 0xfc, 0xc3, 0x77, 0xfb, 0xe3, 0xd5, 0x93, 0x46, 0xda, 0x01, 0x40, 0xf6, 0xb8, - 0xe9, 0xb4, 0x14, 0xf7, 0xd2, 0x03, 0x7a, 0xfb, 0xce, 0x8a, 0x19, 0x23, 0x04, 0x8f, 0x72, 0xf1, - 0x19, 0xd2, 0x59, 0xf0, 0xea, 0xe2, 0x23, 0xa0, 0x39, 0xca, 0xb5, 0xef, 0x97, 0x24, 0x76, 0xf1, - 0x71, 0xd1, 0x88, 0x5d, 0xf3, 0xb4, 0x69, 0xc4, 0xae, 0x7d, 0x95, 0xbc, 0xe1, 0xfc, 0x14, 0x9a, - 0xf9, 0xd7, 0x3a, 0x47, 0x3b, 0x69, 0xe5, 0x73, 0x65, 0xfb, 0xee, 0x9a, 0x59, 0x23, 0xf0, 0x33, - 0xd8, 0x90, 0xcf, 0x70, 0x3a, 0x1d, 0xed, 0xd7, 0xbb, 0xf6, 0x5e, 0x1e, 0x34, 0xab, 0x1e, 0x43, - 0x45, 0x7e, 0x2d, 0x9a, 0x00, 0xc8, 0x7d, 0x3c, 0xb6, 0xeb, 0x36, 0xea, 0xde, 0x78, 0x5c, 0xd0, - 0x7a, 0xd2, 0x9c, 0x9e, 0x74, 0x95, 0x1e, 0xeb, 0x70, 0x4e, 0x2b, 0x94, 0xae, 0x4f, 0xfe, 0x1d, - 0x00, 0x00, 0xff, 0xff, 0x88, 0xb3, 0x22, 0x9b, 0x78, 0x1c, 0x00, 0x00, + // 2414 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00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e, 0x36, 0x5d, 0x41, 0x70, 0x34, 0x88, 0x10, + 0x2d, 0x4b, 0x94, 0x11, 0x0c, 0x4d, 0x3c, 0x3a, 0x1c, 0xb7, 0x2b, 0x02, 0xe5, 0x84, 0xdd, 0x81, + 0x8d, 0x94, 0x5c, 0x04, 0x4c, 0x6a, 0xdb, 0xc2, 0x89, 0x9a, 0xab, 0x69, 0xe7, 0xd7, 0x25, 0xd8, + 0x39, 0x4d, 0x7c, 0x8f, 0x92, 0x7e, 0x1a, 0x0f, 0x49, 0x96, 0x49, 0x93, 0xec, 0x16, 0x94, 0x03, + 0x9f, 0xeb, 0xac, 0xb9, 0x38, 0xb2, 0xb7, 0xa0, 0x92, 0x20, 0x50, 0xe6, 0x00, 0x1b, 0xda, 0xf7, + 0x00, 0x86, 0x61, 0x9c, 0x91, 0x63, 0xea, 0x07, 0x11, 0xd7, 0xb8, 0xe1, 0x1a, 0x08, 0x33, 0xe6, + 0x32, 0xf0, 0xe9, 0x98, 0xeb, 0x44, 0x63, 0x38, 0x61, 0xef, 0x41, 0x75, 0x4c, 0x82, 0xd1, 0x98, + 0xb6, 0xd7, 0x38, 0x2c, 0x29, 0x67, 0x1f, 0x76, 0xe7, 0xec, 0x10, 0xfb, 0x77, 0xfe, 0x51, 0x86, + 0xbd, 0x83, 0x94, 0xe0, 0xcc, 0x41, 0x1c, 0x51, 0x2f, 0x88, 0x48, 0xba, 0xca, 0x46, 0xb4, 0xe8, + 0x6c, 0x1a, 0xf9, 0x21, 0xe9, 0x7b, 0xa8, 0x56, 0x98, 0x6a, 0x20, 0xdc, 0xe2, 0x31, 0x19, 0x9e, + 0x27, 0x71, 0x10, 0x51, 0x6e, 0x31, 0xce, 0xe7, 0x08, 0xb3, 0x38, 0xe3, 0x9b, 0x11, 0x5e, 0x12, + 0x04, 0xb3, 0x18, 0x07, 0xf1, 0x54, 0x58, 0x5c, 0x73, 0x25, 0x25, 0x71, 0x92, 0xa6, 0xed, 0xaa, + 0xc6, 0x91, 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74, 0x33, 0xf7, 0x6c, 0xbd, 0xb7, 0xab, 0x32, + 0x89, 0xeb, 0x72, 0xe5, 0xac, 0x9b, 0xf3, 0x39, 0x7f, 0xac, 0x40, 0xab, 0x38, 0xcb, 0x2a, 0xd6, + 0x59, 0x78, 0x1e, 0xc4, 0x5f, 0x8b, 0xf6, 0xb7, 0xc4, 0xdd, 0x64, 0x42, 0x2c, 0xab, 0xd0, 0x97, + 0xc7, 0x78, 0x07, 0xa2, 0x26, 0xe1, 0xc6, 0x1c, 0x90, 0xb3, 0x7d, 0x92, 0x06, 0xb1, 0xba, 0x2e, + 0x73, 0x80, 0x95, 0x01, 0x24, 0xde, 0x4c, 0x63, 0xea, 0x71, 0x23, 0x2d, 0x57, 0xd3, 0xbc, 0xef, + 0xc5, 0x33, 0x22, 0xf4, 0x80, 0x9d, 0xda, 0x9a, 0xec, 0x7b, 0x35, 0x92, 0xcf, 0x1f, 0x91, 0x49, + 0x26, 0xd3, 0xdc, 0x40, 0x98, 0xe5, 0xe2, 0x34, 0x5f, 0xb1, 0xa0, 0xe6, 0x81, 0x81, 0x96, 0x1b, + 0x10, 0x93, 0x20, 0xc8, 0xe3, 0x4b, 0x2f, 0xe1, 0x69, 0x6f, 0xb9, 0x06, 0x82, 0x81, 0xbc, 0x2d, + 0x28, 0xf4, 0x06, 0x7e, 0xe5, 0x78, 0xec, 0x62, 0xe6, 0x65, 0xc0, 0x72, 0x17, 0x27, 0x18, 0xf7, + 0x39, 0x49, 0x23, 0x12, 0x1e, 0x19, 0x5a, 0x41, 0x70, 0x2f, 0x4c, 0xd8, 0x3d, 0xd8, 0x11, 0xe0, + 0xc9, 0x41, 0xdf, 0x5c, 0x50, 0xe7, 0x0b, 0x96, 0xce, 0xb1, 0x6f, 0xb1, 0x85, 0x38, 0x91, 0x17, + 0xde, 0x15, 0x34, 0x5f, 0x5c, 0x10, 0xac, 0xe0, 0x2a, 0x72, 0x9e, 0x42, 0x4d, 0x7f, 0xca, 0xc9, + 0x00,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5d, 0xea, 0x00, 0x28, 0x7c, 0x6c, 0x76, 0x1a, 0x26, 0xea, 0xdc, 0x7a, + 0x5c, 0x52, 0x7a, 0xb2, 0x82, 0x9e, 0x6c, 0x99, 0x1e, 0xe3, 0x70, 0xce, 0xaa, 0x3c, 0x5d, 0x9f, + 0xfc, 0x27, 0x00, 0x00, 0xff, 0xff, 0xc9, 0x06, 0x1e, 0xda, 0xa8, 0x1c, 0x00, 0x00, } diff --git a/api/grpc/types/api.proto b/api/grpc/types/api.proto index 04fe466..d1b19b6 100644 --- a/api/grpc/types/api.proto +++ b/api/grpc/types/api.proto @@ -211,6 +211,8 @@ message UpdateContainerResponse { message EventsRequest { // Tag 1 is deprecated (old uint64 timestamp) google.protobuf.Timestamp timestamp = 2; + bool storedOnly = 3; + string id = 4; } message Event { diff --git a/containerd-shim/main.go b/containerd-shim/main.go index 2794a34..ddfee9a 100644 --- a/containerd-shim/main.go +++ b/containerd-shim/main.go @@ -114,7 +114,7 @@ func start(log *os.File) error { } // runtime has exited so the shim can also exit if exitShim { - p.delete() + // Let containerd take care of calling the runtime delete p.Wait() return nil } diff --git a/integration-test/container_utils_test.go b/integration-test/container_utils_test.go index 85a7448..9bafa92 100644 --- a/integration-test/container_utils_test.go +++ b/integration-test/container_utils_test.go @@ -9,8 +9,11 @@ import ( "path/filepath" "sort" "syscall" + "time" "github.com/docker/containerd/api/grpc/types" + "github.com/golang/protobuf/ptypes" + "github.com/golang/protobuf/ptypes/timestamp" "golang.org/x/net/context" ) @@ -19,6 +22,21 @@ func (cs *ContainerdSuite) GetLogs() string { return string(b) } +func (cs *ContainerdSuite) Events(from time.Time, storedOnly bool, id string) (types.API_EventsClient, error) { + var ( + ftsp *timestamp.Timestamp + err error + ) + if !from.IsZero() { + ftsp, err = ptypes.TimestampProto(from) + if err != nil { + return nil, err + } + } + + return cs.grpcClient.Events(context.Background(), &types.EventsRequest{Timestamp: ftsp, StoredOnly: storedOnly, Id: id}) +} + func (cs *ContainerdSuite) ListRunningContainers() ([]*types.Container, error) { resp, err := cs.grpcClient.State(context.Background(), &types.StateRequest{}) if err != nil { diff --git a/integration-test/events_test.go b/integration-test/events_test.go new file mode 100644 index 0000000..c8db406 --- /dev/null +++ b/integration-test/events_test.go @@ -0,0 +1,63 @@ +package main + +import ( + "fmt" + "time" + + "github.com/docker/containerd/api/grpc/types" + "github.com/docker/docker/pkg/integration/checker" + "github.com/go-check/check" +) + +func (cs *ContainerdSuite) TestEventsId(t *check.C) { + if err := CreateBusyboxBundle("busybox-ls", []string{"ls"}); err != nil { + t.Fatal(err) + } + + from := time.Now() + + for i := 0; i < 10; i++ { + _, err := cs.RunContainer(fmt.Sprintf("ls-%d", i), "busybox-ls") + if err != nil { + t.Fatal(err) + } + } + + containerID := "ls-4" + + events, err := cs.Events(from, true, containerID) + if err != nil { + t.Fatal(err) + } + + evs := []*types.Event{} + for { + e, err := events.Recv() + if err != nil { + if err.Error() == "EOF" { + break + } + t.Fatal(err) + } + evs = append(evs, e) + } + + t.Assert(len(evs), checker.Equals, 2) + for idx, evt := range []types.Event{ + { + Type: "start-container", + Id: containerID, + Status: 0, + Pid: "", + }, + { + Type: "exit", + Id: containerID, + Status: 0, + Pid: "init", + }, + } { + evt.Timestamp = evs[idx].Timestamp + t.Assert(*evs[idx], checker.Equals, evt) + } +} diff --git a/integration-test/exec_test.go b/integration-test/exec_test.go index 6e4e046..e2b9bff 100644 --- a/integration-test/exec_test.go +++ b/integration-test/exec_test.go @@ -137,7 +137,8 @@ func (cs *ContainerdSuite) TestBusyboxTopExecTopKillInit(t *check.C) { _, err = cs.AddProcessToContainer(initp, execID, "/", []string{"PATH=/usr/bin"}, []string{"top"}, 0, 0) t.Assert(err, checker.Equals, nil) - for idx, evt := range []types.Event{ + ch := initp.GetEventsChannel() + for _, evt := range []types.Event{ { Type: "start-container", Id: containerID, @@ -150,26 +151,37 @@ func (cs *ContainerdSuite) TestBusyboxTopExecTopKillInit(t *check.C) { Status: 0, Pid: execID, }, - { - Type: "exit", - Id: containerID, - Status: 137, - Pid: execID, - }, - { - Type: "exit", - Id: containerID, - Status: 143, - Pid: "init", - }, } { - ch := initp.GetEventsChannel() e := <-ch evt.Timestamp = e.Timestamp t.Assert(*e, checker.Equals, evt) - if idx == 1 { - // Process Started, kill it - cs.SignalContainerProcess(containerID, "init", uint32(syscall.SIGTERM)) + } + + cs.SignalContainerProcess(containerID, "init", uint32(syscall.SIGTERM)) + for i := 0; i < 2; i++ { + e := <-ch + switch e.Pid { + case "init": + evt := types.Event{ + Type: "exit", + Id: containerID, + Status: 143, + Pid: "init", + Timestamp: e.Timestamp, + } + t.Assert(*e, checker.Equals, evt) + case execID: + evt := types.Event{ + Type: "exit", + Id: containerID, + Status: 137, + Pid: execID, + Timestamp: e.Timestamp, + } + t.Assert(*e, checker.Equals, evt) + default: + t.Fatalf("Unexpected event %v", e) } } + } diff --git a/runtime/process.go b/runtime/process.go index 0f10aad..eac5c3e 100644 --- a/runtime/process.go +++ b/runtime/process.go @@ -9,6 +9,7 @@ import ( "os/exec" "path/filepath" "strconv" + "sync" "syscall" "github.com/docker/containerd/specs" @@ -68,6 +69,7 @@ func newProcess(config *processConfig) (*process, error) { spec: config.processSpec, stdio: config.stdio, cmdDoneCh: make(chan struct{}), + state: Running, } uid, gid, err := getRootIDs(config.spec) if err != nil { @@ -121,6 +123,7 @@ func loadProcess(root, id string, c *container, s *ProcessState) (*process, erro Stdout: s.Stdout, Stderr: s.Stderr, }, + state: Stopped, } if _, err := p.getPidFromFile(); err != nil { return nil, err @@ -139,6 +142,7 @@ func loadProcess(root, id string, c *container, s *ProcessState) (*process, erro } p.controlPipe = control + p.state = Running return p, nil } return nil, err @@ -158,6 +162,8 @@ type process struct { cmd *exec.Cmd cmdSuccess bool cmdDoneCh chan struct{} + state State + stateLock sync.Mutex } func (p *process) ID() string { @@ -198,6 +204,9 @@ func (p *process) ExitStatus() (int, error) { if len(data) == 0 { return -1, ErrProcessNotExited } + p.stateLock.Lock() + p.state = Stopped + p.stateLock.Unlock() return strconv.Atoi(string(data)) } @@ -219,14 +228,9 @@ func (p *process) Close() error { } func (p *process) State() State { - if p.pid == 0 { - return Stopped - } - err := syscall.Kill(p.pid, 0) - if err != nil && err == syscall.ESRCH { - return Stopped - } - return Running + p.stateLock.Lock() + defer p.stateLock.Unlock() + return p.state } func (p *process) getPidFromFile() (int, error) { diff --git a/supervisor/exit.go b/supervisor/exit.go index 1ea8857..f96d925 100644 --- a/supervisor/exit.go +++ b/supervisor/exit.go @@ -41,7 +41,7 @@ func (s *Supervisor) exit(t *ExitTask) error { Status: status, Process: proc, } - s.SendTask(ne) + s.execExit(ne) return nil } container := proc.Container() @@ -50,7 +50,7 @@ func (s *Supervisor) exit(t *ExitTask) error { Status: status, PID: proc.ID(), } - s.SendTask(ne) + s.delete(ne) ExitProcessTimer.UpdateSince(start) diff --git a/supervisor/get_containers.go b/supervisor/get_containers.go index 4a380ef..4d9c668 100644 --- a/supervisor/get_containers.go +++ b/supervisor/get_containers.go @@ -6,8 +6,11 @@ import "github.com/docker/containerd/runtime" // containers type GetContainersTask struct { baseTask - ID string + ID string + GetState func(c runtime.Container) (interface{}, error) + Containers []runtime.Container + States []interface{} } func (s *Supervisor) getContainers(t *GetContainersTask) error { @@ -18,12 +21,26 @@ func (s *Supervisor) getContainers(t *GetContainersTask) error { return ErrContainerNotFound } t.Containers = append(t.Containers, ci.container) + if t.GetState != nil { + st, err := t.GetState(ci.container) + if err != nil { + return err + } + t.States = append(t.States, st) + } return nil } for _, ci := range s.containers { t.Containers = append(t.Containers, ci.container) + if t.GetState != nil { + st, err := t.GetState(ci.container) + if err != nil { + return err + } + t.States = append(t.States, st) + } } return nil diff --git a/supervisor/supervisor.go b/supervisor/supervisor.go index f80dee3..d900bb0 100644 --- a/supervisor/supervisor.go +++ b/supervisor/supervisor.go @@ -64,7 +64,7 @@ func setupEventLog(s *Supervisor, retainCount int) error { return err } logrus.WithField("count", len(s.eventLog)).Debug("containerd: read past events") - events := s.Events(time.Time{}) + events := s.Events(time.Time{}, false, "") return eventLogger(s, filepath.Join(s.stateDir, "events.log"), events, retainCount) } @@ -191,12 +191,13 @@ type Event struct { // Events returns an event channel that external consumers can use to receive updates // on container events -func (s *Supervisor) Events(from time.Time) chan Event { +func (s *Supervisor) Events(from time.Time, storedOnly bool, id string) chan Event { + c := make(chan Event, defaultBufferSize) + if storedOnly { + defer s.Unsubscribe(c) + } s.subscriberLock.Lock() defer s.subscriberLock.Unlock() - c := make(chan Event, defaultBufferSize) - EventSubscriberCounter.Inc(1) - s.subscribers[c] = struct{}{} if !from.IsZero() { // replay old event s.eventLock.Lock() @@ -204,14 +205,17 @@ func (s *Supervisor) Events(from time.Time) chan Event { s.eventLock.Unlock() for _, e := range past { if e.Timestamp.After(from) { - c <- e + if id == "" || e.ID == id { + c <- e + } } } - // Notify the client that from now on it's live events - c <- Event{ - Type: StateLive, - Timestamp: time.Now(), - } + } + if storedOnly { + close(c) + } else { + EventSubscriberCounter.Inc(1) + s.subscribers[c] = struct{}{} } return c } @@ -220,9 +224,11 @@ func (s *Supervisor) Events(from time.Time) chan Event { func (s *Supervisor) Unsubscribe(sub chan Event) { s.subscriberLock.Lock() defer s.subscriberLock.Unlock() - delete(s.subscribers, sub) - close(sub) - EventSubscriberCounter.Dec(1) + if _, ok := s.subscribers[sub]; ok { + delete(s.subscribers, sub) + close(sub) + EventSubscriberCounter.Dec(1) + } } // notifySubscribers will send the provided event to the external subscribers @@ -364,8 +370,6 @@ func (s *Supervisor) handleTask(i Task) { err = s.delete(t) case *ExitTask: err = s.exit(t) - case *ExecExitTask: - err = s.execExit(t) case *GetContainersTask: err = s.getContainers(t) case *SignalTask: