* [pve-devel] [PATCH storage 1/2] prune-backups CLI: use keep-options directly
@ 2020-08-31 8:48 Fabian Ebner
2020-08-31 8:48 ` [pve-devel] [PATCH storage 2/2] prune-backups: improve command description Fabian Ebner
2020-09-03 16:23 ` [pve-devel] applied-series: [PATCH storage 1/2] prune-backups CLI: use keep-options directly Thomas Lamprecht
0 siblings, 2 replies; 3+ messages in thread
From: Fabian Ebner @ 2020-08-31 8:48 UTC (permalink / raw)
To: pve-devel
Makes the interface cleaner; e.g. --keep-daily=2 instead of
--prune-backups=keep-daily=2
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/CLI/pvesm.pm | 12 ++++++++----
PVE/Storage/Plugin.pm | 2 +-
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
index caac51b..d7591ee 100755
--- a/PVE/CLI/pvesm.pm
+++ b/PVE/CLI/pvesm.pm
@@ -752,10 +752,7 @@ __PACKAGE__->register_method ({
storage => get_standard_option('pve-storage-id', {
completion => \&PVE::Storage::complete_storage_enabled,
}),
- 'prune-backups' => get_standard_option('prune-backups', {
- description => "Use these retention options instead of those from the storage configuration.",
- optional => 1,
- }),
+ %{$PVE::Storage::Plugin::prune_backups_format},
type => {
description => "Either 'qemu' or 'lxc'. Only consider backups for guests of this type.",
type => 'string',
@@ -813,6 +810,13 @@ __PACKAGE__->register_method ({
my $dryrun = extract_param($param, 'dry-run') ? 1 : 0;
+ my $keep_opts;
+ foreach my $keep (keys %{$PVE::Storage::Plugin::prune_backups_format}) {
+ $keep_opts->{$keep} = extract_param($param, $keep) if defined($param->{$keep});
+ }
+ $param->{'prune-backups'} = PVE::JSONSchema::print_property_string(
+ $keep_opts, $PVE::Storage::Plugin::prune_backups_format) if $keep_opts;
+
my $list = [];
if ($dryrun) {
$list = PVE::API2::Storage::PruneBackups->dryrun($param);
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 8a58ff4..5b337df 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -49,7 +49,7 @@ my %prune_option = (
format_description => 'N',
);
-my $prune_backups_format = {
+our $prune_backups_format = {
'keep-last' => {
%prune_option,
description => 'Keep the last <N> backups.',
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] [PATCH storage 2/2] prune-backups: improve command description
2020-08-31 8:48 [pve-devel] [PATCH storage 1/2] prune-backups CLI: use keep-options directly Fabian Ebner
@ 2020-08-31 8:48 ` Fabian Ebner
2020-09-03 16:23 ` [pve-devel] applied-series: [PATCH storage 1/2] prune-backups CLI: use keep-options directly Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Fabian Ebner @ 2020-08-31 8:48 UTC (permalink / raw)
To: pve-devel
This is shown in the man page, so it's not important to mention
that this is a wrapper. Also mention the fact that the keep options
from the storage configuration serve as a fallback, which was previously
mentioned in the description of the (now removed) prune-backups parameter.
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
PVE/CLI/pvesm.pm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/PVE/CLI/pvesm.pm b/PVE/CLI/pvesm.pm
index d7591ee..a2246cc 100755
--- a/PVE/CLI/pvesm.pm
+++ b/PVE/CLI/pvesm.pm
@@ -737,7 +737,8 @@ __PACKAGE__->register_method ({
name => 'prunebackups',
path => 'prunebackups',
method => 'GET',
- description => "Prune backups. This is only a wrapper for the proper API endpoints.",
+ description => "Prune backups. Only those using the standard naming scheme are considered. " .
+ "If no keep options are specified, those from the storage configuration are used.",
protected => 1,
proxyto => 'node',
parameters => {
--
2.20.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [pve-devel] applied-series: [PATCH storage 1/2] prune-backups CLI: use keep-options directly
2020-08-31 8:48 [pve-devel] [PATCH storage 1/2] prune-backups CLI: use keep-options directly Fabian Ebner
2020-08-31 8:48 ` [pve-devel] [PATCH storage 2/2] prune-backups: improve command description Fabian Ebner
@ 2020-09-03 16:23 ` Thomas Lamprecht
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2020-09-03 16:23 UTC (permalink / raw)
To: Proxmox VE development discussion, Fabian Ebner
On 31.08.20 10:48, Fabian Ebner wrote:
> Makes the interface cleaner; e.g. --keep-daily=2 instead of
> --prune-backups=keep-daily=2
>
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> PVE/CLI/pvesm.pm | 12 ++++++++----
> PVE/Storage/Plugin.pm | 2 +-
> 2 files changed, 9 insertions(+), 5 deletions(-)
>
>
applied both patches, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-03 16:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-31 8:48 [pve-devel] [PATCH storage 1/2] prune-backups CLI: use keep-options directly Fabian Ebner
2020-08-31 8:48 ` [pve-devel] [PATCH storage 2/2] prune-backups: improve command description Fabian Ebner
2020-09-03 16:23 ` [pve-devel] applied-series: [PATCH storage 1/2] prune-backups CLI: use keep-options directly Thomas Lamprecht
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox