Beispiel #1
0
func (r *OCIRuntime) Status(ctx context.Context, c *execution.Container) (execution.Status, error) {
	state, err := r.runc.State(ctx, c.ID())
	if err != nil {
		return "", err
	}
	return execution.Status(state.Status), nil
}
Beispiel #2
0
func (r *OCIRuntime) load(runcC *runc.Container) (*execution.Container, error) {
	container := execution.LoadContainer(
		execution.StateDir(filepath.Join(r.root, runcC.ID)),
		runcC.ID,
		runcC.Bundle,
		execution.Status(runcC.Status),
		int64(runcC.Pid),
	)

	dirs, err := container.StateDir().Processes()
	if err != nil {
		return nil, err
	}
	for _, d := range dirs {
		process, err := newProcess(filepath.Base(d), d, execution.Running)
		if err != nil {
			return nil, err
		}
		container.AddProcess(process, process.Pid() == int64(runcC.Pid))
	}

	return container, nil
}