mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-27 12:08:58 +00:00
runtime-rs: Drop s390x target predicates
Drop `target_arch = "s390x"` all over `runtime-rs`, it is strange to have such predicates on features and code while we do not support it. Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
This commit is contained in:
parent
65021caca6
commit
6f894450fe
@ -50,7 +50,6 @@ qapi = { version = "0.14", features = ["qmp", "async-tokio-all"] }
|
|||||||
qapi-spec = "0.3.1"
|
qapi-spec = "0.3.1"
|
||||||
qapi-qmp = "0.14.0"
|
qapi-qmp = "0.14.0"
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "s390x"))'.dependencies]
|
|
||||||
dragonball = { path = "../../../dragonball", features = [
|
dragonball = { path = "../../../dragonball", features = [
|
||||||
"atomic-guest-memory",
|
"atomic-guest-memory",
|
||||||
"virtio-vsock",
|
"virtio-vsock",
|
||||||
|
@ -118,7 +118,6 @@ impl KernelParams {
|
|||||||
self.params.append(&mut params.params);
|
self.params.append(&mut params.params);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
pub(crate) fn push(&mut self, new_param: Param) {
|
pub(crate) fn push(&mut self, new_param: Param) {
|
||||||
self.params.push(new_param);
|
self.params.push(new_param);
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,8 @@ pub mod device;
|
|||||||
pub mod hypervisor_persist;
|
pub mod hypervisor_persist;
|
||||||
pub use device::driver::*;
|
pub use device::driver::*;
|
||||||
use device::DeviceType;
|
use device::DeviceType;
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
pub mod dragonball;
|
pub mod dragonball;
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
pub mod firecracker;
|
pub mod firecracker;
|
||||||
mod kernel_param;
|
mod kernel_param;
|
||||||
pub mod qemu;
|
pub mod qemu;
|
||||||
@ -24,7 +23,7 @@ pub use kernel_param::Param;
|
|||||||
pub mod utils;
|
pub mod utils;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
#[cfg(feature = "cloud-hypervisor")]
|
||||||
pub mod ch;
|
pub mod ch;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
@ -55,13 +54,13 @@ const VM_ROOTFS_FILESYSTEM_EROFS: &str = "erofs";
|
|||||||
// mkdir -p /dev/hugepages
|
// mkdir -p /dev/hugepages
|
||||||
// mount -t hugetlbfs none /dev/hugepages
|
// mount -t hugetlbfs none /dev/hugepages
|
||||||
pub const HUGETLBFS: &str = "hugetlbfs";
|
pub const HUGETLBFS: &str = "hugetlbfs";
|
||||||
// Constants required for Dragonball VMM when enabled and not on s390x.
|
// Constants required for Dragonball VMM when enabled
|
||||||
// Not needed when the built-in VMM is not used.
|
// Not needed when the built-in VMM is not used.
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
const DEV_HUGEPAGES: &str = "/dev/hugepages";
|
const DEV_HUGEPAGES: &str = "/dev/hugepages";
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
const SHMEM: &str = "shmem";
|
const SHMEM: &str = "shmem";
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
const HUGE_SHMEM: &str = "hugeshmem";
|
const HUGE_SHMEM: &str = "hugeshmem";
|
||||||
|
|
||||||
pub const HYPERVISOR_DRAGONBALL: &str = "dragonball";
|
pub const HYPERVISOR_DRAGONBALL: &str = "dragonball";
|
||||||
@ -72,7 +71,6 @@ pub const HYPERVISOR_REMOTE: &str = "remote";
|
|||||||
pub const DEFAULT_HYBRID_VSOCK_NAME: &str = "kata.hvsock";
|
pub const DEFAULT_HYBRID_VSOCK_NAME: &str = "kata.hvsock";
|
||||||
pub const JAILER_ROOT: &str = "root";
|
pub const JAILER_ROOT: &str = "root";
|
||||||
|
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
#[derive(PartialEq, Debug, Clone)]
|
#[derive(PartialEq, Debug, Clone)]
|
||||||
pub(crate) enum VmmState {
|
pub(crate) enum VmmState {
|
||||||
NotReady,
|
NotReady,
|
||||||
|
@ -21,22 +21,20 @@ use anyhow::{anyhow, Context, Result};
|
|||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use common::{message::Message, types::SandboxConfig, RuntimeHandler, RuntimeInstance};
|
use common::{message::Message, types::SandboxConfig, RuntimeHandler, RuntimeInstance};
|
||||||
use hypervisor::Hypervisor;
|
use hypervisor::Hypervisor;
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
use hypervisor::{dragonball::Dragonball, HYPERVISOR_DRAGONBALL};
|
use hypervisor::{dragonball::Dragonball, HYPERVISOR_DRAGONBALL};
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
use hypervisor::{firecracker::Firecracker, HYPERVISOR_FIRECRACKER};
|
use hypervisor::{firecracker::Firecracker, HYPERVISOR_FIRECRACKER};
|
||||||
use hypervisor::{qemu::Qemu, HYPERVISOR_QEMU};
|
use hypervisor::{qemu::Qemu, HYPERVISOR_QEMU};
|
||||||
use hypervisor::{remote::Remote, HYPERVISOR_REMOTE};
|
use hypervisor::{remote::Remote, HYPERVISOR_REMOTE};
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
use kata_types::config::DragonballConfig;
|
use kata_types::config::DragonballConfig;
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
use kata_types::config::FirecrackerConfig;
|
use kata_types::config::FirecrackerConfig;
|
||||||
use kata_types::config::RemoteConfig;
|
use kata_types::config::RemoteConfig;
|
||||||
use kata_types::config::{hypervisor::register_hypervisor_plugin, QemuConfig, TomlConfig};
|
use kata_types::config::{hypervisor::register_hypervisor_plugin, QemuConfig, TomlConfig};
|
||||||
|
|
||||||
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
#[cfg(feature = "cloud-hypervisor")]
|
||||||
use hypervisor::ch::CloudHypervisor;
|
use hypervisor::ch::CloudHypervisor;
|
||||||
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
#[cfg(feature = "cloud-hypervisor")]
|
||||||
use kata_types::config::{hypervisor::HYPERVISOR_NAME_CH, CloudHypervisorConfig};
|
use kata_types::config::{hypervisor::HYPERVISOR_NAME_CH, CloudHypervisorConfig};
|
||||||
|
|
||||||
use resource::cpu_mem::initial_size::InitialSizeManager;
|
use resource::cpu_mem::initial_size::InitialSizeManager;
|
||||||
@ -57,21 +55,18 @@ impl RuntimeHandler for VirtContainer {
|
|||||||
logging::register_subsystem_logger("runtimes", "virt-container");
|
logging::register_subsystem_logger("runtimes", "virt-container");
|
||||||
|
|
||||||
// register
|
// register
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
#[cfg(feature = "dragonball")]
|
||||||
{
|
let dragonball_config = Arc::new(DragonballConfig::new());
|
||||||
#[cfg(feature = "dragonball")]
|
#[cfg(feature = "dragonball")]
|
||||||
let dragonball_config = Arc::new(DragonballConfig::new());
|
register_hypervisor_plugin("dragonball", dragonball_config);
|
||||||
#[cfg(feature = "dragonball")]
|
|
||||||
register_hypervisor_plugin("dragonball", dragonball_config);
|
|
||||||
|
|
||||||
let firecracker_config = Arc::new(FirecrackerConfig::new());
|
let firecracker_config = Arc::new(FirecrackerConfig::new());
|
||||||
register_hypervisor_plugin("firecracker", firecracker_config);
|
register_hypervisor_plugin("firecracker", firecracker_config);
|
||||||
}
|
|
||||||
|
|
||||||
let qemu_config = Arc::new(QemuConfig::new());
|
let qemu_config = Arc::new(QemuConfig::new());
|
||||||
register_hypervisor_plugin("qemu", qemu_config);
|
register_hypervisor_plugin("qemu", qemu_config);
|
||||||
|
|
||||||
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
#[cfg(feature = "cloud-hypervisor")]
|
||||||
{
|
{
|
||||||
let ch_config = Arc::new(CloudHypervisorConfig::new());
|
let ch_config = Arc::new(CloudHypervisorConfig::new());
|
||||||
register_hypervisor_plugin(HYPERVISOR_NAME_CH, ch_config);
|
register_hypervisor_plugin(HYPERVISOR_NAME_CH, ch_config);
|
||||||
@ -156,7 +151,7 @@ async fn new_hypervisor(toml_config: &TomlConfig) -> Result<Arc<dyn Hypervisor>>
|
|||||||
// TODO: support other hypervisor
|
// TODO: support other hypervisor
|
||||||
// issue: https://github.com/kata-containers/kata-containers/issues/4634
|
// issue: https://github.com/kata-containers/kata-containers/issues/4634
|
||||||
match hypervisor_name.as_str() {
|
match hypervisor_name.as_str() {
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
HYPERVISOR_DRAGONBALL => {
|
HYPERVISOR_DRAGONBALL => {
|
||||||
let hypervisor = Dragonball::new();
|
let hypervisor = Dragonball::new();
|
||||||
hypervisor
|
hypervisor
|
||||||
@ -176,7 +171,6 @@ async fn new_hypervisor(toml_config: &TomlConfig) -> Result<Arc<dyn Hypervisor>>
|
|||||||
.await;
|
.await;
|
||||||
Ok(Arc::new(hypervisor))
|
Ok(Arc::new(hypervisor))
|
||||||
}
|
}
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
HYPERVISOR_FIRECRACKER => {
|
HYPERVISOR_FIRECRACKER => {
|
||||||
let hypervisor = Firecracker::new();
|
let hypervisor = Firecracker::new();
|
||||||
hypervisor
|
hypervisor
|
||||||
@ -184,7 +178,7 @@ async fn new_hypervisor(toml_config: &TomlConfig) -> Result<Arc<dyn Hypervisor>>
|
|||||||
.await;
|
.await;
|
||||||
Ok(Arc::new(hypervisor))
|
Ok(Arc::new(hypervisor))
|
||||||
}
|
}
|
||||||
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
#[cfg(feature = "cloud-hypervisor")]
|
||||||
HYPERVISOR_NAME_CH => {
|
HYPERVISOR_NAME_CH => {
|
||||||
let hypervisor = CloudHypervisor::new();
|
let hypervisor = CloudHypervisor::new();
|
||||||
hypervisor
|
hypervisor
|
||||||
|
@ -21,10 +21,9 @@ use common::{
|
|||||||
|
|
||||||
use containerd_shim_protos::events::task::{TaskExit, TaskOOM};
|
use containerd_shim_protos::events::task::{TaskExit, TaskOOM};
|
||||||
use hypervisor::VsockConfig;
|
use hypervisor::VsockConfig;
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
use hypervisor::HYPERVISOR_FIRECRACKER;
|
use hypervisor::HYPERVISOR_FIRECRACKER;
|
||||||
use hypervisor::HYPERVISOR_REMOTE;
|
use hypervisor::HYPERVISOR_REMOTE;
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
use hypervisor::{dragonball::Dragonball, HYPERVISOR_DRAGONBALL};
|
use hypervisor::{dragonball::Dragonball, HYPERVISOR_DRAGONBALL};
|
||||||
use hypervisor::{qemu::Qemu, HYPERVISOR_QEMU};
|
use hypervisor::{qemu::Qemu, HYPERVISOR_QEMU};
|
||||||
use hypervisor::{utils::get_hvsock_path, HybridVsockConfig, DEFAULT_GUEST_VSOCK_CID};
|
use hypervisor::{utils::get_hvsock_path, HybridVsockConfig, DEFAULT_GUEST_VSOCK_CID};
|
||||||
@ -34,7 +33,6 @@ use kata_sys_util::hooks::HookStates;
|
|||||||
use kata_sys_util::protection::{available_guest_protection, GuestProtection};
|
use kata_sys_util::protection::{available_guest_protection, GuestProtection};
|
||||||
use kata_types::capabilities::CapabilityBits;
|
use kata_types::capabilities::CapabilityBits;
|
||||||
use kata_types::config::hypervisor::Hypervisor as HypervisorConfig;
|
use kata_types::config::hypervisor::Hypervisor as HypervisorConfig;
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
use kata_types::config::hypervisor::HYPERVISOR_NAME_CH;
|
use kata_types::config::hypervisor::HYPERVISOR_NAME_CH;
|
||||||
use kata_types::config::TomlConfig;
|
use kata_types::config::TomlConfig;
|
||||||
use oci_spec::runtime as oci;
|
use oci_spec::runtime as oci;
|
||||||
@ -743,11 +741,9 @@ impl Persist for VirtSandbox {
|
|||||||
resource: Some(self.resource_manager.save().await?),
|
resource: Some(self.resource_manager.save().await?),
|
||||||
hypervisor: match hypervisor_state.hypervisor_type.as_str() {
|
hypervisor: match hypervisor_state.hypervisor_type.as_str() {
|
||||||
// TODO support other hypervisors
|
// TODO support other hypervisors
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
HYPERVISOR_DRAGONBALL => Ok(Some(hypervisor_state)),
|
HYPERVISOR_DRAGONBALL => Ok(Some(hypervisor_state)),
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
HYPERVISOR_NAME_CH => Ok(Some(hypervisor_state)),
|
HYPERVISOR_NAME_CH => Ok(Some(hypervisor_state)),
|
||||||
#[cfg(not(target_arch = "s390x"))]
|
|
||||||
HYPERVISOR_FIRECRACKER => Ok(Some(hypervisor_state)),
|
HYPERVISOR_FIRECRACKER => Ok(Some(hypervisor_state)),
|
||||||
HYPERVISOR_QEMU => Ok(Some(hypervisor_state)),
|
HYPERVISOR_QEMU => Ok(Some(hypervisor_state)),
|
||||||
HYPERVISOR_REMOTE => Ok(Some(hypervisor_state)),
|
HYPERVISOR_REMOTE => Ok(Some(hypervisor_state)),
|
||||||
@ -783,7 +779,7 @@ impl Persist for VirtSandbox {
|
|||||||
let h = sandbox_state.hypervisor.unwrap_or_default();
|
let h = sandbox_state.hypervisor.unwrap_or_default();
|
||||||
let hypervisor = match h.hypervisor_type.as_str() {
|
let hypervisor = match h.hypervisor_type.as_str() {
|
||||||
// TODO support other hypervisors
|
// TODO support other hypervisors
|
||||||
#[cfg(all(feature = "dragonball", not(target_arch = "s390x")))]
|
#[cfg(feature = "dragonball")]
|
||||||
HYPERVISOR_DRAGONBALL => {
|
HYPERVISOR_DRAGONBALL => {
|
||||||
let hypervisor = Arc::new(Dragonball::restore((), h).await?) as Arc<dyn Hypervisor>;
|
let hypervisor = Arc::new(Dragonball::restore((), h).await?) as Arc<dyn Hypervisor>;
|
||||||
Ok(hypervisor)
|
Ok(hypervisor)
|
||||||
|
Loading…
Reference in New Issue
Block a user