Skip to content

Commit c300c19

Browse files
authored
Merge pull request #124 from Burning1020/def-sand-cgr
cgroup: use default sandbox cgroup path
2 parents f1106e7 + 7c0d179 commit c300c19

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

vmm/sandbox/src/cgroup.rs

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use crate::{
2929
vm::VcpuThreads,
3030
};
3131

32+
pub const DEFAULT_CGROUP_PARENT_PATH: &str = "kuasar-vmm";
3233
pub const VCPU_CGROUP_NAME: &str = "vcpu";
3334
pub const POD_OVERHEAD_CGROUP_NAME: &str = "pod_overhead";
3435

vmm/sandbox/src/sandbox.rs

+3-9
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use vmm_common::{
3939
};
4040

4141
use crate::{
42-
cgroup::SandboxCgroup,
42+
cgroup::{SandboxCgroup, DEFAULT_CGROUP_PARENT_PATH},
4343
client::{
4444
client_check, client_sync_clock, client_update_interfaces, client_update_routes,
4545
new_sandbox_client,
@@ -154,14 +154,8 @@ where
154154
}
155155

156156
let mut sandbox_cgroups = SandboxCgroup::default();
157-
let cgroup_parent_path = match get_sandbox_cgroup_parent_path(&s.sandbox) {
158-
Some(cgroup_parent_path) => cgroup_parent_path,
159-
None => {
160-
return Err(Error::Other(anyhow!(
161-
"Failed to get sandbox cgroup parent path."
162-
)))
163-
}
164-
};
157+
let cgroup_parent_path = get_sandbox_cgroup_parent_path(&s.sandbox)
158+
.unwrap_or(DEFAULT_CGROUP_PARENT_PATH.to_string());
165159
// Currently only support cgroup V1, cgroup V2 is not supported now
166160
if !cgroups_rs::hierarchies::is_cgroup2_unified_mode() {
167161
// Create sandbox's cgroup and apply sandbox's resources limit

0 commit comments

Comments
 (0)