api2: DataStoreListItem add maintenance info

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer 2022-04-26 06:23:31 +00:00 committed by Thomas Lamprecht
parent dd09432a90
commit e022d13cf3
2 changed files with 9 additions and 0 deletions

View File

@ -354,6 +354,11 @@ impl DataStoreConfig {
optional: true,
schema: SINGLE_LINE_COMMENT_SCHEMA,
},
maintenance: {
optional: true,
format: &ApiStringFormat::PropertyString(&MaintenanceMode::API_SCHEMA),
type: String,
}
},
)]
#[derive(Serialize, Deserialize)]
@ -362,6 +367,9 @@ impl DataStoreConfig {
pub struct DataStoreListItem {
pub store: String,
pub comment: Option<String>,
/// If the datastore is in maintenance mode, information about it
#[serde(skip_serializing_if = "Option::is_none")]
pub maintenance: Option<String>,
}
#[api(

View File

@ -1030,6 +1030,7 @@ pub fn get_datastore_list(
list.push(DataStoreListItem {
store: store.clone(),
comment: data["comment"].as_str().map(String::from),
maintenance: data["maintenance-mode"].as_str().map(String::from),
});
}
}