From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH storage 1/2] prune-backups CLI: use keep-options directly
Date: Mon, 31 Aug 2020 10:48:01 +0200 [thread overview]
Message-ID: <20200831084802.25887-1-f.ebner@proxmox.com> (raw)
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
next reply other threads:[~2020-08-31 8:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-31 8:48 Fabian Ebner [this message]
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
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=20200831084802.25887-1-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.