Return DeleteResponse from ContainerService.Delete

The message was defined but the method was returning empty, plumb through the
result from the shim layer.

Compile tested only.

Signed-off-by: Ian Campbell <ian.campbell@docker.com>
This commit is contained in:
Ian Campbell 2017-03-01 14:58:05 +00:00
parent 4793f968e5
commit 186a9a2acd
6 changed files with 54 additions and 52 deletions

View File

@ -201,8 +201,8 @@ type WriteRequest struct {
// file. This uses standard, zero-indexed semantics. // file. This uses standard, zero-indexed semantics.
// //
// If the action is write, the remote may remove all previously written // If the action is write, the remote may remove all previously written
// data up to the offset. Implementations may support arbitrary offsets but // data after the offset. Implementations may support arbitrary offsets but
// MUST support reseting this value to zero with with a write. If an // MUST support reseting this value to zero with a write. If an
// implementation does not support a write at a particular offset, an // implementation does not support a write at a particular offset, an
// OutOfRange error must be returned. // OutOfRange error must be returned.
Offset int64 `protobuf:"varint,5,opt,name=offset,proto3" json:"offset,omitempty"` Offset int64 `protobuf:"varint,5,opt,name=offset,proto3" json:"offset,omitempty"`

View File

@ -155,7 +155,7 @@ const _ = grpc.SupportPackageIsVersion4
type ContainerServiceClient interface { type ContainerServiceClient interface {
Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Start(ctx context.Context, in *StartRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error)
Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*containerd_v1_types1.Container, error) Info(ctx context.Context, in *InfoRequest, opts ...grpc.CallOption) (*containerd_v1_types1.Container, error)
List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error) List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, error) Events(ctx context.Context, in *EventsRequest, opts ...grpc.CallOption) (ContainerService_EventsClient, error)
@ -187,8 +187,8 @@ func (c *containerServiceClient) Start(ctx context.Context, in *StartRequest, op
return out, nil return out, nil
} }
func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) { func (c *containerServiceClient) Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error) {
out := new(google_protobuf.Empty) out := new(DeleteResponse)
err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Delete", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/containerd.v1.services.ContainerService/Delete", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
@ -251,7 +251,7 @@ func (x *containerServiceEventsClient) Recv() (*containerd_v1_types1.Event, erro
type ContainerServiceServer interface { type ContainerServiceServer interface {
Create(context.Context, *CreateRequest) (*CreateResponse, error) Create(context.Context, *CreateRequest) (*CreateResponse, error)
Start(context.Context, *StartRequest) (*google_protobuf.Empty, error) Start(context.Context, *StartRequest) (*google_protobuf.Empty, error)
Delete(context.Context, *DeleteRequest) (*google_protobuf.Empty, error) Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
Info(context.Context, *InfoRequest) (*containerd_v1_types1.Container, error) Info(context.Context, *InfoRequest) (*containerd_v1_types1.Container, error)
List(context.Context, *ListRequest) (*ListResponse, error) List(context.Context, *ListRequest) (*ListResponse, error)
Events(*EventsRequest, ContainerService_EventsServer) error Events(*EventsRequest, ContainerService_EventsServer) error
@ -1950,42 +1950,42 @@ func init() {
} }
var fileDescriptorExecution = []byte{ var fileDescriptorExecution = []byte{
// 589 bytes of a gzipped FileDescriptorProto // 590 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x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ba, 0xb0,
0xdd, 0x2c, 0x2c, 0xed, 0xdb, 0xc2, 0xd2, 0x7e, 0x2e, 0x2c, 0x6d, 0xa8, 0x2b, 0x61, 0x9e, 0xfc, 0xb4, 0x9b, 0x85, 0xa5, 0x7d, 0x5f, 0x58, 0xda, 0xaf, 0x85, 0xa5, 0x0d, 0x75, 0xe5, 0xf8, 0xb3,
0x0e, 0x00, 0x00, 0xff, 0xff, 0x81, 0xbf, 0xf2, 0x2b, 0xa9, 0x05, 0x00, 0x00, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8b, 0xe4, 0x78, 0xce, 0xb9, 0x05, 0x00, 0x00,
} }

View File

@ -11,7 +11,7 @@ import "github.com/docker/containerd/api/types/container/container.proto";
service ContainerService { service ContainerService {
rpc Create(CreateRequest) returns (CreateResponse); rpc Create(CreateRequest) returns (CreateResponse);
rpc Start(StartRequest) returns (google.protobuf.Empty); rpc Start(StartRequest) returns (google.protobuf.Empty);
rpc Delete(DeleteRequest) returns (google.protobuf.Empty); rpc Delete(DeleteRequest) returns (DeleteResponse);
rpc Info(InfoRequest) returns (containerd.v1.types.Container); rpc Info(InfoRequest) returns (containerd.v1.types.Container);
rpc List(ListRequest) returns (ListResponse); rpc List(ListRequest) returns (ListResponse);
rpc Events(EventsRequest) returns (stream containerd.v1.types.Event); rpc Events(EventsRequest) returns (stream containerd.v1.types.Event);

View File

@ -92,16 +92,17 @@ func (r *Runtime) Create(ctx context.Context, id string, opts containerd.CreateO
}, nil }, nil
} }
func (r *Runtime) Delete(ctx context.Context, c containerd.Container) error { func (r *Runtime) Delete(ctx context.Context, c containerd.Container) (uint32, error) {
lc, ok := c.(*Container) lc, ok := c.(*Container)
if !ok { if !ok {
return fmt.Errorf("container cannot be cast as *linux.Container") return 0, fmt.Errorf("container cannot be cast as *linux.Container")
} }
if _, err := lc.shim.Delete(ctx, &shim.DeleteRequest{}); err != nil { rsp, err := lc.shim.Delete(ctx, &shim.DeleteRequest{})
return err if err != nil {
return 0, err
} }
lc.shim.Exit(ctx, &shim.ExitRequest{}) lc.shim.Exit(ctx, &shim.ExitRequest{})
return r.deleteBundle(lc.id) return rsp.ExitStatus, r.deleteBundle(lc.id)
} }
func (r *Runtime) Containers() ([]containerd.Container, error) { func (r *Runtime) Containers() ([]containerd.Container, error) {

View File

@ -26,7 +26,7 @@ type Runtime interface {
// Containers returns all the current containers for the runtime // Containers returns all the current containers for the runtime
Containers() ([]Container, error) Containers() ([]Container, error)
// Delete removes the container in the runtime // Delete removes the container in the runtime
Delete(context.Context, Container) error Delete(context.Context, Container) (uint32, error)
// Events returns events for the runtime and all containers created by the runtime // Events returns events for the runtime and all containers created by the runtime
Events(context.Context) <-chan *Event Events(context.Context) <-chan *Event
} }

View File

@ -116,7 +116,7 @@ func (s *Service) Start(ctx context.Context, r *api.StartRequest) (*google_proto
return empty, nil return empty, nil
} }
func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*google_protobuf.Empty, error) { func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*api.DeleteResponse, error) {
c, err := s.getContainer(r.ID) c, err := s.getContainer(r.ID)
if err != nil { if err != nil {
return nil, err return nil, err
@ -125,10 +125,11 @@ func (s *Service) Delete(ctx context.Context, r *api.DeleteRequest) (*google_pro
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := runtime.Delete(ctx, c); err != nil { status, err := runtime.Delete(ctx, c)
if err != nil {
return nil, err return nil, err
} }
return empty, nil return &api.DeleteResponse{ExitStatus: status}, nil
} }
func containerFromContainerd(ctx context.Context, c containerd.Container) (*container.Container, error) { func containerFromContainerd(ctx context.Context, c containerd.Container) (*container.Container, error) {