rustjail: fix the issue of missing destroy contaienr cgroups

In the container's destroy method, it should destroy
the container's cgroups.

Fixes: #1291

Signed-off-by: fupan.lfp <fupan.lfp@antfin.com>
This commit is contained in:
fupan.lfp 2021-01-19 16:00:41 +08:00 committed by Peng Tao
parent 3df65f4f3a
commit 61fa4a3c75

View File

@ -968,6 +968,10 @@ impl BaseContainer for LinuxContainer {
MntFlags::MNT_DETACH,
)?;
fs::remove_dir_all(&self.root)?;
if let Some(cgm) = self.cgroup_manager.as_mut() {
cgm.destroy().context("destroy cgroups")?;
}
Ok(())
}