mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-10 12:22:36 +00:00
Merge pull request #8454 from BbolroC/compile-with-qemu-s390x
runtime-rs: make compilation for QEMU on s390x
This commit is contained in:
commit
d1a26ead94
@ -26,15 +26,11 @@ ARCH_FILE_SUFFIX = -options.mk
|
|||||||
ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
|
ARCH_FILE = $(ARCH_DIR)/$(ARCH)$(ARCH_FILE_SUFFIX)
|
||||||
|
|
||||||
ifeq ($(ARCH), s390x)
|
ifeq ($(ARCH), s390x)
|
||||||
default:
|
default: runtime show-header
|
||||||
@echo "s390x is not currently supported"
|
|
||||||
exit 0
|
|
||||||
test:
|
test:
|
||||||
@echo "s390x is not currently supported"
|
@echo "s390x is not currently supported"
|
||||||
exit 0
|
exit 0
|
||||||
install:
|
install: install-runtime install-configs
|
||||||
@echo "s390x is not currently supported"
|
|
||||||
exit 0
|
|
||||||
else ifeq ($(ARCH), powerpc64le)
|
else ifeq ($(ARCH), powerpc64le)
|
||||||
default:
|
default:
|
||||||
@echo "PowerPC 64 LE is not currently supported"
|
@echo "PowerPC 64 LE is not currently supported"
|
||||||
|
@ -11,7 +11,6 @@ license = "Apache-2.0"
|
|||||||
actix-rt = "2.7.0"
|
actix-rt = "2.7.0"
|
||||||
anyhow = "^1.0"
|
anyhow = "^1.0"
|
||||||
async-trait = "0.1.48"
|
async-trait = "0.1.48"
|
||||||
dbs-utils = { path = "../../../dragonball/src/dbs_utils" }
|
|
||||||
go-flag = "0.1.0"
|
go-flag = "0.1.0"
|
||||||
libc = ">=0.2.39"
|
libc = ">=0.2.39"
|
||||||
nix = "0.24.2"
|
nix = "0.24.2"
|
||||||
@ -35,8 +34,6 @@ kata-types = { path = "../../../libs/kata-types" }
|
|||||||
logging = { path = "../../../libs/logging" }
|
logging = { path = "../../../libs/logging" }
|
||||||
shim-interface = { path = "../../../libs/shim-interface" }
|
shim-interface = { path = "../../../libs/shim-interface" }
|
||||||
|
|
||||||
dragonball = { path = "../../../dragonball", features = ["atomic-guest-memory", "virtio-vsock", "hotplug", "virtio-blk", "virtio-net", "virtio-fs", "vhost-net", "dbs-upcall", "virtio-mem", "virtio-balloon", "vhost-user-net", "host-device"] }
|
|
||||||
|
|
||||||
ch-config = { path = "ch-config", optional = true }
|
ch-config = { path = "ch-config", optional = true }
|
||||||
tests_utils = { path = "../../tests/utils" }
|
tests_utils = { path = "../../tests/utils" }
|
||||||
|
|
||||||
@ -44,6 +41,10 @@ futures = "0.3.25"
|
|||||||
safe-path = "0.1.0"
|
safe-path = "0.1.0"
|
||||||
crossbeam-channel = "0.5.6"
|
crossbeam-channel = "0.5.6"
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "s390x"))'.dependencies]
|
||||||
|
dragonball = { path = "../../../dragonball", features = ["atomic-guest-memory", "virtio-vsock", "hotplug", "virtio-blk", "virtio-net", "virtio-fs", "vhost-net", "dbs-upcall", "virtio-mem", "virtio-balloon", "vhost-user-net", "host-device"] }
|
||||||
|
dbs-utils = { path = "../../../dragonball/src/dbs_utils" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ 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(not(target_arch = "s390x"))]
|
||||||
pub mod dragonball;
|
pub mod dragonball;
|
||||||
mod kernel_param;
|
mod kernel_param;
|
||||||
pub mod qemu;
|
pub mod qemu;
|
||||||
@ -20,7 +21,7 @@ pub use kernel_param::Param;
|
|||||||
pub mod utils;
|
pub mod utils;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
#[cfg(feature = "cloud-hypervisor")]
|
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
||||||
pub mod ch;
|
pub mod ch;
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
@ -49,9 +50,12 @@ const VM_ROOTFS_FILESYSTEM_EROFS: &str = "erofs";
|
|||||||
// /dev/hugepages will be the mount point
|
// /dev/hugepages will be the mount point
|
||||||
// mkdir -p /dev/hugepages
|
// mkdir -p /dev/hugepages
|
||||||
// mount -t hugetlbfs none /dev/hugepages
|
// mount -t hugetlbfs none /dev/hugepages
|
||||||
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
const DEV_HUGEPAGES: &str = "/dev/hugepages";
|
const DEV_HUGEPAGES: &str = "/dev/hugepages";
|
||||||
pub const HUGETLBFS: &str = "hugetlbfs";
|
pub const HUGETLBFS: &str = "hugetlbfs";
|
||||||
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
const SHMEM: &str = "shmem";
|
const SHMEM: &str = "shmem";
|
||||||
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
const HUGE_SHMEM: &str = "hugeshmem";
|
const HUGE_SHMEM: &str = "hugeshmem";
|
||||||
|
|
||||||
pub const HYPERVISOR_DRAGONBALL: &str = "dragonball";
|
pub const HYPERVISOR_DRAGONBALL: &str = "dragonball";
|
||||||
@ -60,6 +64,7 @@ pub const HYPERVISOR_QEMU: &str = "qemu";
|
|||||||
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,
|
||||||
|
@ -20,15 +20,17 @@ use agent::{kata::KataAgent, AGENT_KATA};
|
|||||||
use anyhow::{anyhow, Context, Result};
|
use anyhow::{anyhow, Context, Result};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use common::{message::Message, RuntimeHandler, RuntimeInstance};
|
use common::{message::Message, RuntimeHandler, RuntimeInstance};
|
||||||
use hypervisor::{dragonball::Dragonball, Hypervisor, HYPERVISOR_DRAGONBALL};
|
use hypervisor::Hypervisor;
|
||||||
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
|
use hypervisor::{dragonball::Dragonball, HYPERVISOR_DRAGONBALL};
|
||||||
use hypervisor::{qemu::Qemu, HYPERVISOR_QEMU};
|
use hypervisor::{qemu::Qemu, HYPERVISOR_QEMU};
|
||||||
use kata_types::config::{
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
hypervisor::register_hypervisor_plugin, DragonballConfig, QemuConfig, TomlConfig,
|
use kata_types::config::DragonballConfig;
|
||||||
};
|
use kata_types::config::{hypervisor::register_hypervisor_plugin, QemuConfig, TomlConfig};
|
||||||
|
|
||||||
#[cfg(feature = "cloud-hypervisor")]
|
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
||||||
use hypervisor::ch::CloudHypervisor;
|
use hypervisor::ch::CloudHypervisor;
|
||||||
#[cfg(feature = "cloud-hypervisor")]
|
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
||||||
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;
|
||||||
@ -49,13 +51,16 @@ impl RuntimeHandler for VirtContainer {
|
|||||||
logging::register_subsystem_logger("runtimes", "virt-container");
|
logging::register_subsystem_logger("runtimes", "virt-container");
|
||||||
|
|
||||||
// register
|
// register
|
||||||
let dragonball_config = Arc::new(DragonballConfig::new());
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
register_hypervisor_plugin("dragonball", dragonball_config);
|
{
|
||||||
|
let dragonball_config = Arc::new(DragonballConfig::new());
|
||||||
|
register_hypervisor_plugin("dragonball", dragonball_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(feature = "cloud-hypervisor")]
|
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
||||||
{
|
{
|
||||||
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);
|
||||||
@ -135,6 +140,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(not(target_arch = "s390x"))]
|
||||||
HYPERVISOR_DRAGONBALL => {
|
HYPERVISOR_DRAGONBALL => {
|
||||||
let mut hypervisor = Dragonball::new();
|
let mut hypervisor = Dragonball::new();
|
||||||
hypervisor
|
hypervisor
|
||||||
@ -155,7 +161,7 @@ async fn new_hypervisor(toml_config: &TomlConfig) -> Result<Arc<dyn Hypervisor>>
|
|||||||
Ok(Arc::new(hypervisor))
|
Ok(Arc::new(hypervisor))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "cloud-hypervisor")]
|
#[cfg(all(feature = "cloud-hypervisor", not(target_arch = "s390x")))]
|
||||||
HYPERVISOR_NAME_CH => {
|
HYPERVISOR_NAME_CH => {
|
||||||
let mut hypervisor = CloudHypervisor::new();
|
let mut hypervisor = CloudHypervisor::new();
|
||||||
|
|
||||||
|
@ -17,8 +17,11 @@ use common::message::{Action, Message};
|
|||||||
use common::{Sandbox, SandboxNetworkEnv};
|
use common::{Sandbox, SandboxNetworkEnv};
|
||||||
use containerd_shim_protos::events::task::TaskOOM;
|
use containerd_shim_protos::events::task::TaskOOM;
|
||||||
use hypervisor::VsockConfig;
|
use hypervisor::VsockConfig;
|
||||||
use hypervisor::{dragonball::Dragonball, BlockConfig, Hypervisor, HYPERVISOR_DRAGONBALL};
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
|
use hypervisor::{dragonball::Dragonball, HYPERVISOR_DRAGONBALL};
|
||||||
|
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};
|
||||||
|
use hypervisor::{BlockConfig, Hypervisor};
|
||||||
use kata_sys_util::hooks::HookStates;
|
use kata_sys_util::hooks::HookStates;
|
||||||
use kata_types::capabilities::CapabilityBits;
|
use kata_types::capabilities::CapabilityBits;
|
||||||
use kata_types::config::TomlConfig;
|
use kata_types::config::TomlConfig;
|
||||||
@ -585,7 +588,15 @@ 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
|
||||||
HYPERVISOR_DRAGONBALL => Ok(Arc::new(Dragonball::restore((), h).await?)),
|
#[cfg(not(target_arch = "s390x"))]
|
||||||
|
HYPERVISOR_DRAGONBALL => {
|
||||||
|
let hypervisor = Arc::new(Dragonball::restore((), h).await?) as Arc<dyn Hypervisor>;
|
||||||
|
Ok(hypervisor)
|
||||||
|
}
|
||||||
|
HYPERVISOR_QEMU => {
|
||||||
|
let hypervisor = Arc::new(Qemu::restore((), h).await?) as Arc<dyn Hypervisor>;
|
||||||
|
Ok(hypervisor)
|
||||||
|
}
|
||||||
_ => Err(anyhow!("Unsupported hypervisor {}", &h.hypervisor_type)),
|
_ => Err(anyhow!("Unsupported hypervisor {}", &h.hypervisor_type)),
|
||||||
}?;
|
}?;
|
||||||
let agent = Arc::new(KataAgent::new(kata_types::config::Agent::default()));
|
let agent = Arc::new(KataAgent::new(kata_types::config::Agent::default()));
|
||||||
|
Loading…
Reference in New Issue
Block a user