From 064a4e9887770f039420fdf64f67938dfb8bc21d Mon Sep 17 00:00:00 2001 From: Zhang Tianyang Date: Fri, 16 Aug 2024 15:17:50 +0800 Subject: [PATCH 1/2] image: withdraw partition mode to gpt Signed-off-by: Zhang Tianyang --- vmm/scripts/image/build_image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmm/scripts/image/build_image.sh b/vmm/scripts/image/build_image.sh index b15a4f93..a1dd82fa 100644 --- a/vmm/scripts/image/build_image.sh +++ b/vmm/scripts/image/build_image.sh @@ -339,7 +339,7 @@ create_disk() { # The partition is the rootfs content info "Creating partitions" parted -s -a optimal "${image}" -- \ - mklabel msdos \ + mklabel gpt \ mkpart primary "${fs_type}" "${part_start}"M "${rootfs_end}"M OK "Partitions created" From 3ac32b1547fcef7b43f508bf6601fafbb8e60454 Mon Sep 17 00:00:00 2001 From: Zhang Tianyang Date: Fri, 16 Aug 2024 16:25:36 +0800 Subject: [PATCH 2/2] task: ignore not exist kernel param Signed-off-by: Zhang Tianyang --- vmm/task/src/main.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vmm/task/src/main.rs b/vmm/task/src/main.rs index f15b1b6f..feb0f10f 100644 --- a/vmm/task/src/main.rs +++ b/vmm/task/src/main.rs @@ -314,7 +314,7 @@ lazy_static! { // allocate more memory than is physically available map.insert("/proc/sys/vm/overcommit_memory", "1"); - // Enable automatic expiration of nodest connections + // Enable automatic expiration of nodest connections in IPVS map.insert("/proc/sys/net/ipv4/vs/expire_nodest_conn", "1"); map }; @@ -329,9 +329,12 @@ async fn init_vm_rootfs() -> Result<()> { // Set default sysctl for sysctl in DEFAULT_SYSCTL.iter() { + if !Path::new(&sysctl.0).exists() { + continue; + } tokio::fs::write(&sysctl.0, &sysctl.1) .await - .map_err(io_error!(e, "failed to set cgroup hierarchy to 1"))?; + .map_err(io_error!(e, "failed to write kernel parameter "))?; } Ok(())