mirror of
https://github.com/edera-dev/krata.git
synced 2025-08-03 21:21:32 +00:00
chore(o11y): add more debug logs to daemon & runtime (#318)
This change adds debug log lines to make it easier to tell where issues are occuring during startup.
This commit is contained in:
@ -62,14 +62,22 @@ impl ChannelService {
|
||||
)> {
|
||||
let (input_sender, input_receiver) = channel(GROUPED_CHANNEL_QUEUE_LEN);
|
||||
let (output_sender, output_receiver) = channel(GROUPED_CHANNEL_QUEUE_LEN);
|
||||
|
||||
debug!("opening Xen event channel");
|
||||
let evtchn = EventChannel::open().await?;
|
||||
debug!("opening XenStore");
|
||||
let store = XsdClient::open().await?;
|
||||
debug!("opening GrantTab");
|
||||
let gnttab = GrantTab::open()?;
|
||||
|
||||
Ok((
|
||||
ChannelService {
|
||||
typ,
|
||||
use_reserved_ref,
|
||||
backends: HashMap::new(),
|
||||
evtchn: EventChannel::open().await?,
|
||||
store: XsdClient::open().await?,
|
||||
gnttab: GrantTab::open()?,
|
||||
evtchn,
|
||||
store,
|
||||
gnttab,
|
||||
input_sender: input_sender.clone(),
|
||||
input_receiver,
|
||||
output_sender,
|
||||
|
@ -7,7 +7,7 @@ use std::{
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use ipnetwork::{Ipv4Network, Ipv6Network};
|
||||
use log::error;
|
||||
use log::{debug, error, trace};
|
||||
use tokio::sync::RwLock;
|
||||
use uuid::Uuid;
|
||||
use xenstore::{XsdClient, XsdInterface};
|
||||
@ -72,7 +72,9 @@ impl IpVendor {
|
||||
ipv4_network: Ipv4Network,
|
||||
ipv6_network: Ipv6Network,
|
||||
) -> Result<Self> {
|
||||
debug!("fetching state from xenstore");
|
||||
let mut state = IpVendor::fetch_stored_state(&store).await?;
|
||||
debug!("allocating IP set");
|
||||
let (gateway_ipv4, gateway_ipv6) =
|
||||
IpVendor::allocate_ipset(&mut state, host_uuid, ipv4_network, ipv6_network)?;
|
||||
let vend = IpVendor {
|
||||
@ -84,11 +86,14 @@ impl IpVendor {
|
||||
gateway_ipv6,
|
||||
state: Arc::new(RwLock::new(state)),
|
||||
};
|
||||
debug!("IP vendor initialized!");
|
||||
Ok(vend)
|
||||
}
|
||||
|
||||
async fn fetch_stored_state(store: &XsdClient) -> Result<IpVendorState> {
|
||||
debug!("initializing default IP vendor state");
|
||||
let mut state = IpVendorState::default();
|
||||
debug!("iterating over xen domains");
|
||||
for domid_candidate in store.list("/local/domain").await? {
|
||||
let dom_path = format!("/local/domain/{}", domid_candidate);
|
||||
let Some(uuid) = store
|
||||
@ -119,6 +124,7 @@ impl IpVendor {
|
||||
}
|
||||
}
|
||||
}
|
||||
debug!("IP state hydrated");
|
||||
Ok(state)
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ use anyhow::{anyhow, Result};
|
||||
use ip::IpVendor;
|
||||
use ipnetwork::{IpNetwork, Ipv4Network, Ipv6Network};
|
||||
use krataloopdev::LoopControl;
|
||||
use log::error;
|
||||
use log::{debug, error};
|
||||
use tokio::sync::Semaphore;
|
||||
use uuid::Uuid;
|
||||
use xenclient::XenClient;
|
||||
@ -66,15 +66,23 @@ pub struct RuntimeContext {
|
||||
|
||||
impl RuntimeContext {
|
||||
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 ipvend =
|
||||
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!");
|
||||
Ok(RuntimeContext {
|
||||
autoloop: AutoLoop::new(LoopControl::open()?),
|
||||
autoloop,
|
||||
xen,
|
||||
ipvendor: ipvend,
|
||||
ipvendor,
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user