public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 storage 6/7] prune: mark renamed and protected backups differently
Date: Thu, 30 Sep 2021 13:42:09 +0200	[thread overview]
Message-ID: <20210930114215.240095-7-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210930114215.240095-1-f.ebner@proxmox.com>

While it makes no difference for pruning itself, protected backups are
additionally protected against removal. Avoid the potential to confuse
the two. Also update the description for the API return value and add
an enum constraint.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

No changes from v1.

 PVE/API2/Storage/PruneBackups.pm | 5 +++--
 PVE/Storage/Plugin.pm            | 2 +-
 test/prune_backups_test.pm       | 4 ++--
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/Storage/PruneBackups.pm b/PVE/API2/Storage/PruneBackups.pm
index 2509a46..e6ab276 100644
--- a/PVE/API2/Storage/PruneBackups.pm
+++ b/PVE/API2/Storage/PruneBackups.pm
@@ -61,9 +61,10 @@ __PACKAGE__->register_method ({
 		    type => 'integer',
 		},
 		'mark' => {
-		    description => "Whether the backup would be kept or removed. For backups that don't " .
-				   "use the standard naming scheme, it's 'protected'.",
+		    description => "Whether the backup would be kept or removed. Backups that are" .
+			" protected or don't use the standard naming scheme are not removed.",
 		    type => 'string',
+		    enum => ['keep', 'remove', 'protected', 'renamed'],
 		},
 		type => {
 		    description => "One of 'qemu', 'lxc', 'openvz' or 'unknown'.",
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 1ebd705..a2145fa 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -1322,7 +1322,7 @@ sub prune_backups {
 	    push @{$backup_groups->{$group}}, $prune_entry;
 	} else {
 	    # ignore backups that don't use the standard naming scheme
-	    $prune_entry->{mark} = 'protected';
+	    $prune_entry->{mark} = 'renamed';
 	}
 
 	$prune_entry->{mark} = 'protected' if $backup->{protected};
diff --git a/test/prune_backups_test.pm b/test/prune_backups_test.pm
index 8ad6144..b57d280 100644
--- a/test/prune_backups_test.pm
+++ b/test/prune_backups_test.pm
@@ -189,7 +189,7 @@ sub generate_expected {
 		'volid' => "$storeid:backup/vzdump-$vmid-renamed.tar.zst",
 		'type'  => 'unknown',
 		'ctime' => 1234,
-		'mark'  => 'protected',
+		'mark'  => 'renamed',
 		'vmid'  => $vmid,
 	    },
 	) if !defined($type);
@@ -375,7 +375,7 @@ my $tests = [
 	    {
 		'volid' => "$storeid:backup/vzdump-lxc-novmid.tar.gz",
 		'ctime' => 1234,
-		'mark'  => 'protected',
+		'mark'  => 'renamed',
 		'type'  => 'lxc',
 	    },
 	],
-- 
2.30.2





  parent reply	other threads:[~2021-09-30 11:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-30 11:42 [pve-devel] [PATCH-SERIES v2 manager/storage] fix #3307: allow backups to be marked as protected Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 1/7] dir plugin: update notes: don't fail if file is already removed Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 2/7] dir plugin: get notes: return undef if notes are not supported Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 3/7] add generalized functions to manage volume attributes Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 4/7] prune mark: preserve additional information for the keep-all case Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 5/7] fix #3307: make it possible to set protection for backups Fabian Ebner
2021-09-30 11:42 ` Fabian Ebner [this message]
2021-09-30 11:42 ` [pve-devel] [PATCH v2 storage 7/7] pbs: integrate support for protected Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 1/5] vzdump: skip protected backups for dumpdir pruning Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 2/5] ui: storage content: avoid redundant options hasNotesColumn and hideColumns Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 3/5] ui: backup views: add protected column Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 4/5] ui: backup views: add button to change protection status Fabian Ebner
2021-09-30 11:42 ` [pve-devel] [PATCH v2 manager 5/5] ui: prune: also handle new 'renamed' keep reason Fabian Ebner
2021-11-09 16:51 ` [pve-devel] applied-series: [PATCH-SERIES v2 manager/storage] fix #3307: allow backups to be marked as protected Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210930114215.240095-7-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal