2024-01-10 10:08:39 -08:00
|
|
|
use std::{env, process};
|
2024-01-17 05:22:47 -08:00
|
|
|
use xenclient::create::DomainConfig;
|
|
|
|
use xenclient::{XenClient, XenClientError};
|
2024-01-09 22:39:32 -08:00
|
|
|
|
|
|
|
fn main() -> Result<(), XenClientError> {
|
2024-01-11 12:21:33 -08:00
|
|
|
env_logger::init();
|
|
|
|
|
2024-01-10 10:08:39 -08:00
|
|
|
let args: Vec<String> = env::args().collect();
|
2024-01-16 17:57:19 -08:00
|
|
|
if args.len() != 3 {
|
|
|
|
println!("usage: boot <kernel-image> <initrd>");
|
2024-01-10 10:08:39 -08:00
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
let kernel_image_path = args.get(1).expect("argument not specified");
|
2024-01-16 17:57:19 -08:00
|
|
|
let initrd_path = args.get(2).expect("argument not specified");
|
2024-01-17 05:22:47 -08:00
|
|
|
let mut client = XenClient::open()?;
|
|
|
|
let config = DomainConfig {
|
2024-01-16 17:57:19 -08:00
|
|
|
max_vcpus: 1,
|
2024-01-17 05:22:47 -08:00
|
|
|
mem_mb: 512,
|
|
|
|
kernel_path: kernel_image_path.to_string(),
|
|
|
|
initrd_path: initrd_path.to_string(),
|
|
|
|
cmdline: "debug elevator=noop".to_string(),
|
2024-01-16 17:57:19 -08:00
|
|
|
};
|
2024-01-17 05:22:47 -08:00
|
|
|
let domid = client.create(config)?;
|
|
|
|
println!("created domain {}", domid);
|
2024-01-09 22:39:32 -08:00
|
|
|
Ok(())
|
|
|
|
}
|