mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-19 07:14:22 +01:00
runtime-rs: cleanup kata host share path
cleanup the /run/kata-containers/shared/sandboxes/pid path Fixes:#5975 Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
This commit is contained in:
@@ -11,7 +11,7 @@ use async_trait::async_trait;
|
||||
pub trait Sandbox: Send + Sync {
|
||||
async fn start(&self, netns: Option<String>) -> Result<()>;
|
||||
async fn stop(&self) -> Result<()>;
|
||||
async fn cleanup(&self, container_id: &str) -> Result<()>;
|
||||
async fn cleanup(&self) -> Result<()>;
|
||||
async fn shutdown(&self) -> Result<()>;
|
||||
|
||||
// agent function
|
||||
|
||||
@@ -174,7 +174,7 @@ impl RuntimeHandlerManager {
|
||||
.await
|
||||
.context("failed to restore the sandbox")?;
|
||||
sandbox
|
||||
.cleanup(&inner.id)
|
||||
.cleanup()
|
||||
.await
|
||||
.context("failed to cleanup the resource")?;
|
||||
}
|
||||
|
||||
@@ -242,17 +242,7 @@ impl Sandbox for VirtSandbox {
|
||||
|
||||
self.stop().await.context("stop")?;
|
||||
|
||||
info!(sl!(), "delete cgroup");
|
||||
self.resource_manager
|
||||
.delete_cgroups()
|
||||
.await
|
||||
.context("delete cgroups")?;
|
||||
|
||||
info!(sl!(), "delete hypervisor");
|
||||
self.hypervisor
|
||||
.cleanup()
|
||||
.await
|
||||
.context("delete hypervisor")?;
|
||||
self.cleanup().await.context("do the clean up")?;
|
||||
|
||||
info!(sl!(), "stop monitor");
|
||||
self.monitor.stop().await;
|
||||
@@ -269,9 +259,19 @@ impl Sandbox for VirtSandbox {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn cleanup(&self, _id: &str) -> Result<()> {
|
||||
self.resource_manager.delete_cgroups().await?;
|
||||
self.hypervisor.cleanup().await?;
|
||||
async fn cleanup(&self) -> Result<()> {
|
||||
info!(sl!(), "delete hypervisor");
|
||||
self.hypervisor
|
||||
.cleanup()
|
||||
.await
|
||||
.context("delete hypervisor")?;
|
||||
|
||||
info!(sl!(), "resource clean up");
|
||||
self.resource_manager
|
||||
.cleanup()
|
||||
.await
|
||||
.context("resource clean up")?;
|
||||
|
||||
// TODO: cleanup other snadbox resource
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user