From 6dfc45cfa5ea7ee537f7354d92c59f1e37584da8 Mon Sep 17 00:00:00 2001 From: Gao feng Date: Thu, 20 Apr 2017 18:27:16 +0800 Subject: [PATCH] introduce api.Process Signed-off-by: Gao feng --- api/descriptions.pb.go | 145 +++++++++++++++++++++++----------------- api/descriptions.proto | 12 ++++ hypervisor/vm.go | 48 +++++++++---- supervisor/container.go | 9 ++- 4 files changed, 139 insertions(+), 75 deletions(-) diff --git a/api/descriptions.pb.go b/api/descriptions.pb.go index 1fab7d0b..ff74a76e 100644 --- a/api/descriptions.pb.go +++ b/api/descriptions.pb.go @@ -20,6 +20,7 @@ It has these top-level messages: VolumeOption UserGroupInfo Rlimit + Process */ package api @@ -254,6 +255,23 @@ func (m *Rlimit) String() string { return proto.CompactTextString(m) func (*Rlimit) ProtoMessage() {} func (*Rlimit) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } +type Process struct { + Container string `protobuf:"bytes,1,opt,name=Container" json:"Container,omitempty"` + Id string `protobuf:"bytes,2,opt,name=Id" json:"Id,omitempty"` + User string `protobuf:"bytes,3,opt,name=User" json:"User,omitempty"` + Group string `protobuf:"bytes,4,opt,name=Group" json:"Group,omitempty"` + AdditionalGroup []string `protobuf:"bytes,5,rep,name=AdditionalGroup" json:"AdditionalGroup,omitempty"` + Terminal bool `protobuf:"varint,6,opt,name=Terminal" json:"Terminal,omitempty"` + Args []string `protobuf:"bytes,7,rep,name=Args" json:"Args,omitempty"` + Envs []string `protobuf:"bytes,8,rep,name=Envs" json:"Envs,omitempty"` + Workdir string `protobuf:"bytes,9,opt,name=Workdir" json:"Workdir,omitempty"` +} + +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{11} } + func init() { proto.RegisterType((*SandboxConfig)(nil), "api.SandboxConfig") proto.RegisterType((*ContainerDescription)(nil), "api.ContainerDescription") @@ -266,67 +284,74 @@ func init() { proto.RegisterType((*VolumeOption)(nil), "api.VolumeOption") proto.RegisterType((*UserGroupInfo)(nil), "api.UserGroupInfo") proto.RegisterType((*Rlimit)(nil), "api.Rlimit") + proto.RegisterType((*Process)(nil), "api.Process") } var fileDescriptor0 = []byte{ - // 940 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x55, 0xdd, 0x6a, 0xe3, 0x46, - 0x14, 0x46, 0x71, 0x12, 0xdb, 0x47, 0xc9, 0xc6, 0x19, 0xd2, 0x45, 0x84, 0x52, 0x82, 0xda, 0x2d, - 0x4b, 0x0b, 0xb9, 0xf0, 0x42, 0xb7, 0x2d, 0x2c, 0x14, 0xba, 0x4b, 0x30, 0xb4, 0x89, 0x91, 0xd9, - 0x42, 0x2f, 0xc7, 0xd2, 0xd8, 0x9e, 0x46, 0xd6, 0x88, 0xd1, 0x38, 0xbb, 0xee, 0x43, 0xf4, 0xbe, - 0x7d, 0x8a, 0x3e, 0x42, 0x1f, 0xad, 0x73, 0xce, 0x8c, 0x94, 0xc9, 0xcf, 0xb6, 0xec, 0xdd, 0x39, - 0x9f, 0xce, 0xcf, 0x37, 0xe7, 0x4f, 0xc0, 0x0a, 0xd1, 0xe4, 0x5a, 0xd6, 0x46, 0xaa, 0xaa, 0x39, - 0xaf, 0xb5, 0x32, 0x8a, 0xf5, 0x78, 0x2d, 0xd3, 0xbf, 0x23, 0x38, 0x9c, 0xf1, 0xaa, 0x98, 0xab, - 0xf7, 0x3f, 0xaa, 0x6a, 0x21, 0x97, 0xec, 0x14, 0x06, 0x2b, 0xd5, 0x98, 0x8a, 0xaf, 0x45, 0x12, - 0x9d, 0x45, 0xcf, 0x87, 0x59, 0xa7, 0xb3, 0x11, 0xf4, 0x8a, 0xaa, 0x49, 0x76, 0xce, 0x7a, 0x16, - 0x46, 0x91, 0xbd, 0x80, 0x61, 0x25, 0xe4, 0x72, 0x35, 0x57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29, 0x00, 0xfe, 0xb8, 0xa9, 0x23, 0xf7, 0xf1, 0xf4, 0x35, 0xec, 0xbb, 0x1b, - 0x8c, 0xf1, 0x69, 0xf9, 0x7c, 0x7c, 0x5a, 0x3d, 0x8b, 0xad, 0xb8, 0x2e, 0x28, 0xfc, 0x6e, 0x46, - 0x32, 0x62, 0x8d, 0x5a, 0xb8, 0xe5, 0xb5, 0x18, 0xca, 0xf3, 0x7d, 0x9a, 0xa6, 0x17, 0xff, 0x06, - 0x00, 0x00, 0xff, 0xff, 0x6e, 0x9e, 0xfd, 0x2e, 0x85, 0x08, 0x00, 0x00, + // 1030 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x56, 0xef, 0x6e, 0xe3, 0x44, + 0x10, 0x97, 0x9b, 0xa6, 0x49, 0xc6, 0xed, 0x35, 0x5d, 0x95, 0x93, 0x55, 0x21, 0x54, 0x19, 0x0e, + 0x55, 0x20, 0xf5, 0x43, 0x4e, 0xe2, 0x00, 0xe9, 0x24, 0x4e, 0x5c, 0x75, 0x8a, 0x04, 0x6d, 0xe4, + 0x70, 0x20, 0x3e, 0x6e, 0xec, 0x4d, 0xb2, 0xd4, 0xf1, 0x5a, 0xeb, 0x4d, 0xef, 0xc2, 0x43, 0xf0, + 0x1d, 0x9e, 0x82, 0x47, 0xe0, 0x75, 0x78, 0x0b, 0x76, 0x66, 0xd7, 0xae, 0x9b, 0xf6, 0x38, 0xdd, + 0xb7, 0x99, 0x9f, 0x67, 0x67, 0x7e, 0x3b, 0xff, 0xd6, 0xc0, 0x32, 0x51, 0xa5, 0x5a, 0x96, 0x46, + 0xaa, 0xa2, 0x3a, 0x2f, 0xb5, 0x32, 0x8a, 0x75, 0x78, 0x29, 0xe3, 0xbf, 0x03, 0x38, 0x98, 0xf2, + 0x22, 0x9b, 0xa9, 0xb7, 0xdf, 0xab, 0x62, 0x2e, 0x17, 0xec, 0x04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, 0x6e, 0xd2, 0x86, 0x30, 0x96, 0x54, 0x65, 0x45, 0x0d, 0xd3, 0x4d, 0x48, 0x8e, 0x05, + 0x1c, 0xdc, 0xd9, 0xe0, 0x0f, 0x12, 0xb2, 0x83, 0xbf, 0x40, 0x83, 0x7a, 0xf0, 0x49, 0xc1, 0x8a, + 0xf0, 0x2c, 0x93, 0x78, 0x0d, 0x9e, 0x93, 0x03, 0x7c, 0xb8, 0xa9, 0x22, 0xdb, 0x78, 0xfc, 0x12, + 0xf6, 0xdc, 0x0e, 0x46, 0xff, 0x34, 0x7c, 0xde, 0x3f, 0x8d, 0x9e, 0xc5, 0x96, 0x5c, 0x67, 0xe4, + 0x7e, 0x37, 0x21, 0x19, 0xb1, 0x4a, 0xcd, 0xdd, 0xf0, 0x5a, 0x0c, 0xe5, 0xf8, 0xdf, 0x00, 0x7a, + 0x13, 0xad, 0x52, 0x51, 0xd1, 0xd3, 0xde, 0xec, 0x5b, 0xef, 0xec, 0x16, 0xc0, 0x41, 0x18, 0x67, + 0x9e, 0xae, 0x95, 0xd0, 0x1b, 0x5e, 0xd3, 0xe7, 0x8c, 0x64, 0xbc, 0x15, 0xb1, 0xf3, 0x13, 0xe5, + 0x14, 0x76, 0x06, 0x87, 0x2f, 0xee, 0xb2, 0xf7, 0x3f, 0x0e, 0xdb, 0x30, 0x96, 0xe9, 0x27, 0xa1, + 0x57, 0xb2, 0x7e, 0x98, 0x6d, 0x9d, 0x6b, 0x1d, 0xe3, 0xbd, 0xc0, 0xb7, 0xa9, 0xe7, 0xde, 0x26, + 0x94, 0x11, 0xc3, 0xc5, 0x6c, 0xb7, 0x0b, 0x61, 0x17, 0xfe, 0xc5, 0xfb, 0xc5, 0xbf, 0x78, 0xee, + 0xad, 0xad, 0xd5, 0xd9, 0x1e, 0x4d, 0xce, 0xd3, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x31, 0x4a, + 0x24, 0x73, 0x71, 0x09, 0x00, 0x00, } diff --git a/api/descriptions.proto b/api/descriptions.proto index 6b3b6a03..799d99ba 100644 --- a/api/descriptions.proto +++ b/api/descriptions.proto @@ -98,4 +98,16 @@ message Rlimit { string type = 1; uint64 hard = 2; uint64 soft = 3; +} + +message Process { + string Container = 1; + string Id = 2; + string User = 3; + string Group = 4; + repeated string AdditionalGroup = 5; + bool Terminal = 6; + repeated string Args = 7; + repeated string Envs = 8; + string Workdir = 9; } \ No newline at end of file diff --git a/hypervisor/vm.go b/hypervisor/vm.go index 661d0e06..b731f89f 100644 --- a/hypervisor/vm.go +++ b/hypervisor/vm.go @@ -396,7 +396,13 @@ func (vm *Vm) HyperstartExecSync(cmd []string, stdin []byte) (stdout, stderr []b return nil, nil, err } - err = vm.AddProcess(hyperstartapi.HYPERSTART_EXEC_CONTAINER, execId, false, cmd, []string{}, "/", tty) + err = vm.AddProcess(&api.Process{ + Container: hyperstartapi.HYPERSTART_EXEC_CONTAINER, + Id: execId, + Terminal: false, + Args: cmd, + Envs: []string{}, + Workdir: "/"}, tty) if err != nil { return nil, nil, err } @@ -435,7 +441,13 @@ func (vm *Vm) HyperstartExec(cmd string, tty *TtyIO) (int, error) { return -1, err } - err := vm.AddProcess(hyperstartapi.HYPERSTART_EXEC_CONTAINER, execID, false, command, []string{}, "/", tty) + err := vm.AddProcess(&api.Process{ + Container: hyperstartapi.HYPERSTART_EXEC_CONTAINER, + Id: execID, + Terminal: false, + Args: command, + Envs: []string{}, + Workdir: "/"}, tty) if err != nil { return -1, err } @@ -461,17 +473,23 @@ func (vm *Vm) Exec(container, execId, cmd string, terminal bool, tty *TtyIO) err if err := json.Unmarshal([]byte(cmd), &command); err != nil { return err } - return vm.AddProcess(container, execId, terminal, command, []string{}, "/", tty) + return vm.AddProcess(&api.Process{ + Container: container, + Id: execId, + Terminal: terminal, + Args: command, + Envs: []string{}, + Workdir: "/"}, tty) } -func (vm *Vm) AddProcess(container, execId string, terminal bool, args []string, env []string, workdir string, tty *TtyIO) error { +func (vm *Vm) AddProcess(process *api.Process, tty *TtyIO) error { if !vm.ctx.IsRunning() { return NewNotReadyError(vm.Id) } envs := []hyperstartapi.EnvironmentVar{} - for _, v := range env { + for _, v := range process.Envs { if eqlIndex := strings.Index(v, "="); eqlIndex > 0 { envs = append(envs, hyperstartapi.EnvironmentVar{ Env: v[:eqlIndex], @@ -480,24 +498,26 @@ func (vm *Vm) AddProcess(container, execId string, terminal bool, args []string, } } - stdinPipe, stdoutPipe, stderrPipe, err := vm.ctx.hyperstart.AddProcess(container, &hyperstartapi.Process{ - Id: execId, - Terminal: terminal, - Args: args, + stdinPipe, stdoutPipe, stderrPipe, err := vm.ctx.hyperstart.AddProcess(process.Container, &hyperstartapi.Process{ + Id: process.Id, + Terminal: process.Terminal, + Args: process.Args, Envs: envs, - Workdir: workdir, + Workdir: process.Workdir, + User: process.User, + Group: process.Group, }) if err != nil { - return fmt.Errorf("exec command %v failed: %v", args, err) + return fmt.Errorf("exec command %v failed: %v", process.Args, err) } go streamCopy(tty, stdinPipe, stdoutPipe, stderrPipe) go func() { - status := vm.ctx.hyperstart.WaitProcess(container, execId) - vm.ctx.DeleteExec(execId) + status := vm.ctx.hyperstart.WaitProcess(process.Container, process.Id) + vm.ctx.DeleteExec(process.Id) vm.ctx.reportProcessFinished(types.E_EXEC_FINISHED, &types.ProcessFinished{ - Id: execId, Code: uint8(status), Ack: make(chan bool, 1), + Id: process.Id, Code: uint8(status), Ack: make(chan bool, 1), }) }() return nil diff --git a/supervisor/container.go b/supervisor/container.go index d3ec1c2a..69866e3b 100644 --- a/supervisor/container.go +++ b/supervisor/container.go @@ -252,7 +252,14 @@ func (c *Container) addProcess(processId, stdin, stdout, stderr string, spec *sp ) reschan := c.ownerPod.vm.WaitProcess(false, []string{processId}, -1) - err := c.ownerPod.vm.AddProcess(c.Id, processId, spec.Terminal, spec.Args, spec.Env, spec.Cwd, p.stdio) + err := c.ownerPod.vm.AddProcess(&api.Process{ + Container: c.Id, + Id: processId, + Terminal: spec.Terminal, + Args: spec.Args, + Envs: spec.Env, + Workdir: spec.Cwd}, p.stdio) + if err != nil { glog.V(1).Infof("add process to container failed: %v\n", err) } else {