src/api2/admin/datastore.rs - prune: log retention options
This commit is contained in:
parent
503995c767
commit
236a396aa1
|
@ -471,6 +471,8 @@ on that.
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
# proxmox-backup-client prune host/elsa --dry-run --keep-daily 1 --keep-weekly 3
|
# proxmox-backup-client prune host/elsa --dry-run --keep-daily 1 --keep-weekly 3
|
||||||
|
retention options: --keep-daily 1 --keep-weekly 3
|
||||||
|
Testing prune on store "store2" group "host/elsa"
|
||||||
host/elsa/2019-12-04T13:20:37Z keep
|
host/elsa/2019-12-04T13:20:37Z keep
|
||||||
host/elsa/2019-12-03T09:35:01Z remove
|
host/elsa/2019-12-03T09:35:01Z remove
|
||||||
host/elsa/2019-11-22T11:54:47Z keep
|
host/elsa/2019-11-22T11:54:47Z keep
|
||||||
|
|
|
@ -339,6 +339,7 @@ fn prune(
|
||||||
worker.log("No prune selection - keeping all files.");
|
worker.log("No prune selection - keeping all files.");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
} else {
|
} else {
|
||||||
|
worker.log(format!("retention options: {}", prune_options.cli_options_string()));
|
||||||
if dry_run {
|
if dry_run {
|
||||||
worker.log(format!("Testing prune on store \"{}\" group \"{}/{}\"",
|
worker.log(format!("Testing prune on store \"{}\" group \"{}/{}\"",
|
||||||
store, backup_type, backup_id));
|
store, backup_type, backup_id));
|
||||||
|
|
|
@ -131,6 +131,43 @@ impl PruneOptions {
|
||||||
if let Some(count) = self.keep_yearly { if count > 0 { keep_something = true; } }
|
if let Some(count) = self.keep_yearly { if count > 0 { keep_something = true; } }
|
||||||
keep_something
|
keep_something
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn cli_options_string(&self) -> String {
|
||||||
|
let mut opts = Vec::new();
|
||||||
|
|
||||||
|
if let Some(count) = self.keep_last {
|
||||||
|
if count > 0 {
|
||||||
|
opts.push(format!("--keep-last {}", count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(count) = self.keep_hourly {
|
||||||
|
if count > 0 {
|
||||||
|
opts.push(format!("--keep-hourly {}", count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(count) = self.keep_daily {
|
||||||
|
if count > 0 {
|
||||||
|
opts.push(format!("--keep-daily {}", count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(count) = self.keep_weekly {
|
||||||
|
if count > 0 {
|
||||||
|
opts.push(format!("--keep-weekly {}", count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(count) = self.keep_monthly {
|
||||||
|
if count > 0 {
|
||||||
|
opts.push(format!("--keep-monthly {}", count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(count) = self.keep_yearly {
|
||||||
|
if count > 0 {
|
||||||
|
opts.push(format!("--keep-yearly {}", count));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
opts.join(" ")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn compute_prune_info(
|
pub fn compute_prune_info(
|
||||||
|
|
Loading…
Reference in New Issue