mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-02 12:50:54 +00:00
fix(xenclient): examples should use supported platform
This commit is contained in:
parent
4b0f3782bd
commit
e0bbeb5d64
@ -24,15 +24,10 @@ async fn main() -> Result<()> {
|
||||
let initrd_path = args.get(2).expect("argument not specified");
|
||||
let client = XenClient::new().await?;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
let runtime_platform = RuntimePlatformType::Pv;
|
||||
#[cfg(not(target_arch = "x86_64"))]
|
||||
let runtime_platform = RuntimePlatformType::Unsupported;
|
||||
|
||||
let mut config = DomainConfig::new();
|
||||
config.platform(PlatformDomainConfig {
|
||||
uuid: Uuid::new_v4(),
|
||||
platform: runtime_platform,
|
||||
platform: RuntimePlatformType::supported(),
|
||||
kernel: PlatformKernelConfig {
|
||||
data: Arc::new(fs::read(&kernel_image_path).await?),
|
||||
format: KernelFormat::ElfCompressed,
|
||||
|
@ -42,7 +42,7 @@ async fn create_domain(client: &XenClient, kernel: Arc<Vec<u8>>, i: u32) -> Resu
|
||||
let mut config = DomainConfig::new();
|
||||
config.platform(PlatformDomainConfig {
|
||||
uuid: Uuid::new_v4(),
|
||||
platform: RuntimePlatformType::Pv,
|
||||
platform: RuntimePlatformType::supported(),
|
||||
kernel: PlatformKernelConfig {
|
||||
data: kernel,
|
||||
format: KernelFormat::ElfUncompressed,
|
||||
|
@ -54,6 +54,14 @@ impl RuntimePlatformType {
|
||||
RuntimePlatformType::Pv => RuntimePlatform::Pv(x86pv::X86PvPlatform::new()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn supported() -> RuntimePlatformType {
|
||||
if cfg!(target_arch = "x86_64") {
|
||||
RuntimePlatformType::Pv
|
||||
} else {
|
||||
RuntimePlatformType::Unsupported
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
|
Loading…
Reference in New Issue
Block a user