runtime: clh-config: add runtime hooks to the clh toml

Today hooks are only described in the QEMU toml. This shouldn't be VMM
specific -- let's make sure these are advertised for Cloud Hypervisor as
well.

Fixes: #1401

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
This commit is contained in:
Eric Ernst 2021-02-11 14:04:57 -08:00 committed by Eric Ernst
parent 96196e102e
commit 2e2749ad3f
4 changed files with 20 additions and 2 deletions

View File

@ -113,7 +113,7 @@ block_device_driver = "@DEFBLOCKSTORAGEDRIVER_ACRN@"
# lexicographical order, to the lifecycle of the guest container. # lexicographical order, to the lifecycle of the guest container.
# Hooks are executed in the runtime namespace of the guest. See the official documentation: # Hooks are executed in the runtime namespace of the guest. See the official documentation:
# https://github.com/opencontainers/runtime-spec/blob/v1.0.1/config.md#posix-platform-hooks # https://github.com/opencontainers/runtime-spec/blob/v1.0.1/config.md#posix-platform-hooks
# Warnings will be logged if any error is encountered will scanning for hooks, # Warnings will be logged if any error is encountered while scanning for hooks,
# but it will not abort container execution. # but it will not abort container execution.
#guest_hook_path = "/usr/share/oci/hooks" #guest_hook_path = "/usr/share/oci/hooks"

View File

@ -115,6 +115,23 @@ block_device_driver = "virtio-blk"
# Default false # Default false
#enable_debug = true #enable_debug = true
# Path to OCI hook binaries in the *guest rootfs*.
# This does not affect host-side hooks which must instead be added to
# the OCI spec passed to the runtime.
#
# You can create a rootfs with hooks by customizing the osbuilder scripts:
# https://github.com/kata-containers/osbuilder
#
# Hooks must be stored in a subdirectory of guest_hook_path according to their
# hook type, i.e. "guest_hook_path/{prestart,postart,poststop}".
# The agent will scan these directories for executable files and add them, in
# lexicographical order, to the lifecycle of the guest container.
# Hooks are executed in the runtime namespace of the guest. See the official documentation:
# https://github.com/opencontainers/runtime-spec/blob/v1.0.1/config.md#posix-platform-hooks
# Warnings will be logged if any error is encountered while scanning for hooks,
# but it will not abort container execution.
#guest_hook_path = "/usr/share/oci/hooks"
#
[agent.@PROJECT_TYPE@] [agent.@PROJECT_TYPE@]
# If enabled, make the agent display debug-level messages. # If enabled, make the agent display debug-level messages.
# (default: disabled) # (default: disabled)

View File

@ -309,7 +309,7 @@ pflashes = []
# lexicographical order, to the lifecycle of the guest container. # lexicographical order, to the lifecycle of the guest container.
# Hooks are executed in the runtime namespace of the guest. See the official documentation: # Hooks are executed in the runtime namespace of the guest. See the official documentation:
# https://github.com/opencontainers/runtime-spec/blob/v1.0.1/config.md#posix-platform-hooks # https://github.com/opencontainers/runtime-spec/blob/v1.0.1/config.md#posix-platform-hooks
# Warnings will be logged if any error is encountered will scanning for hooks, # Warnings will be logged if any error is encountered while scanning for hooks,
# but it will not abort container execution. # but it will not abort container execution.
#guest_hook_path = "/usr/share/oci/hooks" #guest_hook_path = "/usr/share/oci/hooks"
# #

View File

@ -873,6 +873,7 @@ func newClhHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
HotplugVFIOOnRootBus: h.HotplugVFIOOnRootBus, HotplugVFIOOnRootBus: h.HotplugVFIOOnRootBus,
PCIeRootPort: h.PCIeRootPort, PCIeRootPort: h.PCIeRootPort,
DisableVhostNet: true, DisableVhostNet: true,
GuestHookPath: h.guestHookPath(),
VirtioFSExtraArgs: h.VirtioFSExtraArgs, VirtioFSExtraArgs: h.VirtioFSExtraArgs,
SGXEPCSize: defaultSGXEPCSize, SGXEPCSize: defaultSGXEPCSize,
EnableAnnotations: h.EnableAnnotations, EnableAnnotations: h.EnableAnnotations,