mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-16 06:18:58 +00:00
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 <scrisis843@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user