Add close stdin

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-02-02 14:21:25 -08:00
parent 277cc920a4
commit a42eb9fd63
12 changed files with 358 additions and 157 deletions

View file

@ -213,9 +213,6 @@ func (s *apiServer) State(ctx context.Context, r *types.StateRequest) (*types.St
func (s *apiServer) UpdateContainer(ctx context.Context, r *types.UpdateContainerRequest) (*types.UpdateContainerResponse, error) {
e := supervisor.NewEvent(supervisor.UpdateContainerEventType)
e.ID = r.Id
if r.Signal != 0 {
e.Signal = syscall.Signal(r.Signal)
}
e.State = runtime.State(r.Status)
s.sv.SendEvent(e)
if err := <-e.Err; err != nil {
@ -224,6 +221,20 @@ func (s *apiServer) UpdateContainer(ctx context.Context, r *types.UpdateContaine
return &types.UpdateContainerResponse{}, nil
}
func (s *apiServer) UpdateProcess(ctx context.Context, r *types.UpdateProcessRequest) (*types.UpdateProcessResponse, error) {
e := supervisor.NewEvent(supervisor.UpdateProcessEventType)
e.ID = r.Id
e.Pid = r.Pid
e.Height = int(r.Height)
e.Width = int(r.Width)
e.CloseStdin = r.CloseStdin
s.sv.SendEvent(e)
if err := <-e.Err; err != nil {
return nil, err
}
return &types.UpdateProcessResponse{}, nil
}
func (s *apiServer) Events(r *types.EventsRequest, stream types.API_EventsServer) error {
events := s.sv.Events()
defer s.sv.Unsubscribe(events)

View file

@ -9,6 +9,8 @@ It is generated from these files:
api.proto
It has these top-level messages:
UpdateProcessRequest
UpdateProcessResponse
CreateContainerRequest
CreateContainerResponse
SignalRequest
@ -62,6 +64,27 @@ var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
type UpdateProcessRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Pid string `protobuf:"bytes,2,opt,name=pid" json:"pid,omitempty"`
CloseStdin bool `protobuf:"varint,3,opt,name=closeStdin" json:"closeStdin,omitempty"`
Width uint32 `protobuf:"varint,4,opt,name=width" json:"width,omitempty"`
Height uint32 `protobuf:"varint,5,opt,name=height" json:"height,omitempty"`
}
func (m *UpdateProcessRequest) Reset() { *m = UpdateProcessRequest{} }
func (m *UpdateProcessRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateProcessRequest) ProtoMessage() {}
func (*UpdateProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
type UpdateProcessResponse struct {
}
func (m *UpdateProcessResponse) Reset() { *m = UpdateProcessResponse{} }
func (m *UpdateProcessResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateProcessResponse) ProtoMessage() {}
func (*UpdateProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
type CreateContainerRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
BundlePath string `protobuf:"bytes,2,opt,name=bundlePath" json:"bundlePath,omitempty"`
@ -71,7 +94,7 @@ type CreateContainerRequest struct {
func (m *CreateContainerRequest) Reset() { *m = CreateContainerRequest{} }
func (m *CreateContainerRequest) String() string { return proto.CompactTextString(m) }
func (*CreateContainerRequest) ProtoMessage() {}
func (*CreateContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
func (*CreateContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
type CreateContainerResponse struct {
Pid uint32 `protobuf:"varint,1,opt,name=pid" json:"pid,omitempty"`
@ -83,7 +106,7 @@ type CreateContainerResponse struct {
func (m *CreateContainerResponse) Reset() { *m = CreateContainerResponse{} }
func (m *CreateContainerResponse) String() string { return proto.CompactTextString(m) }
func (*CreateContainerResponse) ProtoMessage() {}
func (*CreateContainerResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
func (*CreateContainerResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
type SignalRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
@ -94,7 +117,7 @@ type SignalRequest struct {
func (m *SignalRequest) Reset() { *m = SignalRequest{} }
func (m *SignalRequest) String() string { return proto.CompactTextString(m) }
func (*SignalRequest) ProtoMessage() {}
func (*SignalRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
func (*SignalRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
type SignalResponse struct {
}
@ -102,7 +125,7 @@ type SignalResponse struct {
func (m *SignalResponse) Reset() { *m = SignalResponse{} }
func (m *SignalResponse) String() string { return proto.CompactTextString(m) }
func (*SignalResponse) ProtoMessage() {}
func (*SignalResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
func (*SignalResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
type AddProcessRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
@ -117,7 +140,7 @@ type AddProcessRequest struct {
func (m *AddProcessRequest) Reset() { *m = AddProcessRequest{} }
func (m *AddProcessRequest) String() string { return proto.CompactTextString(m) }
func (*AddProcessRequest) ProtoMessage() {}
func (*AddProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
func (*AddProcessRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (m *AddProcessRequest) GetUser() *User {
if m != nil {
@ -135,7 +158,7 @@ type User struct {
func (m *User) Reset() { *m = User{} }
func (m *User) String() string { return proto.CompactTextString(m) }
func (*User) ProtoMessage() {}
func (*User) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (*User) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
type AddProcessResponse struct {
Stdin string `protobuf:"bytes,1,opt,name=stdin" json:"stdin,omitempty"`
@ -146,7 +169,7 @@ type AddProcessResponse struct {
func (m *AddProcessResponse) Reset() { *m = AddProcessResponse{} }
func (m *AddProcessResponse) String() string { return proto.CompactTextString(m) }
func (*AddProcessResponse) ProtoMessage() {}
func (*AddProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
func (*AddProcessResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
type CreateCheckpointRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
@ -156,7 +179,7 @@ type CreateCheckpointRequest struct {
func (m *CreateCheckpointRequest) Reset() { *m = CreateCheckpointRequest{} }
func (m *CreateCheckpointRequest) String() string { return proto.CompactTextString(m) }
func (*CreateCheckpointRequest) ProtoMessage() {}
func (*CreateCheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (*CreateCheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *CreateCheckpointRequest) GetCheckpoint() *Checkpoint {
if m != nil {
@ -171,7 +194,7 @@ type CreateCheckpointResponse struct {
func (m *CreateCheckpointResponse) Reset() { *m = CreateCheckpointResponse{} }
func (m *CreateCheckpointResponse) String() string { return proto.CompactTextString(m) }
func (*CreateCheckpointResponse) ProtoMessage() {}
func (*CreateCheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (*CreateCheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
type DeleteCheckpointRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
@ -181,7 +204,7 @@ type DeleteCheckpointRequest struct {
func (m *DeleteCheckpointRequest) Reset() { *m = DeleteCheckpointRequest{} }
func (m *DeleteCheckpointRequest) String() string { return proto.CompactTextString(m) }
func (*DeleteCheckpointRequest) ProtoMessage() {}
func (*DeleteCheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (*DeleteCheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
type DeleteCheckpointResponse struct {
}
@ -189,7 +212,7 @@ type DeleteCheckpointResponse struct {
func (m *DeleteCheckpointResponse) Reset() { *m = DeleteCheckpointResponse{} }
func (m *DeleteCheckpointResponse) String() string { return proto.CompactTextString(m) }
func (*DeleteCheckpointResponse) ProtoMessage() {}
func (*DeleteCheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (*DeleteCheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
type ListCheckpointRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
@ -198,7 +221,7 @@ type ListCheckpointRequest struct {
func (m *ListCheckpointRequest) Reset() { *m = ListCheckpointRequest{} }
func (m *ListCheckpointRequest) String() string { return proto.CompactTextString(m) }
func (*ListCheckpointRequest) ProtoMessage() {}
func (*ListCheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (*ListCheckpointRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
type Checkpoint struct {
Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
@ -211,7 +234,7 @@ type Checkpoint struct {
func (m *Checkpoint) Reset() { *m = Checkpoint{} }
func (m *Checkpoint) String() string { return proto.CompactTextString(m) }
func (*Checkpoint) ProtoMessage() {}
func (*Checkpoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
func (*Checkpoint) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
type ListCheckpointResponse struct {
Checkpoints []*Checkpoint `protobuf:"bytes,1,rep,name=checkpoints" json:"checkpoints,omitempty"`
@ -220,7 +243,7 @@ type ListCheckpointResponse struct {
func (m *ListCheckpointResponse) Reset() { *m = ListCheckpointResponse{} }
func (m *ListCheckpointResponse) String() string { return proto.CompactTextString(m) }
func (*ListCheckpointResponse) ProtoMessage() {}
func (*ListCheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (*ListCheckpointResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (m *ListCheckpointResponse) GetCheckpoints() []*Checkpoint {
if m != nil {
@ -235,7 +258,7 @@ type StateRequest struct {
func (m *StateRequest) Reset() { *m = StateRequest{} }
func (m *StateRequest) String() string { return proto.CompactTextString(m) }
func (*StateRequest) ProtoMessage() {}
func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
func (*StateRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
type ContainerState struct {
Status string `protobuf:"bytes,1,opt,name=status" json:"status,omitempty"`
@ -244,7 +267,7 @@ type ContainerState struct {
func (m *ContainerState) Reset() { *m = ContainerState{} }
func (m *ContainerState) String() string { return proto.CompactTextString(m) }
func (*ContainerState) ProtoMessage() {}
func (*ContainerState) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (*ContainerState) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
type Process struct {
Pid string `protobuf:"bytes,1,opt,name=pid" json:"pid,omitempty"`
@ -258,7 +281,7 @@ type Process struct {
func (m *Process) Reset() { *m = Process{} }
func (m *Process) String() string { return proto.CompactTextString(m) }
func (*Process) ProtoMessage() {}
func (*Process) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (*Process) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (m *Process) GetUser() *User {
if m != nil {
@ -278,7 +301,7 @@ type Container struct {
func (m *Container) Reset() { *m = Container{} }
func (m *Container) String() string { return proto.CompactTextString(m) }
func (*Container) ProtoMessage() {}
func (*Container) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
func (*Container) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (m *Container) GetProcesses() []*Process {
if m != nil {
@ -296,7 +319,7 @@ type Machine struct {
func (m *Machine) Reset() { *m = Machine{} }
func (m *Machine) String() string { return proto.CompactTextString(m) }
func (*Machine) ProtoMessage() {}
func (*Machine) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (*Machine) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
// StateResponse is information about containerd daemon
type StateResponse struct {
@ -307,7 +330,7 @@ type StateResponse struct {
func (m *StateResponse) Reset() { *m = StateResponse{} }
func (m *StateResponse) String() string { return proto.CompactTextString(m) }
func (*StateResponse) ProtoMessage() {}
func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (*StateResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (m *StateResponse) GetContainers() []*Container {
if m != nil {
@ -325,14 +348,14 @@ func (m *StateResponse) GetMachine() *Machine {
type UpdateContainerRequest struct {
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
Signal uint32 `protobuf:"varint,2,opt,name=signal" json:"signal,omitempty"`
Pid string `protobuf:"bytes,2,opt,name=pid" json:"pid,omitempty"`
Status string `protobuf:"bytes,3,opt,name=status" json:"status,omitempty"`
}
func (m *UpdateContainerRequest) Reset() { *m = UpdateContainerRequest{} }
func (m *UpdateContainerRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateContainerRequest) ProtoMessage() {}
func (*UpdateContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
func (*UpdateContainerRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
type UpdateContainerResponse struct {
}
@ -340,7 +363,7 @@ type UpdateContainerResponse struct {
func (m *UpdateContainerResponse) Reset() { *m = UpdateContainerResponse{} }
func (m *UpdateContainerResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateContainerResponse) ProtoMessage() {}
func (*UpdateContainerResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (*UpdateContainerResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
type EventsRequest struct {
}
@ -348,7 +371,7 @@ type EventsRequest struct {
func (m *EventsRequest) Reset() { *m = EventsRequest{} }
func (m *EventsRequest) String() string { return proto.CompactTextString(m) }
func (*EventsRequest) ProtoMessage() {}
func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
func (*EventsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
type Event struct {
Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
@ -365,7 +388,7 @@ type Event struct {
func (m *Event) Reset() { *m = Event{} }
func (m *Event) String() string { return proto.CompactTextString(m) }
func (*Event) ProtoMessage() {}
func (*Event) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (*Event) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (m *Event) GetProcess() *Process {
if m != nil {
@ -403,7 +426,7 @@ type NetworkStats struct {
func (m *NetworkStats) Reset() { *m = NetworkStats{} }
func (m *NetworkStats) String() string { return proto.CompactTextString(m) }
func (*NetworkStats) ProtoMessage() {}
func (*NetworkStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (*NetworkStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
type CpuUsage struct {
TotalUsage uint64 `protobuf:"varint,1,opt,name=total_usage" json:"total_usage,omitempty"`
@ -415,7 +438,7 @@ type CpuUsage struct {
func (m *CpuUsage) Reset() { *m = CpuUsage{} }
func (m *CpuUsage) String() string { return proto.CompactTextString(m) }
func (*CpuUsage) ProtoMessage() {}
func (*CpuUsage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (*CpuUsage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
type ThrottlingData struct {
Periods uint64 `protobuf:"varint,1,opt,name=periods" json:"periods,omitempty"`
@ -426,7 +449,7 @@ type ThrottlingData struct {
func (m *ThrottlingData) Reset() { *m = ThrottlingData{} }
func (m *ThrottlingData) String() string { return proto.CompactTextString(m) }
func (*ThrottlingData) ProtoMessage() {}
func (*ThrottlingData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
func (*ThrottlingData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
type CpuStats struct {
CpuUsage *CpuUsage `protobuf:"bytes,1,opt,name=cpu_usage" json:"cpu_usage,omitempty"`
@ -436,7 +459,7 @@ type CpuStats struct {
func (m *CpuStats) Reset() { *m = CpuStats{} }
func (m *CpuStats) String() string { return proto.CompactTextString(m) }
func (*CpuStats) ProtoMessage() {}
func (*CpuStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
func (*CpuStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (m *CpuStats) GetCpuUsage() *CpuUsage {
if m != nil {
@ -461,7 +484,7 @@ type MemoryData struct {
func (m *MemoryData) Reset() { *m = MemoryData{} }
func (m *MemoryData) String() string { return proto.CompactTextString(m) }
func (*MemoryData) ProtoMessage() {}
func (*MemoryData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
func (*MemoryData) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
type MemoryStats struct {
Cache uint64 `protobuf:"varint,1,opt,name=cache" json:"cache,omitempty"`
@ -474,7 +497,7 @@ type MemoryStats struct {
func (m *MemoryStats) Reset() { *m = MemoryStats{} }
func (m *MemoryStats) String() string { return proto.CompactTextString(m) }
func (*MemoryStats) ProtoMessage() {}
func (*MemoryStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (*MemoryStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
func (m *MemoryStats) GetUsage() *MemoryData {
if m != nil {
@ -514,7 +537,7 @@ type BlkioStatsEntry struct {
func (m *BlkioStatsEntry) Reset() { *m = BlkioStatsEntry{} }
func (m *BlkioStatsEntry) String() string { return proto.CompactTextString(m) }
func (*BlkioStatsEntry) ProtoMessage() {}
func (*BlkioStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
func (*BlkioStatsEntry) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
type BlkioStats struct {
IoServiceBytesRecursive []*BlkioStatsEntry `protobuf:"bytes,1,rep,name=io_service_bytes_recursive" json:"io_service_bytes_recursive,omitempty"`
@ -530,7 +553,7 @@ type BlkioStats struct {
func (m *BlkioStats) Reset() { *m = BlkioStats{} }
func (m *BlkioStats) String() string { return proto.CompactTextString(m) }
func (*BlkioStats) ProtoMessage() {}
func (*BlkioStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
func (*BlkioStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
func (m *BlkioStats) GetIoServiceBytesRecursive() []*BlkioStatsEntry {
if m != nil {
@ -597,7 +620,7 @@ type HugetlbStats struct {
func (m *HugetlbStats) Reset() { *m = HugetlbStats{} }
func (m *HugetlbStats) String() string { return proto.CompactTextString(m) }
func (*HugetlbStats) ProtoMessage() {}
func (*HugetlbStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} }
func (*HugetlbStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
type CgroupStats struct {
CpuStats *CpuStats `protobuf:"bytes,1,opt,name=cpu_stats" json:"cpu_stats,omitempty"`
@ -609,7 +632,7 @@ type CgroupStats struct {
func (m *CgroupStats) Reset() { *m = CgroupStats{} }
func (m *CgroupStats) String() string { return proto.CompactTextString(m) }
func (*CgroupStats) ProtoMessage() {}
func (*CgroupStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} }
func (*CgroupStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} }
func (m *CgroupStats) GetCpuStats() *CpuStats {
if m != nil {
@ -648,7 +671,7 @@ type Stats struct {
func (m *Stats) Reset() { *m = Stats{} }
func (m *Stats) String() string { return proto.CompactTextString(m) }
func (*Stats) ProtoMessage() {}
func (*Stats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} }
func (*Stats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{36} }
func (m *Stats) GetNetworkStats() []*NetworkStats {
if m != nil {
@ -671,9 +694,11 @@ type StatsRequest struct {
func (m *StatsRequest) Reset() { *m = StatsRequest{} }
func (m *StatsRequest) String() string { return proto.CompactTextString(m) }
func (*StatsRequest) ProtoMessage() {}
func (*StatsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} }
func (*StatsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{37} }
func init() {
proto.RegisterType((*UpdateProcessRequest)(nil), "types.UpdateProcessRequest")
proto.RegisterType((*UpdateProcessResponse)(nil), "types.UpdateProcessResponse")
proto.RegisterType((*CreateContainerRequest)(nil), "types.CreateContainerRequest")
proto.RegisterType((*CreateContainerResponse)(nil), "types.CreateContainerResponse")
proto.RegisterType((*SignalRequest)(nil), "types.SignalRequest")
@ -722,6 +747,7 @@ type APIClient interface {
CreateContainer(ctx context.Context, in *CreateContainerRequest, opts ...grpc.CallOption) (*CreateContainerResponse, error)
UpdateContainer(ctx context.Context, in *UpdateContainerRequest, opts ...grpc.CallOption) (*UpdateContainerResponse, error)
Signal(ctx context.Context, in *SignalRequest, opts ...grpc.CallOption) (*SignalResponse, error)
UpdateProcess(ctx context.Context, in *UpdateProcessRequest, opts ...grpc.CallOption) (*UpdateProcessResponse, error)
AddProcess(ctx context.Context, in *AddProcessRequest, opts ...grpc.CallOption) (*AddProcessResponse, error)
CreateCheckpoint(ctx context.Context, in *CreateCheckpointRequest, opts ...grpc.CallOption) (*CreateCheckpointResponse, error)
DeleteCheckpoint(ctx context.Context, in *DeleteCheckpointRequest, opts ...grpc.CallOption) (*DeleteCheckpointResponse, error)
@ -766,6 +792,15 @@ func (c *aPIClient) Signal(ctx context.Context, in *SignalRequest, opts ...grpc.
return out, nil
}
func (c *aPIClient) UpdateProcess(ctx context.Context, in *UpdateProcessRequest, opts ...grpc.CallOption) (*UpdateProcessResponse, error) {
out := new(UpdateProcessResponse)
err := grpc.Invoke(ctx, "/types.API/UpdateProcess", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *aPIClient) AddProcess(ctx context.Context, in *AddProcessRequest, opts ...grpc.CallOption) (*AddProcessResponse, error) {
out := new(AddProcessResponse)
err := grpc.Invoke(ctx, "/types.API/AddProcess", in, out, c.cc, opts...)
@ -881,6 +916,7 @@ type APIServer interface {
CreateContainer(context.Context, *CreateContainerRequest) (*CreateContainerResponse, error)
UpdateContainer(context.Context, *UpdateContainerRequest) (*UpdateContainerResponse, error)
Signal(context.Context, *SignalRequest) (*SignalResponse, error)
UpdateProcess(context.Context, *UpdateProcessRequest) (*UpdateProcessResponse, error)
AddProcess(context.Context, *AddProcessRequest) (*AddProcessResponse, error)
CreateCheckpoint(context.Context, *CreateCheckpointRequest) (*CreateCheckpointResponse, error)
DeleteCheckpoint(context.Context, *DeleteCheckpointRequest) (*DeleteCheckpointResponse, error)
@ -930,6 +966,18 @@ func _API_Signal_Handler(srv interface{}, ctx context.Context, dec func(interfac
return out, nil
}
func _API_UpdateProcess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) {
in := new(UpdateProcessRequest)
if err := dec(in); err != nil {
return nil, err
}
out, err := srv.(APIServer).UpdateProcess(ctx, in)
if err != nil {
return nil, err
}
return out, nil
}
func _API_AddProcess_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) {
in := new(AddProcessRequest)
if err := dec(in); err != nil {
@ -1048,6 +1096,10 @@ var _API_serviceDesc = grpc.ServiceDesc{
MethodName: "Signal",
Handler: _API_Signal_Handler,
},
{
MethodName: "UpdateProcess",
Handler: _API_UpdateProcess_Handler,
},
{
MethodName: "AddProcess",
Handler: _API_AddProcess_Handler,
@ -1084,95 +1136,99 @@ var _API_serviceDesc = grpc.ServiceDesc{
}
var fileDescriptor0 = []byte{
// 1440 bytes of a gzipped FileDescriptorProto
// 1497 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x58, 0xdb, 0x72, 0xdc, 0x44,
0x13, 0xf6, 0x9e, 0x77, 0x7b, 0x0f, 0xb6, 0xe5, 0xd8, 0x59, 0xef, 0xff, 0x87, 0x04, 0x11, 0x48,
0x8a, 0x4a, 0xb9, 0x82, 0xc3, 0x21, 0x84, 0x0b, 0x08, 0x4e, 0x2a, 0x81, 0x4a, 0xc0, 0x95, 0xd8,
0x54, 0x71, 0xc3, 0x96, 0x2c, 0x0d, 0x6b, 0xb1, 0x3a, 0x21, 0x8d, 0x7c, 0xb8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0xf2, 0x92, 0x31, 0xb0, 0x4b,
0x1f, 0x2d, 0x6b, 0xd6, 0x77, 0xd0, 0xcb, 0x3f, 0x1b, 0x2c, 0x2d, 0xd2, 0xc2, 0xd7, 0xcc, 0xe0,
0xe6, 0x92, 0x53, 0x03, 0xf8, 0x91, 0x1c, 0x04, 0xfc, 0x72, 0xd1, 0x35, 0xcb, 0xbc, 0x29, 0x06,
0xdb, 0xf9, 0x4d, 0xe3, 0xf5, 0x00, 0xea, 0xf2, 0x7b, 0xd4, 0x34, 0x40, 0xee, 0xf3, 0x74, 0xd0,
0xc9, 0xee, 0xda, 0x6b, 0x0f, 0x4a, 0x78, 0xe7, 0x35, 0x9f, 0x13, 0x26, 0xa7, 0x23, 0x1b, 0x6a,
0xce, 0x45, 0x6c, 0x72, 0x97, 0xf3, 0xba, 0xf8, 0xe7, 0xc6, 0xc3, 0x7f, 0x02, 0x00, 0x00, 0xff,
0xff, 0xb2, 0xd2, 0x28, 0x97, 0xe9, 0x10, 0x00, 0x00,
}

View file

@ -6,6 +6,7 @@ service API {
rpc CreateContainer(CreateContainerRequest) returns (CreateContainerResponse) {}
rpc UpdateContainer(UpdateContainerRequest) returns (UpdateContainerResponse) {}
rpc Signal(SignalRequest) returns (SignalResponse) {}
rpc UpdateProcess(UpdateProcessRequest) returns (UpdateProcessResponse) {}
rpc AddProcess(AddProcessRequest) returns (AddProcessResponse) {}
rpc CreateCheckpoint(CreateCheckpointRequest) returns (CreateCheckpointResponse) {}
rpc DeleteCheckpoint(DeleteCheckpointRequest) returns (DeleteCheckpointResponse) {}
@ -15,6 +16,17 @@ service API {
rpc GetStats(StatsRequest) returns (stream Stats) {}
}
message UpdateProcessRequest {
string id = 1;
string pid = 2;
bool closeStdin = 3; // Close stdin of the container
uint32 width = 4;
uint32 height = 5;
}
message UpdateProcessResponse {
}
message CreateContainerRequest {
string id = 1; // ID of container
string bundlePath = 2; // path to OCI bundle
@ -129,7 +141,7 @@ message StateResponse {
message UpdateContainerRequest {
string id = 1; // ID of container
uint32 signal = 2; // Signal
string pid = 2;
string status = 3; // Status to whcih containerd will try to change
}

View file

@ -9,6 +9,7 @@ import (
"github.com/Sirupsen/logrus"
"github.com/docker/containerd/util"
"github.com/docker/docker/pkg/term"
)
var (
@ -40,6 +41,7 @@ func main() {
// or if runc exits before we hit the handler
signals := make(chan os.Signal, 2048)
signal.Notify(signals)
setupLogger()
// set the shim as the subreaper for all orphaned processes created by the container
if err := util.SetSubreaper(1); err != nil {
logrus.WithField("error", err).Fatal("shim: set as subreaper")
@ -50,6 +52,11 @@ func main() {
logrus.WithField("error", err).Fatal("shim: open exit pipe")
}
defer f.Close()
control, err := os.OpenFile("control", syscall.O_RDWR, 0)
if err != nil {
logrus.WithField("error", err).Fatal("shim: open control pipe")
}
defer control.Close()
p, err := newProcess(flag.Arg(0), flag.Arg(1), fexec, fcheckpoint)
if err != nil {
logrus.WithField("error", err).Fatal("shim: create new process")
@ -57,6 +64,29 @@ func main() {
if err := p.start(); err != nil {
logrus.WithField("error", err).Fatal("shim: start process")
}
go func() {
for {
var msg, w, h int
if _, err := fmt.Fscanf(control, "%d %d %d\n", &msg, &w, &h); err != nil {
logrus.WithField("error", err).Error("shim: reading from control")
}
logrus.Info("got control message")
switch msg {
case 0:
// close stdin
p.shimIO.Stdin.Close()
case 1:
if p.console == nil {
continue
}
ws := term.Winsize{
Width: uint16(w),
Height: uint16(h),
}
term.SetWinsize(p.console.Fd(), &ws)
}
}
}()
var exitShim bool
for s := range signals {
logrus.WithField("signal", s).Debug("shim: received signal")

View file

@ -23,6 +23,9 @@ type process struct {
exec bool
containerPid int
checkpoint *runtime.Checkpoint
shimIO *IO
console libcontainer.Console
consolePath string
}
func newProcess(id, bundle string, exec bool, checkpoint string) (*process, error) {
@ -86,7 +89,7 @@ func (p *process) start() error {
if p.exec {
args = append(args, "exec",
"--process", filepath.Join(cwd, "process.json"),
"--console", p.stdio.console,
"--console", p.consolePath,
)
} else if p.checkpoint != nil {
args = append(args, "restore",
@ -107,7 +110,7 @@ func (p *process) start() error {
} else {
args = append(args, "start",
"--bundle", p.bundle,
"--console", p.stdio.console,
"--console", p.consolePath,
)
}
args = append(args,
@ -161,7 +164,8 @@ func (p *process) openIO() error {
if err != nil {
return err
}
p.stdio.console = console.Path()
p.console = console
p.consolePath = console.Path()
stdin, err := os.OpenFile("stdin", syscall.O_RDWR, 0)
if err != nil {
return err
@ -181,6 +185,7 @@ func (p *process) openIO() error {
if err != nil {
return err
}
p.shimIO = i
// non-tty
for name, dest := range map[string]func(f *os.File){
"stdin": func(f *os.File) {
@ -254,7 +259,6 @@ type stdio struct {
stdin *os.File
stdout *os.File
stderr *os.File
console string
}
func (s *stdio) Close() error {

View file

@ -215,6 +215,13 @@ var startCommand = cli.Command{
}
go func() {
io.Copy(stdin, os.Stdin)
if _, err := c.UpdateProcess(netcontext.Background(), &types.UpdateProcessRequest{
Id: id,
Pid: "init",
CloseStdin: true,
}); err != nil {
fatal(err.Error(), 1)
}
restoreAndCloseStdin()
}()
if err := waitForExit(c, id, "init", restoreAndCloseStdin); err != nil {
@ -245,7 +252,7 @@ func readTermSetting(path string) (bool, error) {
}
func attachStdio(stdins, stdout, stderr string) error {
stdinf, err := os.OpenFile(stdins, syscall.O_RDWR, 0)
stdinf, err := os.OpenFile(stdins, syscall.O_WRONLY, 0)
if err != nil {
return err
}
@ -271,6 +278,7 @@ var killCommand = cli.Command{
Flags: []cli.Flag{
cli.StringFlag{
Name: "pid,p",
Value: "init",
Usage: "pid of the process to signal within the container",
},
cli.IntFlag{

View file

@ -158,6 +158,9 @@ func (c *container) Start(checkpoint string) (Process, error) {
if err := cmd.Start(); err != nil {
return nil, err
}
if _, err := p.getPid(); err != nil {
return p, nil
}
c.processes[InitProcessID] = p
return p, nil
}
@ -179,6 +182,9 @@ func (c *container) Exec(pid string, spec specs.Process) (Process, error) {
if err := cmd.Start(); err != nil {
return nil, err
}
if _, err := p.getPid(); err != nil {
return p, nil
}
c.processes[pid] = p
return p, nil
}

View file

@ -2,12 +2,14 @@ package runtime
import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"os"
"path/filepath"
"strconv"
"syscall"
"time"
"github.com/opencontainers/specs"
)
@ -21,6 +23,8 @@ type Process interface {
ID() string
// Stdin returns the path the the processes stdin fifo
Stdin() string
CloseStdin() error
Resize(int, int) error
// Stdout returns the path the the processes stdout fifo
Stdout() string
// Stderr returns the path the the processes stderr fifo
@ -68,7 +72,12 @@ func newProcess(root, id string, c *container, s specs.Process) (*process, error
if err != nil {
return nil, err
}
control, err := getControlPipe(filepath.Join(root, ControlFile))
if err != nil {
return nil, err
}
p.exitPipe = exit
p.controlPipe = control
return p, nil
}
@ -105,15 +114,24 @@ func getExitPipe(path string) (*os.File, error) {
return os.OpenFile(path, syscall.O_RDONLY|syscall.O_NONBLOCK, 0)
}
func getControlPipe(path string) (*os.File, error) {
if err := syscall.Mkfifo(path, 0755); err != nil && !os.IsExist(err) {
return nil, err
}
return os.OpenFile(path, syscall.O_RDWR|syscall.O_NONBLOCK, 0)
}
type process struct {
root string
id string
pid int
// stdio fifos
stdin string
stdout string
stderr string
exitPipe *os.File
controlPipe *os.File
container *container
spec specs.Process
}
@ -131,6 +149,16 @@ func (p *process) ExitFD() int {
return int(p.exitPipe.Fd())
}
func (p *process) CloseStdin() error {
_, err := fmt.Fprintf(p.controlPipe, "%d %d %d\n", 0, 0, 0)
return err
}
func (p *process) Resize(w, h int) error {
_, err := fmt.Fprintf(p.controlPipe, "%d %d %d\n", 1, w, h)
return err
}
func (p *process) ExitStatus() (int, error) {
data, err := ioutil.ReadFile(filepath.Join(p.root, ExitStatusFile))
if err != nil {
@ -142,16 +170,12 @@ func (p *process) ExitStatus() (int, error) {
if len(data) == 0 {
return -1, ErrProcessNotExited
}
i, err := strconv.Atoi(string(data))
if err != nil {
return -1, err
}
return i, nil
return strconv.Atoi(string(data))
}
// Signal sends the provided signal to the process
func (p *process) Signal(s os.Signal) error {
return errNotImplemented
return syscall.Kill(p.pid, s.(syscall.Signal))
}
func (p *process) Spec() specs.Process {
@ -174,3 +198,23 @@ func (p *process) Stderr() string {
func (p *process) Close() error {
return p.exitPipe.Close()
}
func (p *process) getPid() (int, error) {
for i := 0; i < 20; i++ {
data, err := ioutil.ReadFile(filepath.Join(p.root, "pid"))
if err != nil {
if os.IsNotExist(err) {
time.Sleep(100 * time.Millisecond)
continue
}
return -1, err
}
i, err := strconv.Atoi(string(data))
if err != nil {
return -1, err
}
p.pid = i
return i, nil
}
return -1, fmt.Errorf("containerd: cannot read pid file")
}

View file

@ -22,6 +22,7 @@ const (
ExitFile = "exit"
ExitStatusFile = "exitStatus"
StateFile = "state.json"
ControlFile = "control"
InitProcessID = "init"
)

View file

@ -19,6 +19,7 @@ const (
SignalEventType EventType = "signal"
AddProcessEventType EventType = "addProcess"
UpdateContainerEventType EventType = "updateContainer"
UpdateProcessEventType EventType = "updateProcess"
CreateCheckpointEventType EventType = "createCheckpoint"
DeleteCheckpointEventType EventType = "deleteCheckpoint"
StatsEventType EventType = "events"
@ -61,6 +62,10 @@ type Event struct {
Err chan error
StartResponse chan StartResponse
Stats chan interface{}
CloseStdin bool
ResizeTty bool
Width int
Height int
}
type Handler interface {

View file

@ -66,6 +66,7 @@ func New(stateDir string, tasks chan *StartTask, oom bool) (*Supervisor, error)
StatsEventType: &StatsEvent{s},
UnsubscribeStatsEventType: &UnsubscribeStatsEvent{s},
StopStatsEventType: &StopStatsEvent{s},
UpdateProcessEventType: &UpdateProcessEvent{s},
}
go s.exitHandler()
if err := s.restore(); err != nil {

View file

@ -26,18 +26,41 @@ func (h *UpdateEvent) Handle(e *Event) error {
return ErrUnknownContainerStatus
}
}
if e.Signal != nil {
// signal the pid1/main process of the container
processes, err := container.Processes()
return nil
}
type UpdateProcessEvent struct {
s *Supervisor
}
func (h *UpdateProcessEvent) Handle(e *Event) error {
i, ok := h.s.containers[e.ID]
if !ok {
return ErrContainerNotFound
}
processes, err := i.container.Processes()
if err != nil {
return err
}
var process runtime.Process
for _, p := range processes {
if p.ID() == runtime.InitProcessID {
return p.Signal(e.Signal)
if p.ID() == e.Pid {
process = p
break
}
}
if process == nil {
return ErrProcessNotFound
}
if e.CloseStdin {
if err := process.CloseStdin(); err != nil {
return err
}
}
if e.Width > 0 || e.Height > 0 {
if err := process.Resize(e.Width, e.Height); err != nil {
return err
}
}
return nil
}