sprinkle in some rustdoc

This commit is contained in:
snow flurry 2024-07-28 13:21:51 -07:00
parent ef2c8b601c
commit 27f251ea8c
2 changed files with 15 additions and 0 deletions

View file

@ -7,14 +7,20 @@ use figment::{
use hickory_proto::rr::Name;
use serde::{Deserialize, Serialize};
/// libvirt storage pool configuration
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct StorageConfig {
/// The primary storage pool, allocated to all VMs.
pub primary_pool: String,
/// The secondary storage pool, allocated to any VMs that require slower storage.
pub secondary_pool: String,
#[deprecated(note = "FAT32 NoCloud support will be replaced with an HTTP endpoint")]
pub ci_image_pool: String,
/// Pool containing cloud-init base images.
pub base_image_pool: String,
}
/// Provides the basic SOA (Start-of-Authority) for the internal DNS zone.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SOAConfig {
pub nzr_domain: Name,
@ -24,6 +30,7 @@ pub struct SOAConfig {
pub expire: i32,
}
/// DNS server configuration.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct DNSConfig {
pub listen_addr: String,
@ -31,18 +38,22 @@ pub struct DNSConfig {
pub soa: SOAConfig,
}
/// Server<->Client RPC configuration.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct RPCConfig {
pub socket_path: PathBuf,
pub admin_group: Option<String>,
}
/// The root configuration struct.
#[derive(Debug, Serialize, Deserialize)]
pub struct Config {
pub rpc: RPCConfig,
pub log_level: String,
/// Where database information should be stored.
pub db_path: PathBuf,
pub qemu_img_path: Option<PathBuf>,
/// The libvirt URI to use for connections; e.g. `qemu:///system`.
pub libvirt_uri: String,
pub storage: StorageConfig,
pub dns: DNSConfig,

View file

@ -11,6 +11,7 @@ use crate::{
use log::*;
/// An abstracted representation of a libvirt volume.
pub struct VirtVolume {
inner: StorageVol,
pub persist: bool,
@ -65,6 +66,7 @@ impl VirtVolume {
Ok(())
}
/// Creates a [VirtVolume] from the given [Volume](crate::ctrl::virtxml::Volume) XML data.
pub async fn create_xml(
pool: &StoragePool,
xmldata: Volume,
@ -103,6 +105,7 @@ impl VirtVolume {
})
}
/// Finds a volume by the given pool and name.
pub fn lookup_by_name<P>(pool: P, name: &str) -> Result<Self, virt::error::Error>
where
P: AsRef<StoragePool>,
@ -115,6 +118,7 @@ impl VirtVolume {
})
}
/// Clones the volume to the given pool.
pub async fn clone_vol(
&mut self,
pool: &VirtPool,