runtime-rs: Update swap option of configuration file

Remove swap configuration from qemu config file because runtime-rs
qemu support code doesn't support hotplug block device.
Add swap configuration to dragonball and cloud-hypervisor config file.

Fixes: #10988

Signed-off-by: Hui Zhu <teawater@antgroup.com>
This commit is contained in:
Hui Zhu 2025-03-06 17:38:57 +08:00
parent 93cd30862d
commit 796eab3bef
3 changed files with 34 additions and 11 deletions

View File

@ -214,6 +214,23 @@ block_device_driver = "virtio-blk-pci"
# but it will not abort container execution.
#guest_hook_path = "/usr/share/oci/hooks"
# Enable swap in the guest. Default false.
# When enable_guest_swap is enabled, insert a raw file to the guest as the swap device.
#enable_guest_swap = true
# If enable_guest_swap is enabled, the swap device will be created in the guest
# at this path. Default "/run/kata-containers/swap".
#guest_swap_path = "/run/kata-containers/swap"
# The percentage of the total memory to be used as swap device.
# Default 100.
#guest_swap_size_percent = 100
# The threshold in seconds to create swap device in the guest.
# Kata will wait guest_swap_create_threshold_secs seconds before creating swap device.
# Default 60.
#guest_swap_create_threshold_secs = 60
[agent.@PROJECT_TYPE@]
container_pipe_size=@PIPESIZE@
# If enabled, make the agent display debug-level messages.

View File

@ -217,6 +217,23 @@ virtio_fs_cache = "@DEFVIRTIOFSCACHE@"
# result in memory pre allocation
#enable_hugepages = true
# Enable swap in the guest. Default false.
# When enable_guest_swap is enabled, insert a raw file to the guest as the swap device.
#enable_guest_swap = true
# If enable_guest_swap is enabled, the swap device will be created in the guest
# at this path. Default "/run/kata-containers/swap".
#guest_swap_path = "/run/kata-containers/swap"
# The percentage of the total memory to be used as swap device.
# Default 100.
#guest_swap_size_percent = 100
# The threshold in seconds to create swap device in the guest.
# Kata will wait guest_swap_create_threshold_secs seconds before creating swap device.
# Default 60.
#guest_swap_create_threshold_secs = 60
[agent.@PROJECT_TYPE@]
container_pipe_size=@PIPESIZE@
# If enabled, make the agent display debug-level messages.

View File

@ -470,17 +470,6 @@ valid_entropy_sources = @DEFVALIDENTROPYSOURCES@
# See: https://www.qemu.org/docs/master/qemu-qmp-ref.html#Dump-guest-memory for details
#guest_memory_dump_paging=false
# Enable swap in the guest. Default false.
# When enable_guest_swap is enabled, insert a raw file to the guest as the swap device
# if the swappiness of a container (set by annotation "io.katacontainers.container.resource.swappiness")
# is bigger than 0.
# The size of the swap device should be
# swap_in_bytes (set by annotation "io.katacontainers.container.resource.swap_in_bytes") - memory_limit_in_bytes.
# If swap_in_bytes is not set, the size should be memory_limit_in_bytes.
# If swap_in_bytes and memory_limit_in_bytes is not set, the size should
# be default_memory.
#enable_guest_swap = true
# use legacy serial for guest console if available and implemented for architecture. Default false
#use_legacy_serial = true