mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 13:14:33 +00:00
katautils: Run the createRuntime hooks
The preStart hooks are being deprecated over the createRuntime ones. Signed-off-by: Samuel Ortiz <s.ortiz@apple.com>
This commit is contained in:
parent
d9dfce1453
commit
a871a33b65
@ -160,6 +160,11 @@ func CreateSandbox(ctx context.Context, vci vc.VC, ociSpec specs.Spec, runtimeCo
|
||||
return nil, vc.Process{}, err
|
||||
}
|
||||
|
||||
// Run create runtime OCI hooks, in the runtime namespace.
|
||||
if err := CreateRuntimeHooks(ctx, ociSpec, containerID, bundlePath); err != nil {
|
||||
return nil, vc.Process{}, err
|
||||
}
|
||||
|
||||
sandbox, err := vci.CreateSandbox(ctx, sandboxConfig)
|
||||
if err != nil {
|
||||
return nil, vc.Process{}, err
|
||||
|
@ -110,6 +110,15 @@ func runHooks(ctx context.Context, spec specs.Spec, hooks []specs.Hook, cid, bun
|
||||
return nil
|
||||
}
|
||||
|
||||
func CreateRuntimeHooks(ctx context.Context, spec specs.Spec, cid, bundlePath string) error {
|
||||
// If no hook available, nothing needs to be done.
|
||||
if spec.Hooks == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
return runHooks(ctx, spec, spec.Hooks.CreateRuntime, cid, bundlePath, "createRuntime")
|
||||
}
|
||||
|
||||
// PreStartHooks run the hooks before start container
|
||||
func PreStartHooks(ctx context.Context, spec specs.Spec, cid, bundlePath string) error {
|
||||
// If no hook available, nothing needs to be done.
|
||||
|
Loading…
Reference in New Issue
Block a user