From cd59d31a15f6d69ee3ea2aff5e3b0652d1177c4d Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Fri, 5 Jan 2024 14:15:45 +0800 Subject: [PATCH 1/3] CI: make CI work for dragonball to test stability and cri-containerd It needs to remove the skip setting, and make it work for dragonball. Fixes: #8746 Signed-off-by: alex.lyn --- tests/integration/cri-containerd/gha-run.sh | 5 ----- tests/stability/gha-run.sh | 5 ----- 2 files changed, 10 deletions(-) diff --git a/tests/integration/cri-containerd/gha-run.sh b/tests/integration/cri-containerd/gha-run.sh index 09ffc4fedf..aa8ac5b80d 100755 --- a/tests/integration/cri-containerd/gha-run.sh +++ b/tests/integration/cri-containerd/gha-run.sh @@ -61,11 +61,6 @@ function run() { enabling_hypervisor - if [ "${KATA_HYPERVISOR}" = "dragonball" ]; then - echo "Skipping test for ${KATA_HYPERVISOR}" - return 0 - fi - bash -c ${cri_containerd_dir}/integration-tests.sh } diff --git a/tests/stability/gha-run.sh b/tests/stability/gha-run.sh index 6db0ffe529..23e495e444 100755 --- a/tests/stability/gha-run.sh +++ b/tests/stability/gha-run.sh @@ -32,11 +32,6 @@ function install_dependencies() { function run() { info "Running soak parallel stability tests using ${KATA_HYPERVISOR} hypervisor" - if [ "${KATA_HYPERVISOR}" = "dragonball" ]; then - echo "Skipping test for ${KATA_HYPERVISOR}" - return 0 - fi - export ITERATIONS=2 MAX_CONTAINERS=20 bash "${stability_dir}/soak_parallel_rm.sh" From 6c85e95c3404dd26fef9759f02a91d3741b4bfa1 Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Thu, 11 Jan 2024 17:23:49 +0800 Subject: [PATCH 2/3] CI: bugfix for dragonball when CI running with cri-containerd Containerd runtime options with wrong setting cause it failed. Correct it as below: ... [plugins.cri.containerd.runtimes.${runtime}.options] ConfigPath= "${KATA_CONFIG_PATH}" ... Fixes: #8746 Signed-off-by: alex.lyn --- tests/common.bash | 2 ++ .../cri-containerd/integration-tests.sh | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/common.bash b/tests/common.bash index 6b41fe7ba8..638cc527c4 100644 --- a/tests/common.bash +++ b/tests/common.bash @@ -417,6 +417,8 @@ function enabling_hypervisor() { declare -r DEST_KATA_CONFIG="${CONFIG_DIR}/configuration.toml" sudo ln -sf "${SRC_HYPERVISOR_CONFIG}" "${DEST_KATA_CONFIG}" + + export KATA_CONFIG_PATH="${DEST_KATA_CONFIG}" } diff --git a/tests/integration/cri-containerd/integration-tests.sh b/tests/integration/cri-containerd/integration-tests.sh index 147a717ac4..ab287ab233 100755 --- a/tests/integration/cri-containerd/integration-tests.sh +++ b/tests/integration/cri-containerd/integration-tests.sh @@ -40,12 +40,11 @@ readonly default_containerd_config="/etc/containerd/config.toml" readonly default_containerd_config_backup="$CONTAINERD_CONFIG_FILE.backup" readonly kata_config="/etc/kata-containers/configuration.toml" readonly kata_config_backup="$kata_config.backup" -readonly default_kata_config="/opt/kata/share/defaults/kata-containers/configuration.toml" function ci_config() { sudo mkdir -p $(dirname "${kata_config}") - [ -f "$kata_config" ] && sudo cp "$kata_config" "$kata_config_backup" || \ - sudo cp "$default_kata_config" "$kata_config" + [ -f "$kata_config" ] && sudo cp "$kata_config" "$kata_config_backup" + sudo cp -f "${KATA_CONFIG_PATH}" "$kata_config" source /etc/os-release || source /usr/lib/os-release ID=${ID:-""} @@ -88,10 +87,18 @@ function create_containerd_config() { [ -n "${runtime}" ] || die "need runtime to create config" local runtime_type="${containerd_runtime_type}" + + local runtime_config_path="${kata_config}" + + local containerd_runtime=$(command -v "containerd-shim-${runtime}-v2") + local runtime_binary_path="${containerd_runtime}" + if [ "${runtime}" == "runc" ]; then runtime_type="io.containerd.runc.v2" + runtime_config_path="" + runtime_binary_path="" fi - local containerd_runtime=$(command -v "containerd-shim-${runtime}-v2") + info "Kata Config Path ${runtime_config_path}, Runtime Binary Name ${runtime_binary_path}" cat << EOF | sudo tee "${CONTAINERD_CONFIG_FILE}" [debug] @@ -107,7 +114,8 @@ cat << EOF | sudo tee "${CONTAINERD_CONFIG_FILE}" echo ' container_annotations = ["io.katacontainers.*"]' ) [plugins.cri.containerd.runtimes.${runtime}.options] - Runtime = "${containerd_runtime}" + ConfigPath = "${runtime_config_path}" + BinaryName = "${runtime_binary_path}" [plugins.linux] shim = "${containerd_shim_path}" EOF From b97efc313954d859a65aee10bcea97eeea118027 Mon Sep 17 00:00:00 2001 From: "alex.lyn" Date: Thu, 11 Jan 2024 17:32:52 +0800 Subject: [PATCH 3/3] CI: enable test container memory update for dragonball Fixes: #8746 Signed-off-by: alex.lyn --- .../cri-containerd/integration-tests.sh | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/tests/integration/cri-containerd/integration-tests.sh b/tests/integration/cri-containerd/integration-tests.sh index ab287ab233..da919c9007 100755 --- a/tests/integration/cri-containerd/integration-tests.sh +++ b/tests/integration/cri-containerd/integration-tests.sh @@ -246,10 +246,26 @@ function TestKilledVmmCleanup() { } function TestContainerMemoryUpdate() { + # there's no need to set true for enable_virtio_mem in dragonball + # As it can support virtio-mem by default. + if [[ "${KATA_HYPERVISOR}" == "dragonball" ]]; then + # Currently, dragonball fails at decrease memory, just test increasing memory. + # We'll re-enable it as soon as we get it to work. + # Reference: https://github.com/kata-containers/kata-containers/issues/8804 + DoContainerMemoryUpdate 0 + fi + if [[ "${KATA_HYPERVISOR}" != "qemu" ]] || [[ "${ARCH}" == "ppc64le" ]] || [[ "${ARCH}" == "s390x" ]]; then return fi + for virtio_mem_enabled in {1, 0}; do + PrepareContainerMemoryUpdate $virtio_mem_enabled + DoContainerMemoryUpdate $virtio_mem_enabled + done +} + +function PrepareContainerMemoryUpdate() { test_virtio_mem=$1 if [ $test_virtio_mem -eq 1 ]; then @@ -264,7 +280,12 @@ function TestContainerMemoryUpdate() { sudo sed -i -e 's/^enable_virtio_mem.*$/#enable_virtio_mem = true/g' "${kata_config}" fi +} +function DoContainerMemoryUpdate() { + descrease_memory=$1 + + # start a test container testContainerStart vm_size=$(($(sudo crictl exec $cid cat /proc/meminfo | grep "MemTotal:" | awk '{print $2}')*1024)) @@ -282,7 +303,7 @@ function TestContainerMemoryUpdate() { die "The VM memory size $vm_size after increase is not right" fi - if [ $test_virtio_mem -eq 1 ]; then + if [ $descrease_memory -eq 1 ]; then sudo crictl update --memory $((1*1024*1024*1024)) $cid sleep 1 @@ -293,6 +314,7 @@ function TestContainerMemoryUpdate() { fi fi + # stop the test container testContainerStop } @@ -632,11 +654,7 @@ function main() { # Reference: https://github.com/kata-containers/kata-containers/issues/7410 # TestContainerSwap - # TODO: runtime-rs doesn't support memory update currently - if [ "$KATA_HYPERVISOR" != "dragonball" ]; then - TestContainerMemoryUpdate 1 - TestContainerMemoryUpdate 0 - fi + TestContainerMemoryUpdate if [[ "${ARCH}" != "ppc64le" ]]; then TestKilledVmmCleanup