public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/2] fix #5731: vzdump jobs: fix execution of converted jobs
Date: Fri, 20 Sep 2024 11:05:06 +0200	[thread overview]
Message-ID: <20240920090506.231780-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20240920090506.231780-1-f.gruenbichler@proxmox.com>

jobs converted from vzdump.cron have an ID of the format

$digest:$counter

where $digest is the hash of the vzdump.cron file, and $counter is the position
of the job within the crontab.

 while the section config schema pretends jobs.cfg's section IDs are of type
pve-configid, that is not enforced anywhere, and the API endpoints managing
such jobs allowed arbitrary strings in the past.

the ':' character is not allowed by `pve-configid`, but it is by the section
config parsers and the Job API.

convert the API schema to use the unification of previous definition used by
the job API, and what the section config parser accepts.

Fixes: f5a97f1f5 (api: jobs: vzdump: pass job 'job-id' parameter)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 PVE/API2/VZDump.pm | 7 ++-----
 PVE/VZDump.pm      | 1 +
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/PVE/API2/VZDump.pm b/PVE/API2/VZDump.pm
index 15c9b0dcd..6fcac5ba7 100644
--- a/PVE/API2/VZDump.pm
+++ b/PVE/API2/VZDump.pm
@@ -53,15 +53,12 @@ __PACKAGE__->register_method ({
     parameters => {
 	additionalProperties => 0,
 	properties => PVE::VZDump::Common::json_config_properties({
-	    'job-id' => {
+	    'job-id' => get_standard_option('pve-backup-jobid', {
 		description => "The ID of the backup job. If set, the 'backup-job' metadata field"
 		    . " of the backup notification will be set to this value. Only root\@pam"
 		    . " can set this parameter.",
-		type => 'string',
-		format => 'pve-configid',
-		maxLength => 256,
 		optional => 1,
-	    },
+	    }),
 	    stdout => {
 		type => 'boolean',
 		description => "Write tar to stdout, not to a file.",
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index f813bba60..861ccddd0 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -35,6 +35,7 @@ PVE::JSONSchema::register_standard_option('pve-backup-jobid', {
     type => 'string',
     description => "The job ID.",
     maxLength => 50,
+    pattern => '\S+',
 });
 
 my @posix_filesystems = qw(ext3 ext4 nfs nfs4 reiserfs xfs);
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

      reply	other threads:[~2024-09-20  9:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20  9:05 [pve-devel] [PATCH manager 1/2] vzdump jobs: make job ID a standard option Fabian Grünbichler
2024-09-20  9:05 ` Fabian Grünbichler [this message]

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=20240920090506.231780-2-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal