Merge pull request #7273 from openanolis/runtime-rs-fix-mem-ci

bugfix: plus default_memory when calculating mem size
This commit is contained in:
Fabiano Fidêncio
2023-07-10 15:12:05 +02:00
committed by GitHub
2 changed files with 6 additions and 7 deletions

View File

@@ -105,7 +105,12 @@ impl InitialSizeManager {
hv.cpu_info.default_vcpus = self.resource.vcpu as i32
}
if self.resource.mem_mb > 0 {
hv.memory_info.default_memory = self.resource.mem_mb;
// since the memory overhead introduced by kata-agent and system components
// will really affect the amount of memory the user can use, so we choose to
// plus the default_memory here, instead of overriding it.
// (if we override the default_memory here, and user apllications still
// use memory as they orignally expected, it would be easy to OOM.)
hv.memory_info.default_memory += self.resource.mem_mb;
}
Ok(())
}

View File

@@ -9,15 +9,11 @@ load "${BATS_TEST_DIRNAME}/../../common.bash"
load "${BATS_TEST_DIRNAME}/tests_common.sh"
setup() {
[ "${KATA_HYPERVISOR}" == "dragonball" ] && skip "Test is currently failing, see: https://github.com/kata-containers/kata-containers/issues/7271"
pod_name="pod-oom"
get_pod_config_dir
}
@test "Test OOM events for pods" {
[ "${KATA_HYPERVISOR}" == "dragonball" ] && skip "Test is currently failing, see: https://github.com/kata-containers/kata-containers/issues/7271"
# Create pod
kubectl create -f "${pod_config_dir}/$pod_name.yaml"
@@ -33,8 +29,6 @@ setup() {
}
teardown() {
[ "${KATA_HYPERVISOR}" == "dragonball" ] && skip "Test is currently failing, see: https://github.com/kata-containers/kata-containers/issues/7271"
# Debugging information
kubectl describe "pod/$pod_name"
kubectl get "pod/$pod_name" -o yaml