mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 21:21:32 +00:00
chore(xen): move device creation into transaction interface (#196)
* chore(xen): move domain creation to xenplatform * chore(xen): move device transactions into separate interface
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
use std::{env, process};
|
||||
use tokio::fs;
|
||||
use uuid::Uuid;
|
||||
use xenclient::error::Result;
|
||||
use xenclient::{DomainConfig, XenClient};
|
||||
use xenplatform::domain::BaseDomainConfig;
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
type RuntimePlatform = xenplatform::x86pv::X86PvPlatform;
|
||||
@ -22,13 +24,18 @@ async fn main() -> Result<()> {
|
||||
let initrd_path = args.get(2).expect("argument not specified");
|
||||
let client = XenClient::new(0, RuntimePlatform::new()).await?;
|
||||
let config = DomainConfig {
|
||||
base: BaseDomainConfig {
|
||||
uuid: Uuid::new_v4(),
|
||||
max_vcpus: 1,
|
||||
mem_mb: 512,
|
||||
enable_iommu: true,
|
||||
kernel: fs::read(&kernel_image_path).await?,
|
||||
initrd: fs::read(&initrd_path).await?,
|
||||
cmdline: "earlyprintk=xen earlycon=xen console=hvc0 init=/init".to_string(),
|
||||
owner_domid: 0,
|
||||
},
|
||||
backend_domid: 0,
|
||||
name: "xenclient-test".to_string(),
|
||||
max_vcpus: 1,
|
||||
mem_mb: 512,
|
||||
kernel: fs::read(&kernel_image_path).await?,
|
||||
initrd: fs::read(&initrd_path).await?,
|
||||
cmdline: "earlyprintk=xen earlycon=xen console=hvc0 init=/init".to_string(),
|
||||
swap_console_backend: None,
|
||||
disks: vec![],
|
||||
channels: vec![],
|
||||
@ -37,7 +44,6 @@ async fn main() -> Result<()> {
|
||||
filesystems: vec![],
|
||||
extra_keys: vec![],
|
||||
extra_rw_paths: vec![],
|
||||
event_channels: vec![],
|
||||
};
|
||||
let created = client.create(&config).await?;
|
||||
println!("created domain {}", created.domid);
|
||||
|
Reference in New Issue
Block a user