mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-29 04:04:45 +00:00
agent: simplify function online_cpu_memory()
Simplify function online_cpu_memory() by on calling update_cpuset_path() for containers with cpuset configured. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
This commit is contained in:
parent
d3c5422379
commit
37f34781d1
@ -270,20 +270,17 @@ impl Sandbox {
|
||||
let guest_cpuset = rustjail_cgroups::fs::get_guest_cpuset()?;
|
||||
|
||||
for (_, ctr) in self.containers.iter() {
|
||||
let mut container_cpust = "";
|
||||
if let Some(spec) = ctr.config.spec.as_ref() {
|
||||
if let Some(linux) = spec.linux.as_ref() {
|
||||
if let Some(resources) = linux.resources.as_ref() {
|
||||
if let Some(cpus) = resources.cpu.as_ref() {
|
||||
container_cpust = &cpus.cpus;
|
||||
info!(self.logger, "updating {}", ctr.id.as_str());
|
||||
ctr.cgroup_manager
|
||||
.update_cpuset_path(guest_cpuset.as_str(), &cpus.cpus)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
info!(self.logger, "updating {}", ctr.id.as_str());
|
||||
ctr.cgroup_manager
|
||||
.update_cpuset_path(guest_cpuset.as_str(), container_cpust)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user