1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-11 09:55:58 +00:00

Merge pull request from zvonkok/kata-agent-createcontainer

kata-agent: CreateContainer Hook
This commit is contained in:
Fupan Li 2024-05-27 16:36:22 +08:00 committed by GitHub
commit 6f6a164451
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -601,6 +601,22 @@ fn do_init_child(cwfd: RawFd) -> Result<()> {
unistd::close(mount_fd)?;
}
if init {
// CreateContainer Hooks:
// before pivot_root after prestart, createruntime
state.pid = std::process::id() as i32;
state.status = oci::ContainerState::Created;
if let Some(hooks) = spec.hooks.as_ref() {
log_child!(
cfd_log,
"create_container hooks {:?}",
hooks.create_container
);
let mut create_container_states = HookStates::new();
create_container_states.execute_hooks(&hooks.create_container, Some(state.clone()))?;
}
}
if to_new.contains(CloneFlags::CLONE_NEWNS) {
// unistd::chroot(rootfs)?;
if no_pivot {