Skip to content

Commit 3ac32b1

Browse files
committed
task: ignore not exist kernel param
Signed-off-by: Zhang Tianyang <[email protected]>
1 parent 064a4e9 commit 3ac32b1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

vmm/task/src/main.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ lazy_static! {
314314
// allocate more memory than is physically available
315315
map.insert("/proc/sys/vm/overcommit_memory", "1");
316316

317-
// Enable automatic expiration of nodest connections
317+
// Enable automatic expiration of nodest connections in IPVS
318318
map.insert("/proc/sys/net/ipv4/vs/expire_nodest_conn", "1");
319319
map
320320
};
@@ -329,9 +329,12 @@ async fn init_vm_rootfs() -> Result<()> {
329329

330330
// Set default sysctl
331331
for sysctl in DEFAULT_SYSCTL.iter() {
332+
if !Path::new(&sysctl.0).exists() {
333+
continue;
334+
}
332335
tokio::fs::write(&sysctl.0, &sysctl.1)
333336
.await
334-
.map_err(io_error!(e, "failed to set cgroup hierarchy to 1"))?;
337+
.map_err(io_error!(e, "failed to write kernel parameter "))?;
335338
}
336339

337340
Ok(())

0 commit comments

Comments
 (0)