mirror of
				https://github.com/edera-dev/krata.git
				synced 2025-11-03 07:19:37 +00:00 
			
		
		
		
	feature(oci): add configuration value for oci seed file (#220)
This commit is contained in:
		@ -6,10 +6,18 @@ use tokio::fs;
 | 
			
		||||
 | 
			
		||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
 | 
			
		||||
pub struct DaemonConfig {
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub oci: OciConfig,
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub pci: DaemonPciConfig,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
 | 
			
		||||
pub struct OciConfig {
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub seed: Option<String>,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
 | 
			
		||||
pub struct DaemonPciConfig {
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
 | 
			
		||||
@ -93,7 +93,8 @@ impl Daemon {
 | 
			
		||||
        let kernel_path = detect_guest_path(&store, "kernel")?;
 | 
			
		||||
        let addons_path = detect_guest_path(&store, "addons.squashfs")?;
 | 
			
		||||
 | 
			
		||||
        let packer = OciPackerService::new(None, &image_cache_dir, OciPlatform::current()).await?;
 | 
			
		||||
        let seed = config.oci.seed.clone().map(PathBuf::from);
 | 
			
		||||
        let packer = OciPackerService::new(seed, &image_cache_dir, OciPlatform::current()).await?;
 | 
			
		||||
        let runtime = Runtime::new(host_uuid).await?;
 | 
			
		||||
        let glt = GuestLookupTable::new(0, host_uuid);
 | 
			
		||||
        let guests_db_path = format!("{}/guests.db", store);
 | 
			
		||||
@ -128,7 +129,9 @@ impl Daemon {
 | 
			
		||||
        // TODO: Make initial power management policy configurable.
 | 
			
		||||
        let power = runtime.power_management_context().await?;
 | 
			
		||||
        power.set_smt_policy(true).await?;
 | 
			
		||||
        power.set_scheduler_policy("performance".to_string()).await?;
 | 
			
		||||
        power
 | 
			
		||||
            .set_scheduler_policy("performance".to_string())
 | 
			
		||||
            .await?;
 | 
			
		||||
 | 
			
		||||
        Ok(Self {
 | 
			
		||||
            store,
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user