mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 15:32:30 +00:00
Merge pull request #9275 from Apokleos/swap-hooks-bindmnt
kata-agent: Change order of guest hook and bind mount processing
This commit is contained in:
commit
07bfdf4a22
@ -1168,15 +1168,6 @@ impl agent_ttrpc::AgentService for AgentService {
|
|||||||
s.hostname = req.hostname.clone();
|
s.hostname = req.hostname.clone();
|
||||||
s.running = true;
|
s.running = true;
|
||||||
|
|
||||||
if !req.guest_hook_path.is_empty() {
|
|
||||||
let _ = s.add_hooks(&req.guest_hook_path).map_err(|e| {
|
|
||||||
error!(
|
|
||||||
sl(),
|
|
||||||
"add guest hook {} failed: {:?}", req.guest_hook_path, e
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if !req.sandbox_id.is_empty() {
|
if !req.sandbox_id.is_empty() {
|
||||||
s.id = req.sandbox_id.clone();
|
s.id = req.sandbox_id.clone();
|
||||||
}
|
}
|
||||||
@ -1188,11 +1179,25 @@ impl agent_ttrpc::AgentService for AgentService {
|
|||||||
s.setup_shared_namespaces().await.map_ttrpc_err(same)?;
|
s.setup_shared_namespaces().await.map_ttrpc_err(same)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let m = add_storages(sl(), req.storages, &self.sandbox, None)
|
let m = add_storages(sl(), req.storages.clone(), &self.sandbox, None)
|
||||||
.await
|
.await
|
||||||
.map_ttrpc_err(same)?;
|
.map_ttrpc_err(same)?;
|
||||||
self.sandbox.lock().await.mounts = m;
|
self.sandbox.lock().await.mounts = m;
|
||||||
|
|
||||||
|
// Scan guest hooks upon creating new sandbox and append
|
||||||
|
// them to guest OCI spec before running containers.
|
||||||
|
{
|
||||||
|
let mut s = self.sandbox.lock().await;
|
||||||
|
if !req.guest_hook_path.is_empty() {
|
||||||
|
let _ = s.add_hooks(&req.guest_hook_path).map_err(|e| {
|
||||||
|
error!(
|
||||||
|
sl(),
|
||||||
|
"add guest hook {} failed: {:?}", req.guest_hook_path, e
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setup_guest_dns(sl(), &req.dns).map_ttrpc_err(same)?;
|
setup_guest_dns(sl(), &req.dns).map_ttrpc_err(same)?;
|
||||||
{
|
{
|
||||||
let mut s = self.sandbox.lock().await;
|
let mut s = self.sandbox.lock().await;
|
||||||
|
Loading…
Reference in New Issue
Block a user