mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 14:43:51 +00:00
runtime-rs: Use Persist::restore() of QEMU for VirtSandbox
It fails to compile virt_container because Dragonball is only used in the implementation of the trait method Persist::restore(). As the hypervisor is not compiled on s390x and QEMU implements the trait method, this commit is to let the method use QEMUi's. Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
This commit is contained in:
parent
56aef3741d
commit
8fcee6e6ec
@ -17,10 +17,11 @@ use common::message::{Action, Message};
|
||||
use common::{Sandbox, SandboxNetworkEnv};
|
||||
use containerd_shim_protos::events::task::TaskOOM;
|
||||
use hypervisor::VsockConfig;
|
||||
use hypervisor::{BlockConfig, Hypervisor};
|
||||
#[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::{BlockConfig, Hypervisor};
|
||||
use kata_sys_util::hooks::HookStates;
|
||||
use kata_types::capabilities::CapabilityBits;
|
||||
use kata_types::config::TomlConfig;
|
||||
@ -588,7 +589,14 @@ impl Persist for VirtSandbox {
|
||||
let hypervisor = match h.hypervisor_type.as_str() {
|
||||
// TODO support other hypervisors
|
||||
#[cfg(not(target_arch = "s390x"))]
|
||||
HYPERVISOR_DRAGONBALL => Ok(Arc::new(Dragonball::restore((), h).await?)),
|
||||
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)),
|
||||
}?;
|
||||
let agent = Arc::new(KataAgent::new(kata_types::config::Agent::default()));
|
||||
|
Loading…
Reference in New Issue
Block a user