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>
This commit is contained in:
Maruth Goyal 2020-12-09 15:13:25 +05:30
parent e167bf30e3
commit 4af5beda35

View File

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