diff --git a/src/agent/src/device/block_device_handler.rs b/src/agent/src/device/block_device_handler.rs index 8ebaa599f7..3d78c84201 100644 --- a/src/agent/src/device/block_device_handler.rs +++ b/src/agent/src/device/block_device_handler.rs @@ -6,8 +6,6 @@ #[cfg(target_arch = "s390x")] use crate::ccw; -#[cfg(target_arch = "s390x")] -use std::str::FromStr; use crate::device::{ pcipath_to_sysfs, DeviceContext, DeviceHandler, DeviceInfo, SpecUpdate, BLOCK, }; @@ -20,6 +18,8 @@ use crate::pci; use crate::sandbox::Sandbox; use crate::uevent::{wait_for_uevent, Uevent, UeventMatcher}; use anyhow::{anyhow, Context, Result}; +#[cfg(target_arch = "s390x")] +use std::str::FromStr; #[cfg(target_arch = "s390x")] use kata_types::device::DRIVER_BLK_CCW_TYPE; diff --git a/src/agent/src/linux_abi.rs b/src/agent/src/linux_abi.rs index 6b99cb5628..cb5c6bc3f0 100644 --- a/src/agent/src/linux_abi.rs +++ b/src/agent/src/linux_abi.rs @@ -38,14 +38,14 @@ pub fn pcipath_from_dev_tree_path(dev_tree_path: &str) -> Result<(&str, pci::Pat } #[cfg(target_arch = "aarch64")] -pub fn create_pci_root_bus_path() -> String { - let ret = String::from("/devices/platform/4010000000.pcie/pci0000:00"); +pub fn create_pci_root_bus_path(root_complex: &str) -> String { + let ret = format!("/devices/platform/4010000000.pcie/pci0000:{root_complex}"); - let acpi_root_bus_path = String::from("/devices/pci0000:00"); + let acpi_root_bus_path = format!("/devices/pci0000:{root_complex}"); let mut acpi_sysfs_dir = String::from(SYSFS_DIR); let mut sysfs_dir = String::from(SYSFS_DIR); let mut start_root_bus_path = String::from("/devices/platform/"); - let end_root_bus_path = String::from("/pci0000:00"); + let end_root_bus_path = format!("/pci0000:{root_complex}"); // check if there is pci bus path for acpi acpi_sysfs_dir.push_str(&acpi_root_bus_path); diff --git a/src/agent/src/storage/block_handler.rs b/src/agent/src/storage/block_handler.rs index ede2be39fc..13a1830e4b 100644 --- a/src/agent/src/storage/block_handler.rs +++ b/src/agent/src/storage/block_handler.rs @@ -23,8 +23,6 @@ use tracing::instrument; #[cfg(target_arch = "s390x")] use crate::ccw; #[cfg(target_arch = "s390x")] -use std::str::FromStr; -#[cfg(target_arch = "s390x")] use crate::device::block_device_handler::get_virtio_blk_ccw_device_name; use crate::device::block_device_handler::{ get_virtio_blk_mmio_device_name, get_virtio_blk_pci_device_name, @@ -32,6 +30,8 @@ use crate::device::block_device_handler::{ use crate::device::nvdimm_device_handler::wait_for_pmem_device; use crate::device::scsi_device_handler::get_scsi_device_name; use crate::storage::{common_storage_handler, new_device, StorageContext, StorageHandler}; +#[cfg(target_arch = "s390x")] +use std::str::FromStr; #[derive(Debug)] pub struct VirtioBlkMmioHandler {}