mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 06:44:23 +01:00
runtime-rs: add CreateContainer hook support
CreateContainer hook is one kind of OCI hook. In kata, it will be executed after VM is started, before container is created, and after CreateRuntime is executed. The hook path of CreateContainer hook is in host runtime namespace, but it will be executed in host vmm namespace. Fixes: #5787 Signed-off-by: Yushuo <y-shuo@linux.alibaba.com>
This commit is contained in:
@@ -169,6 +169,9 @@ message Hooks {
|
||||
|
||||
// Createruntime is a list of hooks to be run during the creation of runtime(sandbox).
|
||||
repeated Hook CreateRuntime = 4 [(gogoproto.nullable) = false];
|
||||
|
||||
// CreateContainer is a list of hooks to be run after VM is started, and before container is created.
|
||||
repeated Hook CreateContainer = 5 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Hook {
|
||||
|
||||
@@ -295,6 +295,7 @@ impl From<oci::Hooks> for crate::oci::Hooks {
|
||||
crate::oci::Hooks {
|
||||
Prestart: from_vec(from.prestart),
|
||||
CreateRuntime: from_vec(from.create_runtime),
|
||||
CreateContainer: from_vec(from.create_container),
|
||||
Poststart: from_vec(from.poststart),
|
||||
Poststop: from_vec(from.poststop),
|
||||
unknown_fields: Default::default(),
|
||||
@@ -979,6 +980,10 @@ impl From<crate::oci::Hooks> for oci::Hooks {
|
||||
for hook in from.take_CreateRuntime().to_vec() {
|
||||
create_runtime.push(hook.into())
|
||||
}
|
||||
let mut create_container = Vec::new();
|
||||
for hook in from.take_CreateContainer().to_vec() {
|
||||
create_container.push(hook.into())
|
||||
}
|
||||
let mut poststart = Vec::new();
|
||||
for hook in from.take_Poststart().to_vec() {
|
||||
poststart.push(hook.into());
|
||||
@@ -990,6 +995,7 @@ impl From<crate::oci::Hooks> for oci::Hooks {
|
||||
oci::Hooks {
|
||||
prestart,
|
||||
create_runtime,
|
||||
create_container,
|
||||
poststart,
|
||||
poststop,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user