prune: never fail, just warn about failed removals
A removal can fail if the snapshot is already gone (this is fine, our job is done either way) or we couldn't get a lock (also fine, it can't be removed then, just warn the user so he knows what happened and why it wasn't removed) - keep going either way. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
parent
836c4a278d
commit
f153930066
|
@ -16,7 +16,6 @@ use proxmox::api::{
|
|||
use proxmox::api::router::SubdirMap;
|
||||
use proxmox::api::schema::*;
|
||||
use proxmox::tools::fs::{replace_file, CreateOptions};
|
||||
use proxmox::try_block;
|
||||
use proxmox::{http_err, identity, list_subdirs_api_method, sortable};
|
||||
|
||||
use pxar::accessor::aio::Accessor;
|
||||
|
@ -692,7 +691,6 @@ fn prune(
|
|||
// We use a WorkerTask just to have a task log, but run synchrounously
|
||||
let worker = WorkerTask::new("prune", Some(worker_id), Userid::root_userid().clone(), true)?;
|
||||
|
||||
let result = try_block! {
|
||||
if keep_all {
|
||||
worker.log("No prune selection - keeping all files.");
|
||||
} else {
|
||||
|
@ -727,18 +725,18 @@ fn prune(
|
|||
}));
|
||||
|
||||
if !(dry_run || keep) {
|
||||
datastore.remove_backup_dir(&info.backup_dir, false)?;
|
||||
if let Err(err) = datastore.remove_backup_dir(&info.backup_dir, false) {
|
||||
worker.warn(
|
||||
format!(
|
||||
"failed to remove dir {:?}: {}",
|
||||
info.backup_dir.relative_path(), err
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
};
|
||||
|
||||
worker.log_result(&result);
|
||||
|
||||
if let Err(err) = result {
|
||||
bail!("prune failed - {}", err);
|
||||
};
|
||||
worker.log_result(&Ok(()));
|
||||
|
||||
Ok(json!(prune_result))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue