From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 4/6] backup: drop 'maxfiles' parameter
Date: Fri, 18 Jul 2025 14:51:15 +0200 [thread overview]
Message-ID: <20250718125408.133376-5-f.ebner@proxmox.com> (raw)
In-Reply-To: <20250718125408.133376-1-f.ebner@proxmox.com>
The 'maxfiles' parameter has been deprecated since the addition of
'prune-backups' in the Proxmox VE 7 beta.
Drop the tests that only had maxfiles or both, but adapt the mixed
tests for CLI/backup/storage precedence.
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
PVE/API2/VZDump.pm | 14 ++---
PVE/VZDump.pm | 23 ++------
test/vzdump_new_test.pl | 120 ++--------------------------------------
3 files changed, 16 insertions(+), 141 deletions(-)
diff --git a/PVE/API2/VZDump.pm b/PVE/API2/VZDump.pm
index de48e108..a8f21eba 100644
--- a/PVE/API2/VZDump.pm
+++ b/PVE/API2/VZDump.pm
@@ -27,7 +27,7 @@ my sub assert_param_permission_vzdump {
PVE::API2::Backup::assert_param_permission_common($rpcenv, $user, $param);
- if (defined($param->{maxfiles}) || defined($param->{'prune-backups'})) {
+ if (defined($param->{'prune-backups'})) {
if (my $storeid = PVE::VZDump::get_storage_param($param)) {
$rpcenv->check($user, "/storage/$storeid", ['Datastore.Allocate']);
}
@@ -40,12 +40,12 @@ __PACKAGE__->register_method({
method => 'POST',
description => "Create backup.",
permissions => {
- description => "The user needs 'VM.Backup' permissions on any VM, and "
- . "'Datastore.AllocateSpace' on the backup storage (and fleecing storage when fleecing "
- . "is used). The 'tmpdir', 'dumpdir', 'script' and 'job-id' parameters are restricted "
- . "to the 'root\@pam' user. The 'maxfiles' and 'prune-backups' settings require "
- . "'Datastore.Allocate' on the backup storage. The 'bwlimit', 'performance' and "
- . "'ionice' parameters require 'Sys.Modify' on '/'.",
+ description => "The user needs 'VM.Backup' permissions on any VM, and"
+ . " 'Datastore.AllocateSpace' on the backup storage (and fleecing storage when fleecing"
+ . " is used). The 'tmpdir', 'dumpdir', 'script' and 'job-id' parameters are restricted"
+ . " to the 'root\@pam' user. The 'prune-backups' setting requires 'Datastore.Allocate'"
+ . " on the backup storage. The 'bwlimit', 'performance' and 'ionice' parameters require"
+ . " 'Sys.Modify' on '/'.",
user => 'all',
},
protected => 1,
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index cf71a9fa..defe9e0a 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -177,28 +177,16 @@ my sub merge_performance {
return $res;
}
-my $parse_prune_backups_maxfiles = sub {
+my $parse_prune_backups = sub {
my ($param, $kind) = @_;
- my $maxfiles = delete $param->{maxfiles};
my $prune_backups = $param->{'prune-backups'};
- debugmsg(
- 'warn',
- "both 'maxfiles' and 'prune-backups' defined as ${kind} - ignoring 'maxfiles'",
- ) if defined($maxfiles) && defined($prune_backups);
-
if (defined($prune_backups)) {
return $prune_backups if ref($prune_backups) eq 'HASH'; # already parsed
$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 };
- }
}
return $param->{'prune-backups'};
@@ -335,7 +323,7 @@ sub read_vzdump_defaults {
defined($default) ? ($_ => $default) : ()
} keys $fleecing_fmt->%*
};
- $parse_prune_backups_maxfiles->($defaults, "defaults in VZDump schema");
+ $parse_prune_backups->($defaults, "defaults in VZDump schema");
my $raw;
eval { $raw = PVE::Tools::file_get_contents($fn); };
@@ -360,7 +348,7 @@ sub read_vzdump_defaults {
my @mailto = split_list($res->{mailto});
$res->{mailto} = [@mailto];
}
- $parse_prune_backups_maxfiles->($res, "options in '$fn'");
+ $parse_prune_backups->($res, "options in '$fn'");
parse_fleecing($res);
parse_performance($res);
@@ -1548,10 +1536,7 @@ sub verify_vzdump_parameters {
raise_param_exc({ pool => "option conflicts with option 'vmid'" })
if $param->{pool} && $param->{vmid};
- raise_param_exc({ 'prune-backups' => "option conflicts with option 'maxfiles'" })
- if defined($param->{'prune-backups'}) && defined($param->{maxfiles});
-
- $parse_prune_backups_maxfiles->($param, 'CLI parameters');
+ $parse_prune_backups->($param, 'CLI parameters');
parse_fleecing($param);
parse_performance($param);
diff --git a/test/vzdump_new_test.pl b/test/vzdump_new_test.pl
index 36225ebb..db829e70 100755
--- a/test/vzdump_new_test.pl
+++ b/test/vzdump_new_test.pl
@@ -105,78 +105,6 @@ my @tests = (
},
},
# TODO make parse error critical?
- {
- description => 'maxfiles vzdump 1',
- vzdump_param => {
- maxfiles => 0,
- },
- expected => {
- 'prune-backups' => {
- 'keep-all' => 1,
- },
- remove => 0,
- },
- },
- {
- description => 'maxfiles vzdump 2',
- vzdump_param => {
- maxfiles => 7,
- },
- expected => {
- 'prune-backups' => {
- 'keep-last' => 7,
- },
- remove => 1,
- },
- },
- {
- description => 'maxfiles storage 1',
- storage_param => {
- maxfiles => 0,
- },
- expected => {
- 'prune-backups' => {
- 'keep-all' => 1,
- },
- remove => 0,
- },
- },
- {
- description => 'maxfiles storage 2',
- storage_param => {
- maxfiles => 7,
- },
- expected => {
- 'prune-backups' => {
- 'keep-last' => 7,
- },
- remove => 1,
- },
- },
- {
- description => 'maxfiles CLI 1',
- cli_param => {
- maxfiles => 0,
- },
- expected => {
- 'prune-backups' => {
- 'keep-all' => 1,
- },
- remove => 0,
- },
- },
- {
- description => 'maxfiles CLI 2',
- cli_param => {
- maxfiles => 7,
- },
- expected => {
- 'prune-backups' => {
- 'keep-last' => 7,
- },
- remove => 1,
- },
- },
{
description => 'prune-backups vzdump 1',
vzdump_param => {
@@ -219,19 +147,6 @@ my @tests = (
remove => 0,
},
},
- {
- description => 'both vzdump 1',
- vzdump_param => {
- 'prune-backups' => 'keep-all=1',
- maxfiles => 7,
- },
- expected => {
- 'prune-backups' => {
- 'keep-all' => 1,
- },
- remove => 0,
- },
- },
{
description => 'prune-backups storage 1',
storage_param => {
@@ -275,21 +190,6 @@ my @tests = (
remove => 0,
},
},
- {
- description => 'both storage 1',
- storage_param => {
- 'prune-backups' => 'keep-hourly=1,keep-monthly=2,keep-yearly=3',
- maxfiles => 0,
- },
- expected => {
- 'prune-backups' => {
- 'keep-hourly' => 1,
- 'keep-monthly' => 2,
- 'keep-yearly' => 3,
- },
- remove => 1,
- },
- },
{
description => 'prune-backups CLI 1',
cli_param => {
@@ -329,19 +229,10 @@ my @tests = (
expected => "format error\n"
. "foo: property is not defined in schema and the schema does not allow additional properties\n",
},
- {
- description => 'both CLI 1',
- cli_param => {
- 'prune-backups' => 'keep-hourly=1,keep-monthly=2,keep-yearly=3',
- maxfiles => 4,
- },
- expected => "400 Parameter verification failed.\n"
- . "prune-backups: option conflicts with option 'maxfiles'\n",
- },
{
description => 'mixed 1',
vzdump_param => {
- maxfiles => 7,
+ 'prune-backups' => 'keep-last=7',
},
storage_param => {
'prune-backups' => 'keep-hourly=24',
@@ -357,7 +248,7 @@ my @tests = (
{
description => 'mixed 2',
vzdump_param => {
- maxfiles => 7,
+ 'prune-backups' => 'keep-last=7',
},
storage_param => {
'prune-backups' => 'keephourly=24',
@@ -372,7 +263,7 @@ my @tests = (
{
description => 'mixed 3',
vzdump_param => {
- maxfiles => 7,
+ 'prune-backups' => 'keep-last=7',
},
cli_param => {
'prune-backups' => 'keep-all=1',
@@ -387,7 +278,7 @@ my @tests = (
{
description => 'mixed 4',
vzdump_param => {
- maxfiles => 7,
+ 'prune-backups' => 'keep-last=7',
},
storage_param => {
'prune-backups' => 'keep-all=0,keep-last=10',
@@ -405,7 +296,7 @@ my @tests = (
{
description => 'mixed 5',
vzdump_param => {
- maxfiles => 7,
+ 'prune-backups' => 'keep-last=7',
},
storage_param => {
'prune-backups' => 'keep-all=0,keep-last=10',
@@ -650,7 +541,6 @@ foreach my $test (@tests) {
my $vzdump = PVE::VZDump->new('fake cmdline', $test->{cli_param}, undef);
my $opts = $vzdump->{opts} or die "did not get options\n";
- die "maxfiles is defined" if defined($opts->{maxfiles});
my $res = {};
foreach my $opt (@{$tested_options}) {
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-07-18 12:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-18 12:51 [pve-devel] [PATCH-SERIES storage/guest-common/manager/docs 0/6] backup/storage: drop 'maxfiles' setting Fiona Ebner
2025-07-18 12:51 ` [pve-devel] [PATCH storage 1/6] config: drop 'maxfiles' parameter Fiona Ebner
2025-07-30 17:36 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-18 12:51 ` [pve-devel] [PATCH guest-common 2/6] schema: backup: " Fiona Ebner
2025-07-18 12:51 ` [pve-devel] [PATCH manager 3/6] pve8to9: backup retention: increase severity of having 'maxfiles' setting configured Fiona Ebner
2025-07-29 15:54 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-18 12:51 ` Fiona Ebner [this message]
2025-07-30 23:21 ` [pve-devel] applied: [PATCH manager 4/6] backup: drop 'maxfiles' parameter Thomas Lamprecht
2025-07-18 12:51 ` [pve-devel] [PATCH manager 5/6] ui: drop handling of removed 'maxfiles' setting Fiona Ebner
2025-07-30 23:21 ` [pve-devel] applied: " Thomas Lamprecht
2025-07-18 12:51 ` [pve-devel] [PATCH docs 6/6] backup/storage: remove references to 'maxfiles' parameter Fiona Ebner
2025-07-30 23:47 ` [pve-devel] applied: " 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=20250718125408.133376-5-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.