agent/sandbox: Don't update cpuset when ncpus = 0

When receiving an OnlineCpuMemory RPC, if the number of CPUs to be
made available is 0, then updating the cpusets is a redundant operation.

Fixes: #1172

Signed-off-by: Maruth Goyal <maruthgoyal@gmail.com>
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Maruth Goyal 2020-12-09 15:13:25 +05:30 committed by Peng Tao
parent 9117dd409e
commit 662e8db5dd

View File

@ -233,6 +233,10 @@ impl Sandbox {
online_memory(&self.logger)?;
}
if req.nb_cpus == 0 {
return Ok(());
}
let cpuset = rustjail_cgroups::fs::get_guest_cpuset()?;
for (_, ctr) in self.containers.iter() {