Merge pull request #1040 from runcom/fix-process-exec-v1
[release-1.0] Fix process exec v1
This commit is contained in:
commit
3a504024d5
5 changed files with 18 additions and 5 deletions
|
@ -388,6 +388,7 @@ func (c *ContainerServer) LoadSandbox(id string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
scontainer.SetSpec(&m)
|
||||||
scontainer.SetMountPoint(m.Annotations[annotations.MountPoint])
|
scontainer.SetMountPoint(m.Annotations[annotations.MountPoint])
|
||||||
|
|
||||||
if m.Annotations[annotations.Volumes] != "" {
|
if m.Annotations[annotations.Volumes] != "" {
|
||||||
|
@ -511,6 +512,7 @@ func (c *ContainerServer) LoadContainer(id string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
ctr.SetSpec(&m)
|
||||||
ctr.SetMountPoint(m.Annotations[annotations.MountPoint])
|
ctr.SetMountPoint(m.Annotations[annotations.MountPoint])
|
||||||
|
|
||||||
c.ContainerStateFromDisk(ctr)
|
c.ContainerStateFromDisk(ctr)
|
||||||
|
|
|
@ -48,6 +48,7 @@ type Container struct {
|
||||||
imageRef string
|
imageRef string
|
||||||
volumes []ContainerVolume
|
volumes []ContainerVolume
|
||||||
mountPoint string
|
mountPoint string
|
||||||
|
spec *specs.Spec
|
||||||
}
|
}
|
||||||
|
|
||||||
// ContainerVolume is a bind mount for the container.
|
// ContainerVolume is a bind mount for the container.
|
||||||
|
@ -99,6 +100,16 @@ func NewContainer(id string, name string, bundlePath string, logPath string, net
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetSpec loads the OCI spec in the container struct
|
||||||
|
func (c *Container) SetSpec(s *specs.Spec) {
|
||||||
|
c.spec = s
|
||||||
|
}
|
||||||
|
|
||||||
|
// Spec returns a copy of the spec for the container
|
||||||
|
func (c *Container) Spec() specs.Spec {
|
||||||
|
return *c.spec
|
||||||
|
}
|
||||||
|
|
||||||
// GetStopSignal returns the container's own stop signal configured from the
|
// GetStopSignal returns the container's own stop signal configured from the
|
||||||
// image configuration or the default one.
|
// image configuration or the default one.
|
||||||
func (c *Container) GetStopSignal() string {
|
func (c *Container) GetStopSignal() string {
|
||||||
|
|
|
@ -435,11 +435,9 @@ func (r *Runtime) ExecSync(c *Container, command []string, timeout int64) (resp
|
||||||
}
|
}
|
||||||
args = append(args, "-l", logPath)
|
args = append(args, "-l", logPath)
|
||||||
|
|
||||||
pspec := rspec.Process{
|
pspec := c.Spec().Process
|
||||||
Env: r.conmonEnv,
|
pspec.Env = append(pspec.Env, r.conmonEnv...)
|
||||||
Args: command,
|
pspec.Args = command
|
||||||
Cwd: "/",
|
|
||||||
}
|
|
||||||
processJSON, err := json.Marshal(pspec)
|
processJSON, err := json.Marshal(pspec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, ExecSyncError{
|
return nil, ExecSyncError{
|
||||||
|
|
|
@ -1032,6 +1032,7 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
container.SetSpec(specgen.Spec())
|
||||||
container.SetMountPoint(mountPoint)
|
container.SetMountPoint(mountPoint)
|
||||||
|
|
||||||
for _, cv := range containerVolumes {
|
for _, cv := range containerVolumes {
|
||||||
|
|
|
@ -492,6 +492,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
container.SetSpec(g.Spec())
|
||||||
container.SetMountPoint(mountPoint)
|
container.SetMountPoint(mountPoint)
|
||||||
|
|
||||||
sb.SetInfraContainer(container)
|
sb.SetInfraContainer(container)
|
||||||
|
|
Loading…
Reference in a new issue