all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Lukas Wagner <l.wagner@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH manager] api: backup: add return schema for backup jobs
Date: Wed, 1 Apr 2026 13:46:35 +0200	[thread overview]
Message-ID: <74884b81-1438-4487-956c-f23982d820af@proxmox.com> (raw)
In-Reply-To: <DHHQCKD4UHAC.2OC3H1FV7SRKI@proxmox.com>

Am 01.04.26 um 12:00 schrieb Lukas Wagner:
>>> +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,
>>> +    },
>> I'd apply this with the following on-top or squashed-in, ack?

Hmm, we might actually just drop above two legacy fields here (soon).

As for the modern jobs.cfg (based on PVE::Job::Registry in pve-common) we do not
have them anymore at all, AFAICT, so those are only possible for the old CRON
based vzdump.cron, and those we map in the API endpoint via:

 my $data = cfs_read_file('vzdump.cron');
 
 my $res = $data->{jobs} || [];                      
 foreach my $job (@$res) {
     $job->{schedule} = $convert_to_schedule->($job);
 }

The convert_to_schedule method keeps the current starttime/dow params, but the
API contract now is basically, dow and starttime might be there, if a vzdum.cron
still exists and nobody updated/added/removed any backup job since a while, as
that would convert them to the modern jobs.cfg, having keept the old vzdump.cron
only around to ensure that PVE nodes with older pve-mananger in a cluster still
handle pre-existing backup old-style jobs correctly.
But that was introduced mostly in commit 305921b1a ("api/backup: handle new
vzdump jobs") [0] back in PVE 7.1 days, so we probably can just drop that, and
we probably also do not need to wait until a next major release, as vzdum.cron
cannot really be used anymore in practice (besides manual editing, which I do
not care that much for). And for the backup job API response it's rather a clear
cut, schedule is _always_ present, starttime/dow basically never, and all (API)
clients need to cope with schedule since PVE 7.1, so dropping it from the return
schema and (not a must, but nicer) deleting them from the response should be fine.

I know, it's a bit annoying to have those legacy ghosts in scope for such
patches, but it has some value to clean a few of them up when they resurface,
especially when doing this with the end goal of encoding such types in rust in
pve-api-types for use with PDM, as all legacy cruft we can safely shave off can
make our life simpler.

[0]: https://git.proxmox.com/?p=pve-manager.git;a=commitdiff;h=305921b1a




  reply	other threads:[~2026-04-01 11:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-27 15:20 Lukas Wagner
2026-04-01  9:55 ` Thomas Lamprecht
2026-04-01 10:01   ` Lukas Wagner
2026-04-01 11:46     ` Thomas Lamprecht [this message]
2026-04-01 14:11       ` Lukas Wagner
2026-04-01 11:47 ` 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=74884b81-1438-4487-956c-f23982d820af@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=l.wagner@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal