[pbs-devel] [PATCH proxmox-backup 06/12] pull_store/group: dont try remove locally protected snapshots

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Sep 16 12:08:23 CEST 2021


On September 6, 2021 12:57 pm, Dominik Csapak wrote:
> and log if a vanished groups could not be completely deleted if it
> contains protected snapshots

I am not yet 100% if not syncing protected is the right way to go, it's 
messy and potentially a pitfall either way.. should be properly 
documented in any case, and maybe syncing a protected snapshot could 
indicate that the protection flag was not carried over?

> 
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
>  src/server/pull.rs | 19 ++++++++++++++++---
>  1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/src/server/pull.rs b/src/server/pull.rs
> index 5214a218..910ba03b 100644
> --- a/src/server/pull.rs
> +++ b/src/server/pull.rs
> @@ -609,6 +609,13 @@ pub async fn pull_group(
>              if remote_snapshots.contains(&backup_time) {
>                  continue;
>              }
> +            if info.backup_dir.is_protected(tgt_store.base_path()) {
> +                worker.log(format!(
> +                        "don't delete vanished snapshot {:?} (protected)",
> +                        info.backup_dir.relative_path()
> +                ));
> +                continue;
> +            }
>              worker.log(format!(
>                  "delete vanished snapshot {:?}",
>                  info.backup_dir.relative_path()
> @@ -722,9 +729,15 @@ pub async fn pull_store(
>                      local_group.backup_type(),
>                      local_group.backup_id()
>                  ));
> -                if let Err(err) = tgt_store.remove_backup_group(&local_group) {
> -                    worker.log(err.to_string());
> -                    errors = true;
> +                match tgt_store.remove_backup_group(&local_group) {
> +                    Ok(true) => {},
> +                    Ok(false) => {
> +                        task_log!(worker, "kept some protected snapshots of group '{}'", local_group);
> +                    },
> +                    Err(err) => {
> +                        task_log!(worker, "{}", err);
> +                        errors = true;
> +                    }
>                  }
>              }
>              Ok(())
> -- 
> 2.30.2
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 





More information about the pbs-devel mailing list