api: make maintenance_type updatable

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
This commit is contained in:
Hannes Laimer 2022-04-12 05:25:59 +00:00 committed by Thomas Lamprecht
parent 4bc84a6549
commit 758c6ed588

View File

@ -186,6 +186,8 @@ pub enum DeletableProperty {
notify,
/// Delete the tuning property
tuning,
/// Delete the maintenance-mode property
maintenance_mode,
}
#[api(
@ -253,6 +255,7 @@ pub fn update_datastore(
DeletableProperty::notify => { data.notify = None; },
DeletableProperty::notify_user => { data.notify_user = None; },
DeletableProperty::tuning => { data.tuning = None; },
DeletableProperty::maintenance_mode => { data.maintenance_mode = None; },
}
}
}
@ -300,6 +303,8 @@ pub fn update_datastore(
if update.tuning.is_some() { data.tuning = update.tuning; }
if update.maintenance_mode.is_some() { data.maintenance_mode = update.maintenance_mode; }
config.set_data(&name, "datastore", &data)?;
pbs_config::datastore::save_config(&config)?;