mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 19:16:23 +00:00
runtime-rs: Restrict cloud-hypervisor feature
Cloud-Hypervisor currently only supports `x86_64` and `aarch64`, this features should not be avaiable even if other architectures explicitly requires it. Restrict `cloud-hypervisor` feature to only `x86_64` and `aarch64`. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
6f894450fe
commit
ed6f57f8f6
@ -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;
|
||||
|
@ -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<Arc<dyn Hypervisor>>
|
||||
.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
|
||||
|
Loading…
Reference in New Issue
Block a user