From 617af4cb3b5012440c0232ad60ab16f5f94cdc29 Mon Sep 17 00:00:00 2001 From: Caspian443 Date: Tue, 26 Aug 2025 01:27:21 +0000 Subject: [PATCH] runtime-rs: Empty block-rootfs Storage.options and align with Go runtime - Set guest Storage.options for block rootfs to empty (do not propagate host mount options). - Align behavior with Go runtime: only add xfs nouuid when needed. Signed-off-by: Caspian443 --- .../crates/resource/src/rootfs/block_rootfs.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/runtime-rs/crates/resource/src/rootfs/block_rootfs.rs b/src/runtime-rs/crates/resource/src/rootfs/block_rootfs.rs index 905b064611..55cbe78d9a 100644 --- a/src/runtime-rs/crates/resource/src/rootfs/block_rootfs.rs +++ b/src/runtime-rs/crates/resource/src/rootfs/block_rootfs.rs @@ -19,6 +19,7 @@ use hypervisor::{ use kata_types::config::hypervisor::{ VIRTIO_BLK_CCW, VIRTIO_BLK_MMIO, VIRTIO_BLK_PCI, VIRTIO_PMEM, VIRTIO_SCSI, }; +use kata_types::fs::VM_ROOTFS_FILESYSTEM_XFS; use kata_types::mount::Mount; use nix::sys::stat::{self, SFlag}; use oci_spec::runtime as oci; @@ -67,10 +68,17 @@ impl BlockRootfs { let mut storage = Storage { fs_type: rootfs.fs_type.clone(), mount_point: container_path.clone(), - options: rootfs.options.clone(), + options: vec![], ..Default::default() }; + // XFS rootfs: add 'nouuid' to avoid UUID conflicts when the same + // disk image is mounted across multiple VMs/containers. + // This allows mounting XFS volumes that share the same UUID. + if rootfs.fs_type == VM_ROOTFS_FILESYSTEM_XFS { + storage.options.push("nouuid".to_string()); + } + let mut device_id: String = "".to_owned(); if let DeviceType::Block(device) = device_info { storage.driver = device.config.driver_option;