manager: hidden command to move datastore prune opts into jobs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2022-05-24 12:54:42 +02:00
parent 9ce2f903fb
commit 134779664e
8 changed files with 142 additions and 108 deletions

View File

@ -2,7 +2,7 @@ use anyhow::Error;
use lazy_static::lazy_static;
use std::collections::HashMap;
use proxmox_schema::{ApiType, Schema};
use proxmox_schema::{AllOfSchema, ApiType, Schema};
use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin};
use pbs_api_types::{DataStoreConfig, DATASTORE_SCHEMA};
@ -14,15 +14,12 @@ lazy_static! {
}
fn init() -> SectionConfig {
let obj_schema = match DataStoreConfig::API_SCHEMA {
Schema::Object(ref obj_schema) => obj_schema,
_ => unreachable!(),
};
const OBJ_SCHEMA: &AllOfSchema = DataStoreConfig::API_SCHEMA.unwrap_all_of_schema();
let plugin = SectionConfigPlugin::new(
"datastore".to_string(),
Some(String::from("name")),
obj_schema,
OBJ_SCHEMA,
);
let mut config = SectionConfig::new(&DATASTORE_SCHEMA);
config.register_plugin(plugin);

View File

@ -39,6 +39,7 @@ pub fn config() -> Result<(SectionConfigData, [u8; 32]), Error> {
let digest = openssl::sha::sha256(content.as_bytes());
let data = CONFIG.parse(PRUNE_CFG_FILENAME, &content)?;
Ok((data, digest))
}