From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 3/4] vzdump: convert maxfiles CLI parameter to prune-backups
Date: Tue, 1 Dec 2020 09:24:20 +0100 [thread overview]
Message-ID: <20201201082421.4646-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20201201082421.4646-1-f.ebner@proxmox.com>
in preparation to clean up handling in new().
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/VZDump.pm | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 94aa76ab..8574fc94 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -69,6 +69,29 @@ sub run_command {
PVE::Tools::run_command($cmdstr, %param, logfunc => $logfunc);
}
+my $parse_prune_backups_maxfiles = sub {
+ my ($param, $kind) = @_;
+
+ my $maxfiles = delete $param->{maxfiles};
+ my $prune_backups = $param->{'prune-backups'};
+
+ warn "both 'maxfiles' and 'prune-backups' defined as ${kind} - ignoring 'maxfiles'\n"
+ if defined($maxfiles) && defined($prune_backups);
+
+ if (defined($prune_backups)) {
+ $param->{'prune-backups'} = PVE::JSONSchema::parse_property_string(
+ 'prune-backups',
+ $prune_backups
+ );
+ } elsif (defined($maxfiles)) {
+ if ($maxfiles) {
+ $param->{'prune-backups'} = { 'keep-last' => $maxfiles };
+ } else {
+ $param->{'prune-backups'} = { 'keep-all' => 1 };
+ }
+ }
+};
+
sub storage_info {
my $storage = shift;
@@ -1170,8 +1193,7 @@ sub verify_vzdump_parameters {
raise_param_exc({ 'prune-backups' => "option conflicts with option 'maxfiles'"})
if defined($param->{'prune-backups'}) && defined($param->{maxfiles});
- $param->{'prune-backups'} = PVE::JSONSchema::parse_property_string('prune-backups', $param->{'prune-backups'})
- if defined($param->{'prune-backups'});
+ $parse_prune_backups_maxfiles->($param, 'CLI parameters');
$param->{all} = 1 if (defined($param->{exclude}) && !$param->{pool});
--
2.20.1
next prev parent reply other threads:[~2020-12-01 8:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 8:24 [pve-devel] [PATCH manager 1/4] test: add tests for retention parameters for vzdump's new() Fabian Ebner
2020-12-01 8:24 ` [pve-devel] [PATCH manager 2/4] vzdump: storage_info: adapt to new maxfiles backend behavior Fabian Ebner
2020-12-01 8:24 ` Fabian Ebner [this message]
2020-12-01 8:24 ` [pve-devel] [PATCH manager 4/4] vzdump: defaults: correctly parse prune-backups and convert maxfiles Fabian Ebner
2020-12-02 17:02 ` [pve-devel] applied-series: [PATCH manager 1/4] test: add tests for retention parameters for vzdump's new() Thomas Lamprecht
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=20201201082421.4646-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal