rework and cleanup

This commit is contained in:
Alex Zenla
2024-07-25 05:36:48 -07:00
parent 2c868ce0ca
commit c9783dc244
7 changed files with 3758 additions and 108 deletions

View File

@ -1,17 +1,10 @@
use std::{fs, path::PathBuf, str::FromStr, sync::Arc};
use anyhow::{anyhow, Result};
<<<<<<< HEAD
use ip::IpVendor;
use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network};
use krataloopdev::LoopControl;
use log::{debug, error};
=======
>>>>>>> 267dc66 (feature(krata): rework api and make ip assignment persistent to database)
use tokio::sync::Semaphore;
use uuid::Uuid;
use krataloopdev::LoopControl;
use xenclient::XenClient;
use xenstore::{XsdClient, XsdInterface};
@ -62,32 +55,11 @@ pub struct RuntimeContext {
}
impl RuntimeContext {
<<<<<<< HEAD
pub async fn new(host_uuid: Uuid) -> Result<Self> {
debug!("initializing XenClient");
let xen = XenClient::new(0, RuntimePlatform::new()).await?;
debug!("initializing ip allocation vendor");
let ipv4_network = Ipv4Network::new(Ipv4Addr::new(10, 75, 80, 0), 24)?;
let ipv6_network = Ipv6Network::from_str("fdd4:1476:6c7e::/48")?;
let ipvendor =
IpVendor::new(xen.store.clone(), host_uuid, ipv4_network, ipv6_network).await?;
debug!("initializing loop devices");
let autoloop = AutoLoop::new(LoopControl::open()?);
debug!("krata runtime initialized!");
=======
pub async fn new() -> Result<Self> {
let xen = XenClient::new(0, RuntimePlatform::new()).await?;
>>>>>>> 267dc66 (feature(krata): rework api and make ip assignment persistent to database)
Ok(RuntimeContext {
autoloop,
autoloop: AutoLoop::new(LoopControl::open()?),
xen,
<<<<<<< HEAD
ipvendor,
=======
>>>>>>> 267dc66 (feature(krata): rework api and make ip assignment persistent to database)
})
}