Skip to content

Commit bd9c4fd

Browse files
committed
Merge branch 'master' of https://github.com/alibaba/pouch into cri-compatibility
2 parents 8d01e30 + 521ca7c commit bd9c4fd

File tree

2 files changed

+12
-29
lines changed

2 files changed

+12
-29
lines changed

cri/v1alpha2/cri.go

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -688,23 +688,7 @@ func (c *CriManager) UpdateContainerResources(ctx context.Context, r *runtime.Up
688688
// to either create a new log file and return nil, or return an error.
689689
// Once it returns error, new container log file MUST NOT be created.
690690
func (c *CriManager) ReopenContainerLog(ctx context.Context, r *runtime.ReopenContainerLogRequest) (*runtime.ReopenContainerLogResponse, error) {
691-
containerID := r.GetContainerId()
692-
container, err := c.ContainerMgr.Get(ctx, containerID)
693-
if err != nil {
694-
return nil, fmt.Errorf("failed to get container of %q: %v", containerID, err)
695-
}
696-
if container.State.Status != apitypes.StatusRunning {
697-
return nil, fmt.Errorf("container %q is not running", containerID)
698-
}
699-
c.ContainerMgr.(*mgr.ContainerManager).IOs.Remove(containerID)
700-
if container.LogPath != "" {
701-
logPath := container.LogPath
702-
err := c.attachLog(logPath, containerID)
703-
if err != nil {
704-
return nil, err
705-
}
706-
}
707-
return &runtime.ReopenContainerLogResponse{}, nil
691+
return nil, fmt.Errorf("UpdateContainerResources Not Implemented Yet")
708692
}
709693

710694
// ExecSync executes a command in the container, and returns the stdout output.

daemon/mgr/container.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type ContainerMgr interface {
9595
// Remove removes a container, it may be running or stopped and so on.
9696
Remove(ctx context.Context, name string, option *types.ContainerRemoveOptions) error
9797

98-
// 2. The following five functions is related to containr exec.
98+
// 2. The following five functions is related to container exec.
9999

100100
// CreateExec creates exec process's environment.
101101
CreateExec(ctx context.Context, name string, config *types.ExecCreateConfig) (string, error)
@@ -1674,16 +1674,6 @@ func (mgr *ContainerManager) exitedAndRelease(id string, m *ctrd.Message) error
16741674
// execExitedAndRelease be register into ctrd as a callback function, when the exec process in a container
16751675
// exited, "ctrd" will call it to release resource and so on.
16761676
func (mgr *ContainerManager) execExitedAndRelease(id string, m *ctrd.Message) error {
1677-
if io := mgr.IOs.Get(id); io != nil {
1678-
if err := m.RawError(); err != nil {
1679-
fmt.Fprintf(io.Stdout, "%v\n", err)
1680-
}
1681-
1682-
// close io
1683-
io.Close()
1684-
mgr.IOs.Remove(id)
1685-
}
1686-
16871677
v, ok := mgr.ExecProcesses.Get(id).Result()
16881678
if !ok {
16891679
return errors.Wrap(errtypes.ErrNotfound, "to be exec process: "+id)
@@ -1696,7 +1686,16 @@ func (mgr *ContainerManager) execExitedAndRelease(id string, m *ctrd.Message) er
16961686
execConfig.Running = false
16971687
execConfig.Error = m.RawError()
16981688

1699-
// TODO: GC invalid mgr.ExecProcess.
1689+
if io := mgr.IOs.Get(id); io != nil {
1690+
if err := m.RawError(); err != nil {
1691+
fmt.Fprintf(io.Stdout, "%v\n", err)
1692+
}
1693+
1694+
// close io
1695+
io.Close()
1696+
mgr.IOs.Remove(id)
1697+
}
1698+
17001699
return nil
17011700
}
17021701

0 commit comments

Comments
 (0)