mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-11 09:55:58 +00:00
Merge pull request #9268 from zvonkok/kata-agent-createcontainer
kata-agent: CreateContainer Hook
This commit is contained in:
commit
6f6a164451
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user