From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id EAEF91FF140 for ; Fri, 27 Mar 2026 16:20:01 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 71D1A1227A; Fri, 27 Mar 2026 16:20:25 +0100 (CET) From: Lukas Wagner To: pve-devel@lists.proxmox.com Subject: [PATCH manager] api: backup: add return schema for backup jobs Date: Fri, 27 Mar 2026 16:20:15 +0100 Message-ID: <20260327152015.394455-1-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1774624769862 X-SPAM-LEVEL: Spam detection results: 0 AWL -1.101 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_MAILER 2 Automated Mailer Tag Left in Email POISEN_SPAM_PILL 0.1 Meta: its spam POISEN_SPAM_PILL_1 0.1 random spam to be learned in bayes POISEN_SPAM_PILL_3 0.1 random spam to be learned in bayes SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: IDNKAMGXOANH7LKA6AIKQVAJHDSR44HZ X-Message-ID-Hash: IDNKAMGXOANH7LKA6AIKQVAJHDSR44HZ X-MailFrom: l.wagner@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The GET /cluster/backup and /cluster/backup/ endpoints were missing a proper return value schema. The schema properties themselves were copied from the POST call, but needed to be slightly adapted. - id is a pve-backup-jobid, since this is what was used before - fleecing, performance and prune-backups are submitted as a property string, but returned as a proper JSON object, so these needed to be overridden from the base config that stems from pve-guest-common - 'next-run' was added Signed-off-by: Lukas Wagner --- PVE/API2/Backup.pm | 79 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 76 insertions(+), 3 deletions(-) diff --git a/PVE/API2/Backup.pm b/PVE/API2/Backup.pm index 27f5a14c..8317d0c3 100644 --- a/PVE/API2/Backup.pm +++ b/PVE/API2/Backup.pm @@ -120,6 +120,80 @@ my $schedule_param_check = sub { delete $param->{dow}; }; +my $backup_job_return_schema = PVE::VZDump::Common::json_config_properties({ + id => get_standard_option('pve-backup-jobid'), + schedule => { + description => "Backup schedule. The format is a subset of `systemd` calendar events.", + type => 'string', + format => 'pve-calendar-event', + maxLength => 128, + optional => 1, + }, + starttime => { + type => 'string', + description => "Job Start time.", + pattern => '\d{1,2}:\d{1,2}', + typetext => 'HH:MM', + optional => 1, + }, + dow => { + type => 'string', + format => 'pve-day-of-week-list', + optional => 1, + description => "Day of week selection.", + requires => 'starttime', + default => ALL_DAYS, + }, + enabled => { + type => 'boolean', + optional => 1, + description => "Enable or disable the job.", + default => '1', + }, + 'repeat-missed' => { + optional => 1, + type => 'boolean', + description => "If true, the job will be run as soon as possible if it was missed" + . " while the scheduler was not running.", + default => 0, + }, + comment => { + optional => 1, + type => 'string', + description => "Description for the Job.", + maxLength => 512, + }, + 'next-run' => { + description => "UNIX timestamp when this backup job will be executed next", + optional => 1, + type => 'integer', + }, +}); + +# 'fleecing', 'prune-backups' and 'performance' are property strings in POST and PUT, but proper +# objects when they are returned from the API, which is why we need to override them here. +$backup_job_return_schema->{'fleecing'} = { + description => "Options for backup fleecing (VM only).", + type => 'object', + optional => 1, + properties => PVE::JSONSchema::get_format('backup-fleecing'), +}; + +$backup_job_return_schema->{'prune-backups'} = { + description => + "Use these retention options instead of those from the storage configuration.", + type => 'object', + optional => 1, + properties => PVE::JSONSchema::get_format('prune-backups'), +}; + +$backup_job_return_schema->{'performance'} = { + description => "Other performance-related settings.", + type => 'object', + optional => 1, + properties => PVE::JSONSchema::get_format('backup-performance'), +}; + __PACKAGE__->register_method({ name => 'index', path => '', @@ -136,9 +210,7 @@ __PACKAGE__->register_method({ type => 'array', items => { type => "object", - properties => { - id => get_standard_option('pve-backup-jobid'), - }, + properties => $backup_job_return_schema, }, links => [{ rel => 'child', href => "{id}" }], }, @@ -309,6 +381,7 @@ __PACKAGE__->register_method({ }, returns => { type => 'object', + properties => $backup_job_return_schema, }, code => sub { my ($param) = @_; -- 2.47.3