Skip to content

Commit

Permalink
Merge pull request #124 from Burning1020/def-sand-cgr
Browse files Browse the repository at this point in the history
cgroup: use default sandbox cgroup path
  • Loading branch information
abel-von authored Apr 8, 2024
2 parents f1106e7 + 7c0d179 commit c300c19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
1 change: 1 addition & 0 deletions vmm/sandbox/src/cgroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use crate::{
vm::VcpuThreads,
};

pub const DEFAULT_CGROUP_PARENT_PATH: &str = "kuasar-vmm";
pub const VCPU_CGROUP_NAME: &str = "vcpu";
pub const POD_OVERHEAD_CGROUP_NAME: &str = "pod_overhead";

Expand Down
12 changes: 3 additions & 9 deletions vmm/sandbox/src/sandbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use vmm_common::{
};

use crate::{
cgroup::SandboxCgroup,
cgroup::{SandboxCgroup, DEFAULT_CGROUP_PARENT_PATH},
client::{
client_check, client_sync_clock, client_update_interfaces, client_update_routes,
new_sandbox_client,
Expand Down Expand Up @@ -154,14 +154,8 @@ where
}

let mut sandbox_cgroups = SandboxCgroup::default();
let cgroup_parent_path = match get_sandbox_cgroup_parent_path(&s.sandbox) {
Some(cgroup_parent_path) => cgroup_parent_path,
None => {
return Err(Error::Other(anyhow!(
"Failed to get sandbox cgroup parent path."
)))
}
};
let cgroup_parent_path = get_sandbox_cgroup_parent_path(&s.sandbox)
.unwrap_or(DEFAULT_CGROUP_PARENT_PATH.to_string());
// Currently only support cgroup V1, cgroup V2 is not supported now
if !cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
// Create sandbox's cgroup and apply sandbox's resources limit
Expand Down

0 comments on commit c300c19

Please sign in to comment.