sprinkle in some rustdoc
This commit is contained in:
		
							parent
							
								
									ef2c8b601c
								
							
						
					
					
						commit
						27f251ea8c
					
				
					 2 changed files with 15 additions and 0 deletions
				
			
		|  | @ -7,14 +7,20 @@ use figment::{ | ||||||
| use hickory_proto::rr::Name; | use hickory_proto::rr::Name; | ||||||
| use serde::{Deserialize, Serialize}; | use serde::{Deserialize, Serialize}; | ||||||
| 
 | 
 | ||||||
|  | /// libvirt storage pool configuration
 | ||||||
| #[derive(Clone, Debug, Serialize, Deserialize)] | #[derive(Clone, Debug, Serialize, Deserialize)] | ||||||
| pub struct StorageConfig { | pub struct StorageConfig { | ||||||
|  |     /// The primary storage pool, allocated to all VMs.
 | ||||||
|     pub primary_pool: String, |     pub primary_pool: String, | ||||||
|  |     /// The secondary storage pool, allocated to any VMs that require slower storage.
 | ||||||
|     pub secondary_pool: String, |     pub secondary_pool: String, | ||||||
|  |     #[deprecated(note = "FAT32 NoCloud support will be replaced with an HTTP endpoint")] | ||||||
|     pub ci_image_pool: String, |     pub ci_image_pool: String, | ||||||
|  |     /// Pool containing cloud-init base images.
 | ||||||
|     pub base_image_pool: String, |     pub base_image_pool: String, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /// Provides the basic SOA (Start-of-Authority) for the internal DNS zone.
 | ||||||
| #[derive(Clone, Debug, Serialize, Deserialize)] | #[derive(Clone, Debug, Serialize, Deserialize)] | ||||||
| pub struct SOAConfig { | pub struct SOAConfig { | ||||||
|     pub nzr_domain: Name, |     pub nzr_domain: Name, | ||||||
|  | @ -24,6 +30,7 @@ pub struct SOAConfig { | ||||||
|     pub expire: i32, |     pub expire: i32, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /// DNS server configuration.
 | ||||||
| #[derive(Clone, Debug, Serialize, Deserialize)] | #[derive(Clone, Debug, Serialize, Deserialize)] | ||||||
| pub struct DNSConfig { | pub struct DNSConfig { | ||||||
|     pub listen_addr: String, |     pub listen_addr: String, | ||||||
|  | @ -31,18 +38,22 @@ pub struct DNSConfig { | ||||||
|     pub soa: SOAConfig, |     pub soa: SOAConfig, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /// Server<->Client RPC configuration.
 | ||||||
| #[derive(Clone, Debug, Serialize, Deserialize)] | #[derive(Clone, Debug, Serialize, Deserialize)] | ||||||
| pub struct RPCConfig { | pub struct RPCConfig { | ||||||
|     pub socket_path: PathBuf, |     pub socket_path: PathBuf, | ||||||
|     pub admin_group: Option<String>, |     pub admin_group: Option<String>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /// The root configuration struct.
 | ||||||
| #[derive(Debug, Serialize, Deserialize)] | #[derive(Debug, Serialize, Deserialize)] | ||||||
| pub struct Config { | pub struct Config { | ||||||
|     pub rpc: RPCConfig, |     pub rpc: RPCConfig, | ||||||
|     pub log_level: String, |     pub log_level: String, | ||||||
|  |     /// Where database information should be stored.
 | ||||||
|     pub db_path: PathBuf, |     pub db_path: PathBuf, | ||||||
|     pub qemu_img_path: Option<PathBuf>, |     pub qemu_img_path: Option<PathBuf>, | ||||||
|  |     /// The libvirt URI to use for connections; e.g. `qemu:///system`.
 | ||||||
|     pub libvirt_uri: String, |     pub libvirt_uri: String, | ||||||
|     pub storage: StorageConfig, |     pub storage: StorageConfig, | ||||||
|     pub dns: DNSConfig, |     pub dns: DNSConfig, | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ use crate::{ | ||||||
| 
 | 
 | ||||||
| use log::*; | use log::*; | ||||||
| 
 | 
 | ||||||
|  | /// An abstracted representation of a libvirt volume.
 | ||||||
| pub struct VirtVolume { | pub struct VirtVolume { | ||||||
|     inner: StorageVol, |     inner: StorageVol, | ||||||
|     pub persist: bool, |     pub persist: bool, | ||||||
|  | @ -65,6 +66,7 @@ impl VirtVolume { | ||||||
|         Ok(()) |         Ok(()) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /// Creates a [VirtVolume] from the given [Volume](crate::ctrl::virtxml::Volume) XML data.
 | ||||||
|     pub async fn create_xml( |     pub async fn create_xml( | ||||||
|         pool: &StoragePool, |         pool: &StoragePool, | ||||||
|         xmldata: Volume, |         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> |     pub fn lookup_by_name<P>(pool: P, name: &str) -> Result<Self, virt::error::Error> | ||||||
|     where |     where | ||||||
|         P: AsRef<StoragePool>, |         P: AsRef<StoragePool>, | ||||||
|  | @ -115,6 +118,7 @@ impl VirtVolume { | ||||||
|         }) |         }) | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     /// Clones the volume to the given pool.
 | ||||||
|     pub async fn clone_vol( |     pub async fn clone_vol( | ||||||
|         &mut self, |         &mut self, | ||||||
|         pool: &VirtPool, |         pool: &VirtPool, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue