From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 8762C61844
 for <pve-devel@lists.proxmox.com>; Thu,  9 Jul 2020 14:46:29 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 7D37E128D3
 for <pve-devel@lists.proxmox.com>; Thu,  9 Jul 2020 14:45:59 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id C64C112863
 for <pve-devel@lists.proxmox.com>; Thu,  9 Jul 2020 14:45:55 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 8D0E8444B6
 for <pve-devel@lists.proxmox.com>; Thu,  9 Jul 2020 14:45:55 +0200 (CEST)
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Thu,  9 Jul 2020 14:45:40 +0200
Message-Id: <20200709124547.2913-1-f.ebner@proxmox.com>
X-Mailer: git-send-email 2.20.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.200 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: [pve-devel] [PATCH-SERIES v4] fix #2649: introduce prune-backups
 property for storages supporting backups
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 09 Jul 2020 12:46:29 -0000

A new 'prune-backups' option is introduced for storages as well as for vzdump

Patches #1-#3 introduces prune-backups in the backend
Patch #4 introduces the new vzdump parameter
Patch #6 is the 'real' change needed for vzdump.
Patch #7 gets rid of 'maxfiles' internally, re-using 'prune-backups' instead.


Changes from v3:
    * Error handling for the prune_backup functions, to allow
      pruning other groups if one fails
    * Allow passing a logfunc in prune_backups (useful for vzdump)
    * Use new property string validation
    * Make prune-backups also a vzdump option
    * Introduce a wrapper for pvesm prune-backups and redirect call
      to API according to --dry-run
    * Also allow filtering by type
    * prune_mark: merge loops
    * Add more tests

Non-standard backups are ignored when pruning. I chose 'protected'
to mark those, 'ignore' could also be used. Backups are grouped
by type+ID.

The backup type from PBS is translated: ct->lxc, vm->qemu, so that the
possible values for the API result don't depend on the backend.

Dependency bumps 'manager -> storage' and 'manager -> guest-common -> storage' are needed


storage:

Fabian Ebner (3):
  Introduce prune-backups property for directory-based storages
  Add prune_backups to storage API
  Add API and pvesm call for prune_backups

 PVE/API2/Storage/Makefile        |   2 +-
 PVE/API2/Storage/PruneBackups.pm | 164 +++++++++++++++
 PVE/API2/Storage/Status.pm       |   7 +
 PVE/CLI/pvesm.pm                 | 126 ++++++++++++
 PVE/Storage.pm                   |  91 +++++++-
 PVE/Storage/CIFSPlugin.pm        |   1 +
 PVE/Storage/CephFSPlugin.pm      |   1 +
 PVE/Storage/DirPlugin.pm         |   5 +-
 PVE/Storage/GlusterfsPlugin.pm   |   5 +-
 PVE/Storage/NFSPlugin.pm         |   5 +-
 PVE/Storage/PBSPlugin.pm         |  69 +++++++
 PVE/Storage/Plugin.pm            | 124 ++++++++++-
 test/prune_backups_test.pm       | 342 +++++++++++++++++++++++++++++++
 test/run_plugin_tests.pl         |   1 +
 14 files changed, 933 insertions(+), 10 deletions(-)
 create mode 100644 PVE/API2/Storage/PruneBackups.pm
 create mode 100644 test/prune_backups_test.pm


guest-common:

Fabian Ebner (1):
  Add prune-backups option to vzdump parameters

 PVE/VZDump/Common.pm | 4 ++++
 1 file changed, 4 insertions(+)


manager:

Fabian Ebner (3):
  make use of archive_info and archive_remove
  Allow prune-backups as an alternative to maxfiles
  Always use prune-backups instead of maxfiles internally

 PVE/API2/VZDump.pm |  4 +-
 PVE/VZDump.pm      | 93 ++++++++++++++++++++++++++++++----------------
 2 files changed, 63 insertions(+), 34 deletions(-)

-- 
2.20.1