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",
);
}
)+
};
} }
prune_disabled! {
if update.keep.keep_last.is_some() { ("keep-last", keep.keep_last),
data.keep.keep_last = update.keep.keep_last; ("keep-hourly", keep.keep_hourly),
} ("keep-daily", keep.keep_daily),
if update.keep.keep_hourly.is_some() { ("keep-weekly", keep.keep_weekly),
data.keep.keep_hourly = update.keep.keep_hourly; ("keep-monthly", keep.keep_monthly),
} ("keep-yearly", keep.keep_yearly),
if update.keep.keep_daily.is_some() { ("prune-schedule", prune_schedule)
data.keep.keep_daily = update.keep.keep_daily;
}
if update.keep.keep_weekly.is_some() {
data.keep.keep_weekly = update.keep.keep_weekly;
}
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(())
} }