Merge pull request #1157 from crosbymichael/runtime-events

Add runtime events for pause,resume,checkpoint
This commit is contained in:
Michael Crosby 2017-07-11 15:30:55 -07:00 committed by GitHub
commit ed0098c84c
4 changed files with 83 additions and 55 deletions

View File

@ -28,12 +28,14 @@ var _ = time.Kitchen
type RuntimeEvent_EventType int32
const (
RuntimeEvent_EXIT RuntimeEvent_EventType = 0
RuntimeEvent_OOM RuntimeEvent_EventType = 1
RuntimeEvent_CREATE RuntimeEvent_EventType = 2
RuntimeEvent_START RuntimeEvent_EventType = 3
RuntimeEvent_EXEC_ADDED RuntimeEvent_EventType = 4
RuntimeEvent_PAUSED RuntimeEvent_EventType = 5
RuntimeEvent_EXIT RuntimeEvent_EventType = 0
RuntimeEvent_OOM RuntimeEvent_EventType = 1
RuntimeEvent_CREATE RuntimeEvent_EventType = 2
RuntimeEvent_START RuntimeEvent_EventType = 3
RuntimeEvent_EXEC_ADDED RuntimeEvent_EventType = 4
RuntimeEvent_PAUSED RuntimeEvent_EventType = 5
RuntimeEvent_RESUMED RuntimeEvent_EventType = 6
RuntimeEvent_CHECKPOINTED RuntimeEvent_EventType = 7
)
var RuntimeEvent_EventType_name = map[int32]string{
@ -43,14 +45,18 @@ var RuntimeEvent_EventType_name = map[int32]string{
3: "START",
4: "EXEC_ADDED",
5: "PAUSED",
6: "RESUMED",
7: "CHECKPOINTED",
}
var RuntimeEvent_EventType_value = map[string]int32{
"EXIT": 0,
"OOM": 1,
"CREATE": 2,
"START": 3,
"EXEC_ADDED": 4,
"PAUSED": 5,
"EXIT": 0,
"OOM": 1,
"CREATE": 2,
"START": 3,
"EXEC_ADDED": 4,
"PAUSED": 5,
"RESUMED": 6,
"CHECKPOINTED": 7,
}
func (x RuntimeEvent_EventType) String() string {
@ -1597,45 +1603,47 @@ func init() {
}
var fileDescriptorRuntime = []byte{
// 639 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54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 0xac, 0xc9, 0x13, 0xaf, 0x58, 0x83, 0x56, 0xf9, 0xdd,
0x28, 0xcf, 0x78, 0x0f, 0x7f, 0xb7, 0x56, 0x79, 0xd8, 0xda, 0xfa, 0x53, 0xac, 0x1d, 0x5f, 0xdc,
0xdc, 0xea, 0xb5, 0xef, 0xb7, 0x7a, 0xed, 0x63, 0xa6, 0x4b, 0x37, 0x99, 0x2e, 0x7d, 0xcb, 0x74,
0xe9, 0x67, 0xa6, 0x4b, 0xef, 0x5e, 0x3c, 0xf1, 0x2b, 0xf8, 0xbc, 0x88, 0x16, 0x4d, 0xf1, 0x82,
0xff, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x14, 0xb7, 0x09, 0x4e, 0x05, 0x00, 0x00,
// 664 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x41, 0x6b, 0xdb, 0x4a,
0x10, 0xb6, 0x24, 0x5b, 0xb6, 0xc7, 0x49, 0x9e, 0x58, 0x42, 0x10, 0x86, 0x67, 0x07, 0x9f, 0x0c,
0x0f, 0x24, 0xe2, 0x47, 0x4f, 0x85, 0x52, 0xdb, 0x52, 0xa9, 0x28, 0xa9, 0xc3, 0x5a, 0x81, 0xd0,
0x8b, 0x91, 0xad, 0x8d, 0xb3, 0xd4, 0xd6, 0x0a, 0x69, 0x65, 0x9a, 0x5b, 0x7f, 0x41, 0xe9, 0x5f,
0xea, 0x2d, 0xc7, 0xf6, 0xd6, 0x93, 0xdb, 0xe8, 0x97, 0x14, 0xad, 0x64, 0x25, 0xb4, 0x10, 0xd2,
0x5c, 0xcc, 0x7c, 0xc3, 0xcc, 0xf7, 0xed, 0x7c, 0x33, 0x16, 0xd8, 0x4b, 0xca, 0xaf, 0x92, 0xb9,
0xb1, 0x60, 0x6b, 0x73, 0xc1, 0x02, 0xee, 0xd1, 0x80, 0x44, 0xfe, 0xfd, 0xd0,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00, 0x00,
}

View File

@ -38,6 +38,8 @@ message RuntimeEvent {
START = 3;
EXEC_ADDED = 4;
PAUSED = 5;
RESUMED = 6;
CHECKPOINTED = 7;
}
EventType type = 3;
uint32 pid = 4;

View File

@ -196,7 +196,7 @@ type ImagesClient interface {
Get(ctx context.Context, in *GetImageRequest, opts ...grpc.CallOption) (*GetImageResponse, error)
// List returns a list of all images known to containerd.
List(ctx context.Context, in *ListImagesRequest, opts ...grpc.CallOption) (*ListImagesResponse, error)
// Create an image reocrd in the metadata store.
// Create an image record in the metadata store.
//
// The name of the image must be unique.
Create(ctx context.Context, in *CreateImageRequest, opts ...grpc.CallOption) (*CreateImageResponse, error)
@ -267,7 +267,7 @@ type ImagesServer interface {
Get(context.Context, *GetImageRequest) (*GetImageResponse, error)
// List returns a list of all images known to containerd.
List(context.Context, *ListImagesRequest) (*ListImagesResponse, error)
// Create an image reocrd in the metadata store.
// Create an image record in the metadata store.
//
// The name of the image must be unique.
Create(context.Context, *CreateImageRequest) (*CreateImageResponse, error)

View File

@ -283,6 +283,12 @@ func (s *Service) Pause(ctx context.Context, r *google_protobuf.Empty) (*google_
if err := s.initProcess.Pause(ctx); err != nil {
return nil, err
}
s.events <- &events.RuntimeEvent{
Type: events.RuntimeEvent_PAUSED,
ID: s.id,
ContainerID: s.id,
Timestamp: time.Now(),
}
return empty, nil
}
@ -293,6 +299,12 @@ func (s *Service) Resume(ctx context.Context, r *google_protobuf.Empty) (*google
if err := s.initProcess.Resume(ctx); err != nil {
return nil, err
}
s.events <- &events.RuntimeEvent{
Type: events.RuntimeEvent_RESUMED,
ID: s.id,
ContainerID: s.id,
Timestamp: time.Now(),
}
return empty, nil
}
@ -344,6 +356,12 @@ func (s *Service) Checkpoint(ctx context.Context, r *shimapi.CheckpointTaskReque
if err := s.initProcess.Checkpoint(ctx, r); err != nil {
return nil, err
}
s.events <- &events.RuntimeEvent{
Type: events.RuntimeEvent_CHECKPOINTED,
ID: s.id,
ContainerID: s.id,
Timestamp: time.Now(),
}
return empty, nil
}