api: disable setting prune options in datastore.cfg

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2022-05-30 14:48:13 +02:00
parent 6283d7d13a
commit aa32a46171
1 changed files with 19 additions and 26 deletions

View File

@ -302,29 +302,26 @@ pub fn update_datastore(
data.gc_schedule = update.gc_schedule; data.gc_schedule = update.gc_schedule;
} }
let mut prune_schedule_changed = false; macro_rules! prune_disabled {
if update.prune_schedule.is_some() { ($(($param:literal, $($member:tt)+)),+) => {
prune_schedule_changed = data.prune_schedule != update.prune_schedule; $(
data.prune_schedule = update.prune_schedule; if update.$($member)+.is_some() {
param_bail!(
$param,
"datastore prune settings have been replaced by prune jobs",
);
} }
)+
if update.keep.keep_last.is_some() { };
data.keep.keep_last = update.keep.keep_last;
} }
if update.keep.keep_hourly.is_some() { prune_disabled! {
data.keep.keep_hourly = update.keep.keep_hourly; ("keep-last", keep.keep_last),
} ("keep-hourly", keep.keep_hourly),
if update.keep.keep_daily.is_some() { ("keep-daily", keep.keep_daily),
data.keep.keep_daily = update.keep.keep_daily; ("keep-weekly", keep.keep_weekly),
} ("keep-monthly", keep.keep_monthly),
if update.keep.keep_weekly.is_some() { ("keep-yearly", keep.keep_yearly),
data.keep.keep_weekly = update.keep.keep_weekly; ("prune-schedule", prune_schedule)
}
if update.keep.keep_monthly.is_some() {
data.keep.keep_monthly = update.keep.keep_monthly;
}
if update.keep.keep_yearly.is_some() {
data.keep.keep_yearly = update.keep.keep_yearly;
} }
if let Some(notify_str) = update.notify { if let Some(notify_str) = update.notify {
@ -367,10 +364,6 @@ pub fn update_datastore(
jobstate::update_job_last_run_time("garbage_collection", &name)?; jobstate::update_job_last_run_time("garbage_collection", &name)?;
} }
if prune_schedule_changed {
jobstate::update_job_last_run_time("prune", &name)?;
}
Ok(()) Ok(())
} }