diff --git a/src/runtime-rs/crates/hypervisor/src/lib.rs b/src/runtime-rs/crates/hypervisor/src/lib.rs index a28d0a608..6185fa802 100644 --- a/src/runtime-rs/crates/hypervisor/src/lib.rs +++ b/src/runtime-rs/crates/hypervisor/src/lib.rs @@ -23,7 +23,10 @@ pub use kernel_param::Param; pub mod utils; use std::collections::HashMap; -#[cfg(feature = "cloud-hypervisor")] +#[cfg(all( + feature = "cloud-hypervisor", + any(target_arch = "x86_64", target_arch = "aarch64") +))] pub mod ch; use anyhow::Result; diff --git a/src/runtime-rs/crates/runtimes/virt_container/src/lib.rs b/src/runtime-rs/crates/runtimes/virt_container/src/lib.rs index 1654cfde7..20ab06960 100644 --- a/src/runtime-rs/crates/runtimes/virt_container/src/lib.rs +++ b/src/runtime-rs/crates/runtimes/virt_container/src/lib.rs @@ -32,9 +32,15 @@ use kata_types::config::FirecrackerConfig; use kata_types::config::RemoteConfig; use kata_types::config::{hypervisor::register_hypervisor_plugin, QemuConfig, TomlConfig}; -#[cfg(feature = "cloud-hypervisor")] +#[cfg(all( + feature = "cloud-hypervisor", + any(target_arch = "x86_64", target_arch = "aarch64") +))] use hypervisor::ch::CloudHypervisor; -#[cfg(feature = "cloud-hypervisor")] +#[cfg(all( + feature = "cloud-hypervisor", + any(target_arch = "x86_64", target_arch = "aarch64") +))] use kata_types::config::{hypervisor::HYPERVISOR_NAME_CH, CloudHypervisorConfig}; use resource::cpu_mem::initial_size::InitialSizeManager; @@ -66,7 +72,10 @@ impl RuntimeHandler for VirtContainer { let qemu_config = Arc::new(QemuConfig::new()); register_hypervisor_plugin("qemu", qemu_config); - #[cfg(feature = "cloud-hypervisor")] + #[cfg(all( + feature = "cloud-hypervisor", + any(target_arch = "x86_64", target_arch = "aarch64") + ))] { let ch_config = Arc::new(CloudHypervisorConfig::new()); register_hypervisor_plugin(HYPERVISOR_NAME_CH, ch_config); @@ -178,7 +187,10 @@ async fn new_hypervisor(toml_config: &TomlConfig) -> Result> .await; Ok(Arc::new(hypervisor)) } - #[cfg(feature = "cloud-hypervisor")] + #[cfg(all( + feature = "cloud-hypervisor", + any(target_arch = "x86_64", target_arch = "aarch64") + ))] HYPERVISOR_NAME_CH => { let hypervisor = CloudHypervisor::new(); hypervisor