From d6546f2a56f1d8411f6b9785097d8b88c383160f Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Wed, 25 Mar 2026 16:25:38 +0800 Subject: [PATCH 1/5] runtime-rs: Remove virtio-9p from configuration*.toml.in As virtio-9p is never supported in runtime-rs, we have more choices to replace it with blockfile snapshotter or erofs snapshotter(in future). It's time to remove its documents and reduce misleading guidance. Signed-off-by: Alex Lyn --- src/runtime-rs/config/configuration-dragonball.toml.in | 1 - .../config/configuration-qemu-coco-dev-runtime-rs.toml.in | 1 - src/runtime-rs/config/configuration-qemu-runtime-rs.toml.in | 1 - src/runtime-rs/config/configuration-qemu-se-runtime-rs.toml.in | 1 - 4 files changed, 4 deletions(-) diff --git a/src/runtime-rs/config/configuration-dragonball.toml.in b/src/runtime-rs/config/configuration-dragonball.toml.in index c953ed7148..54ea7abae9 100644 --- a/src/runtime-rs/config/configuration-dragonball.toml.in +++ b/src/runtime-rs/config/configuration-dragonball.toml.in @@ -174,7 +174,6 @@ guest_hook_path = "" # Shared file system type: # - inline-virtio-fs (default) # - virtio-fs -# - virtio-9p # - virtio-fs-nydus # "inline-virtio-fs" is the same as "virtio-fs", but it is running in the same process # of shim, does not need an external virtiofsd process. diff --git a/src/runtime-rs/config/configuration-qemu-coco-dev-runtime-rs.toml.in b/src/runtime-rs/config/configuration-qemu-coco-dev-runtime-rs.toml.in index 7ed437883b..b99b420399 100644 --- a/src/runtime-rs/config/configuration-qemu-coco-dev-runtime-rs.toml.in +++ b/src/runtime-rs/config/configuration-qemu-coco-dev-runtime-rs.toml.in @@ -179,7 +179,6 @@ disable_block_device_use = @DEFDISABLEBLOCK@ # Shared file system type: # - virtio-fs (default) -# - virtio-9p # - virtio-fs-nydus # - none shared_fs = "@DEFSHAREDFS_QEMU_COCO_DEV_VIRTIOFS@" diff --git a/src/runtime-rs/config/configuration-qemu-runtime-rs.toml.in b/src/runtime-rs/config/configuration-qemu-runtime-rs.toml.in index f9c82cfca2..28743e1efe 100644 --- a/src/runtime-rs/config/configuration-qemu-runtime-rs.toml.in +++ b/src/runtime-rs/config/configuration-qemu-runtime-rs.toml.in @@ -163,7 +163,6 @@ disable_block_device_use = @DEFDISABLEBLOCK@ # Shared file system type: # - virtio-fs (default) -# - virtio-9p # - virtio-fs-nydus # - none shared_fs = "@DEFSHAREDFS_QEMU_VIRTIOFS@" diff --git a/src/runtime-rs/config/configuration-qemu-se-runtime-rs.toml.in b/src/runtime-rs/config/configuration-qemu-se-runtime-rs.toml.in index 6cf3938025..d67e1f424b 100644 --- a/src/runtime-rs/config/configuration-qemu-se-runtime-rs.toml.in +++ b/src/runtime-rs/config/configuration-qemu-se-runtime-rs.toml.in @@ -162,7 +162,6 @@ disable_block_device_use = @DEFDISABLEBLOCK@ # Shared file system type: # - virtio-fs (default) -# - virtio-9p # - virtio-fs-nydus # - none shared_fs = "@DEFSHAREDFS_QEMU_SEL_VIRTIOFS@" From f133b81579aac1feba6facc7a263a1df8cf86eed Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Wed, 25 Mar 2026 16:54:37 +0800 Subject: [PATCH 2/5] docs: update shared filesystem documentation and tests (1) Update annotations documentation to reflect new shared filesystem options (virtio-fs, inline-virtio-fs, virtio-fs-nydus, none). (2) Replace virtio-9p references with inline-virtio-fs in config doc. (3) Update drop-in configuration tests to use 'none' instead of 'virtio-9p' Signed-off-by: Alex Lyn --- src/libs/kata-types/src/annotations/mod.rs | 2 +- src/libs/kata-types/src/config/drop_in.rs | 4 ++-- src/libs/kata-types/src/config/hypervisor/mod.rs | 9 +++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/libs/kata-types/src/annotations/mod.rs b/src/libs/kata-types/src/annotations/mod.rs index 249742df51..15d64fa905 100644 --- a/src/libs/kata-types/src/annotations/mod.rs +++ b/src/libs/kata-types/src/annotations/mod.rs @@ -257,7 +257,7 @@ pub const KATA_ANNO_CFG_HYPERVISOR_ENABLE_ROOTLESS_HYPERVISOR: &str = "io.katacontainers.config.hypervisor.rootless"; // Hypervisor Shared File System related annotations -/// A sandbox annotation to specify the shared file system type, either inline-virtio-fs (default), virtio-9p, virtio-fs or virtio-fs-nydus. +/// A sandbox annotation to specify the shared file system type, either virtio-fs(default), inline-virtio-fs, virtio-fs-nydus or none. pub const KATA_ANNO_CFG_HYPERVISOR_SHARED_FS: &str = "io.katacontainers.config.hypervisor.shared_fs"; /// A sandbox annotations to specify virtio-fs vhost-user daemon path. diff --git a/src/libs/kata-types/src/config/drop_in.rs b/src/libs/kata-types/src/config/drop_in.rs index 4e6ab4cc87..bcd99033ec 100644 --- a/src/libs/kata-types/src/config/drop_in.rs +++ b/src/libs/kata-types/src/config/drop_in.rs @@ -346,7 +346,7 @@ mod drop_in_directory_handling { let dropin_override_data = r#" [hypervisor.qemu] - shared_fs = "virtio-9p" + shared_fs = "none" [runtime] vfio_mode="vfio" "#; @@ -372,7 +372,7 @@ mod drop_in_directory_handling { assert_eq!(config.hypervisor["qemu"].device_info.default_bridges, 4); assert_eq!( config.hypervisor["qemu"].shared_fs.shared_fs.as_deref(), - Some("virtio-9p") + Some("none") ); assert!(config.runtime.debug); assert!(config.runtime.sandbox_cgroup_only); diff --git a/src/libs/kata-types/src/config/hypervisor/mod.rs b/src/libs/kata-types/src/config/hypervisor/mod.rs index 72839104bc..81bbd6353f 100644 --- a/src/libs/kata-types/src/config/hypervisor/mod.rs +++ b/src/libs/kata-types/src/config/hypervisor/mod.rs @@ -1418,12 +1418,13 @@ impl SecurityInfo { } } -/// Configuration information for shared filesystems, such as virtio-9p and virtio-fs. +/// Configuration information for shared filesystems, such as virtio-fs-nydus and virtio-fs. #[derive(Clone, Debug, Default, Deserialize, Serialize)] pub struct SharedFsInfo { /// Type of shared file system to use: /// - `virtio-fs` (default) - /// - `virtio-9p` + /// - `inline-virtio-fs` + /// - `virtio-fs-nydus` /// - `none` (disables shared filesystem) pub shared_fs: Option, @@ -1476,7 +1477,7 @@ impl SharedFsInfo { /// Adjusts the shared filesystem configuration after loading from a configuration file. /// /// Handles default values for `shared_fs` type, `virtio-fs` specific settings - /// (daemon path, cache mode, DAX), and `virtio-9p` msize. + /// (daemon path, cache mode, DAX) or `inline-virtio-fs` settings. pub fn adjust_config(&mut self) -> Result<()> { if self.shared_fs.as_deref() == Some(NO_VIRTIO_FS) { self.shared_fs = None; @@ -1503,7 +1504,7 @@ impl SharedFsInfo { /// Validates the shared filesystem configuration. /// /// Checks the validity of the selected `shared_fs` type and - /// performs specific validations for `virtio-fs` and `virtio-9p` settings. + /// performs specific validations for `virtio-fs` and `inline-virtio-fs` settings. pub fn validate(&self) -> Result<()> { match self.shared_fs.as_deref() { None => Ok(()), From 10b24a19c874cf51d992cb96f5d1abc1b4c48c7b Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Wed, 25 Mar 2026 17:04:20 +0800 Subject: [PATCH 3/5] kata-types: Remove virtio-9p shared filesystem support Remove all virtio-9p related code and configurations: (1) Remove DRIVER_9P_TYPE and VIRTIO_9P. (2) Remove 9p validation and adjustment logic from SharedFsInfo. (3) Remove KATA_ANNO_CFG_HYPERVISOR_MSIZE_9P annotation handling. (4) Update test configurations to remove msize_9p settings. (5) Update documentation and proto comments. Signed-off-by: Alex Lyn --- src/libs/kata-types/src/annotations/mod.rs | 10 --------- src/libs/kata-types/src/config/default.rs | 3 --- .../kata-types/src/config/hypervisor/mod.rs | 22 ------------------- src/libs/kata-types/src/device.rs | 2 -- .../tests/texture/configuration-anno-0.toml | 1 - .../tests/texture/configuration-anno-1.toml | 1 - src/libs/protocols/protos/agent.proto | 4 ++-- 7 files changed, 2 insertions(+), 41 deletions(-) diff --git a/src/libs/kata-types/src/annotations/mod.rs b/src/libs/kata-types/src/annotations/mod.rs index 15d64fa905..37037c04fa 100644 --- a/src/libs/kata-types/src/annotations/mod.rs +++ b/src/libs/kata-types/src/annotations/mod.rs @@ -272,8 +272,6 @@ pub const KATA_ANNO_CFG_HYPERVISOR_VIRTIO_FS_CACHE_SIZE: &str = /// A sandbox annotation to pass options to virtiofsd daemon. pub const KATA_ANNO_CFG_HYPERVISOR_VIRTIO_FS_EXTRA_ARGS: &str = "io.katacontainers.config.hypervisor.virtio_fs_extra_args"; -/// A sandbox annotation to specify as the msize for 9p shares. -pub const KATA_ANNO_CFG_HYPERVISOR_MSIZE_9P: &str = "io.katacontainers.config.hypervisor.msize_9p"; /// The initdata annotation passed in when CVM launchs pub const KATA_ANNO_CFG_HYPERVISOR_INIT_DATA: &str = "io.katacontainers.config.hypervisor.cc_init_data"; @@ -975,14 +973,6 @@ impl Annotation { hv.shared_fs.virtio_fs_extra_args.push(arg.to_string()); } } - KATA_ANNO_CFG_HYPERVISOR_MSIZE_9P => match self.get_value::(key) { - Ok(v) => { - hv.shared_fs.msize_9p = v.unwrap_or_default(); - } - Err(_e) => { - return Err(u32_err); - } - }, KATA_ANNO_CFG_HYPERVISOR_BLOCK_DEV_NUM_QUEUES => { match self.get_value::(key) { Ok(v) => { diff --git a/src/libs/kata-types/src/config/default.rs b/src/libs/kata-types/src/config/default.rs index 7a4e42b80e..5e5585e5c9 100644 --- a/src/libs/kata-types/src/config/default.rs +++ b/src/libs/kata-types/src/config/default.rs @@ -47,9 +47,6 @@ pub const DEFAULT_BLOCK_DEVICE_QUEUE_SIZE: u32 = 128; pub const DEFAULT_SHARED_FS_TYPE: &str = "virtio-fs"; pub const DEFAULT_VIRTIO_FS_CACHE_MODE: &str = "never"; pub const DEFAULT_VIRTIO_FS_DAX_SIZE_MB: u32 = 1024; -pub const DEFAULT_SHARED_9PFS_SIZE_MB: u32 = 8 * 1024; -pub const MIN_SHARED_9PFS_SIZE_MB: u32 = 4 * 1024; -pub const MAX_SHARED_9PFS_SIZE_MB: u32 = 8 * 1024 * 1024; pub const DEFAULT_GUEST_HOOK_PATH: &str = "/opt/kata/hooks"; pub const DEFAULT_GUEST_DNS_FILE: &str = "/etc/resolv.conf"; diff --git a/src/libs/kata-types/src/config/hypervisor/mod.rs b/src/libs/kata-types/src/config/hypervisor/mod.rs index 81bbd6353f..e54bb72f34 100644 --- a/src/libs/kata-types/src/config/hypervisor/mod.rs +++ b/src/libs/kata-types/src/config/hypervisor/mod.rs @@ -68,7 +68,6 @@ mod firecracker; pub use self::firecracker::{FirecrackerConfig, HYPERVISOR_NAME_FIRECRACKER}; const NO_VIRTIO_FS: &str = "none"; -const VIRTIO_9P: &str = "virtio-9p"; const VIRTIO_FS: &str = "virtio-fs"; const VIRTIO_FS_INLINE: &str = "inline-virtio-fs"; const MAX_BRIDGE_SIZE: u32 = 5; @@ -1466,11 +1465,6 @@ pub struct SharedFsInfo { /// Enables `virtio-fs` DAX (Direct Access) window if `true`. #[serde(default)] pub virtio_fs_is_dax: bool, - - /// This is the `msize` used for 9p shares. It represents the number of bytes - /// used for the 9p packet payload. - #[serde(default)] - pub msize_9p: u32, } impl SharedFsInfo { @@ -1490,11 +1484,6 @@ impl SharedFsInfo { match self.shared_fs.as_deref() { Some(VIRTIO_FS) => self.adjust_virtio_fs(false)?, Some(VIRTIO_FS_INLINE) => self.adjust_virtio_fs(true)?, - Some(VIRTIO_9P) => { - if self.msize_9p == 0 { - self.msize_9p = default::DEFAULT_SHARED_9PFS_SIZE_MB; - } - } _ => {} } @@ -1510,17 +1499,6 @@ impl SharedFsInfo { None => Ok(()), Some(VIRTIO_FS) => self.validate_virtio_fs(false), Some(VIRTIO_FS_INLINE) => self.validate_virtio_fs(true), - Some(VIRTIO_9P) => { - if self.msize_9p < default::MIN_SHARED_9PFS_SIZE_MB - || self.msize_9p > default::MAX_SHARED_9PFS_SIZE_MB - { - return Err(std::io::Error::other(format!( - "Invalid 9p configuration msize 0x{:x}, min value is 0x{:x}, max value is 0x{:x}", - self.msize_9p,default::MIN_SHARED_9PFS_SIZE_MB, default::MAX_SHARED_9PFS_SIZE_MB - ))); - } - Ok(()) - } Some(v) => Err(std::io::Error::other(format!("Invalid shared_fs type {v}"))), } } diff --git a/src/libs/kata-types/src/device.rs b/src/libs/kata-types/src/device.rs index 10fe604052..47045af7c2 100644 --- a/src/libs/kata-types/src/device.rs +++ b/src/libs/kata-types/src/device.rs @@ -27,8 +27,6 @@ pub const DRIVER_VFIO_AP_TYPE: &str = "vfio-ap"; /// DRIVER_VFIO_AP_COLD_TYPE is the device driver for vfio-ap coldplug. pub const DRIVER_VFIO_AP_COLD_TYPE: &str = "vfio-ap-cold"; -/// DRIVER_9P_TYPE is the driver for 9pfs volume. -pub const DRIVER_9P_TYPE: &str = "9p"; /// DRIVER_EPHEMERAL_TYPE is the driver for ephemeral volume. pub const DRIVER_EPHEMERAL_TYPE: &str = "ephemeral"; /// DRIVER_LOCAL_TYPE is the driver for local volume. diff --git a/src/libs/kata-types/tests/texture/configuration-anno-0.toml b/src/libs/kata-types/tests/texture/configuration-anno-0.toml index a2f1dac02e..ea37b6ac05 100644 --- a/src/libs/kata-types/tests/texture/configuration-anno-0.toml +++ b/src/libs/kata-types/tests/texture/configuration-anno-0.toml @@ -48,7 +48,6 @@ file_mem_backend = "/dev/shm" valid_file_mem_backends = ["/dev/shm","/dev/snd","./test_file_backend_mem_root"] pflashes = ["/proc/mounts"] enable_debug = true -msize_9p = 16384 disable_image_nvdimm = true hotplug_vfio_on_root_bus = true pcie_root_port = 2 diff --git a/src/libs/kata-types/tests/texture/configuration-anno-1.toml b/src/libs/kata-types/tests/texture/configuration-anno-1.toml index 12a4e85f94..d5be8943ee 100644 --- a/src/libs/kata-types/tests/texture/configuration-anno-1.toml +++ b/src/libs/kata-types/tests/texture/configuration-anno-1.toml @@ -47,7 +47,6 @@ file_mem_backend = "/dev/shm" valid_file_mem_backends = ["/dev/shm"] pflashes = ["/proc/mounts"] enable_debug = true -msize_9p = 16384 disable_image_nvdimm = true hotplug_vfio_on_root_bus = true pcie_root_port = 2 diff --git a/src/libs/protocols/protos/agent.proto b/src/libs/protocols/protos/agent.proto index 40ab1da09b..962b68a4ce 100644 --- a/src/libs/protocols/protos/agent.proto +++ b/src/libs/protocols/protos/agent.proto @@ -493,7 +493,7 @@ message SharedMount { // could have been defined through the Mount list of the OCI specification. message Storage { // Driver is used to define the way the storage is passed through the - // virtual machine. It can be "9p", "blk", or something else, but for + // virtual machine. It can be "blk", or something else, but for // all cases, this will define if some extra steps are required before // this storage gets mounted into the container. string driver = 1; @@ -509,7 +509,7 @@ message Storage { string source = 3; // Fstype represents the filesystem that needs to be used to mount the // storage inside the VM. For instance, it could be "xfs" for block - // device, "9p" for shared filesystem, or "tmpfs" for shared /dev/shm. + // device, or "tmpfs" for shared /dev/shm. string fstype = 4; // Options describes the additional options that might be needed to // mount properly the storage filesystem. From 2bac2013640bb53580c00ff0a01ffe995b033311 Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Wed, 25 Mar 2026 17:20:04 +0800 Subject: [PATCH 4/5] agent: Remove virtio-9p storage handler Remove the Virtio9pHandler implementation and its registration from the storage handler manager: (1) Remove Virtio9pHandler struct and StorageHandler implementation. (2) Remove DRIVER_9P_TYPE and Virtio9pHandler from STORAGE_HANDLERS registration. (3) Update watcher.rs comments to remove 9p references. This completes the removal of virtio-9p support in the agent. Signed-off-by: Alex Lyn --- src/agent/src/storage/fs_handler.rs | 23 +---------------------- src/agent/src/storage/mod.rs | 3 +-- src/agent/src/watcher.rs | 2 +- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/src/agent/src/storage/fs_handler.rs b/src/agent/src/storage/fs_handler.rs index b22770e8a3..2c7c3c1cc9 100644 --- a/src/agent/src/storage/fs_handler.rs +++ b/src/agent/src/storage/fs_handler.rs @@ -10,7 +10,7 @@ use std::sync::Arc; use crate::storage::{common_storage_handler, new_device, StorageContext, StorageHandler}; use anyhow::{anyhow, Context, Result}; -use kata_types::device::{DRIVER_9P_TYPE, DRIVER_OVERLAYFS_TYPE, DRIVER_VIRTIOFS_TYPE}; +use kata_types::device::{DRIVER_OVERLAYFS_TYPE, DRIVER_VIRTIOFS_TYPE}; use kata_types::mount::{StorageDevice, KATA_VOLUME_OVERLAYFS_CREATE_DIR}; use protocols::agent::Storage; use tracing::instrument; @@ -69,27 +69,6 @@ impl StorageHandler for OverlayfsHandler { } } -#[derive(Debug)] -pub struct Virtio9pHandler {} - -#[async_trait::async_trait] -impl StorageHandler for Virtio9pHandler { - #[instrument] - fn driver_types(&self) -> &[&str] { - &[DRIVER_9P_TYPE] - } - - #[instrument] - async fn create_device( - &self, - storage: Storage, - ctx: &mut StorageContext, - ) -> Result> { - let path = common_storage_handler(ctx.logger, &storage)?; - new_device(path) - } -} - #[derive(Debug)] pub struct VirtioFsHandler {} diff --git a/src/agent/src/storage/mod.rs b/src/agent/src/storage/mod.rs index df3821c072..a9920c6d8c 100644 --- a/src/agent/src/storage/mod.rs +++ b/src/agent/src/storage/mod.rs @@ -23,7 +23,7 @@ use tracing::instrument; use self::bind_watcher_handler::BindWatcherHandler; use self::block_handler::{PmemHandler, ScsiHandler, VirtioBlkMmioHandler, VirtioBlkPciHandler}; use self::ephemeral_handler::EphemeralHandler; -use self::fs_handler::{OverlayfsHandler, Virtio9pHandler, VirtioFsHandler}; +use self::fs_handler::{OverlayfsHandler, VirtioFsHandler}; use self::image_pull_handler::ImagePullHandler; use self::local_handler::LocalHandler; use crate::mount::{baremount, is_mounted, remove_mounts}; @@ -134,7 +134,6 @@ lazy_static! { pub static ref STORAGE_HANDLERS: StorageHandlerManager> = { let mut manager: StorageHandlerManager> = StorageHandlerManager::new(); let handlers: Vec> = vec![ - Arc::new(Virtio9pHandler {}), Arc::new(VirtioBlkMmioHandler {}), Arc::new(VirtioBlkPciHandler {}), Arc::new(EphemeralHandler {}), diff --git a/src/agent/src/watcher.rs b/src/agent/src/watcher.rs index e7b4d30d94..dac39d39b4 100644 --- a/src/agent/src/watcher.rs +++ b/src/agent/src/watcher.rs @@ -425,7 +425,7 @@ impl SandboxStorages { /// or updated file to a target mount point, or remove the removed file from the target mount point. All WatchableStorage /// target mount points are expected to reside within a single tmpfs, whose root is created by the BindWatcher. /// -/// This is a temporary workaround to handle config map updates until we get inotify on 9p/virtio-fs. +/// This is a temporary workaround to handle config map updates until we get inotify on virtio-fs. /// More context on this: /// - https://github.com/kata-containers/runtime/issues/1505 /// - https://github.com/kata-containers/kata-containers/issues/1879 From 38382a59c45345bf74f328481e8ed2ca918734f7 Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Wed, 25 Mar 2026 17:33:48 +0800 Subject: [PATCH 5/5] kata-ctl: remove msize_9p from kata-ctl hypervisor info Remove the msize_9p field from HypervisorInfo struct and get_hypervisor_info() function in kata-ctl tool. This aligns with the removal of 9p filesystem support from the configuration and agent. Signed-off-by: Alex Lyn --- src/tools/kata-ctl/src/ops/env_ops.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/tools/kata-ctl/src/ops/env_ops.rs b/src/tools/kata-ctl/src/ops/env_ops.rs index 536d95bf4e..7806521d80 100644 --- a/src/tools/kata-ctl/src/ops/env_ops.rs +++ b/src/tools/kata-ctl/src/ops/env_ops.rs @@ -184,8 +184,6 @@ pub struct HypervisorInfo { #[serde(default)] virtio_fs_daemon: String, #[serde(default)] - msize_9p: u32, - #[serde(default)] memory_slots: u32, #[serde(default)] pcie_root_port: u32, @@ -417,7 +415,6 @@ pub fn get_hypervisor_info( .clone() .unwrap_or_else(|| String::from("none")), virtio_fs_daemon: hypervisor_config.shared_fs.virtio_fs_daemon.to_string(), - msize_9p: hypervisor_config.shared_fs.msize_9p, memory_slots: hypervisor_config.memory_info.memory_slots, pcie_root_port: hypervisor_config.device_info.pcie_root_port, hotplug_vfio_on_rootbus: hypervisor_config.device_info.hotplug_vfio_on_root_bus,