mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-10-04 07:48:57 +00:00

This allows us to access the backup job id in the send_notification function, where we can set it as metadata for the notification. The 'job-id' parameter can only be used by 'root@pam' to prevent abuse. This has the side effect that manually triggered backup jobs cannot have the 'job-id' parameter at the moment. To mitigate that, manually triggered backup jobs could be changed so that they are not performed by a direct API call by the UI, but by requesting pvescheduler to execute the job in the near future (similar to how manually triggered replication jobs work). Signed-off-by: Lukas Wagner <l.wagner@proxmox.com> Reviewed-by: Max Carrara <m.carrara@proxmox.com> [ TL: fleece in d/control bump for guest-common now that the version is known ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
39 lines
889 B
Perl
39 lines
889 B
Perl
package PVE::Jobs::VZDump;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use PVE::JSONSchema;
|
|
|
|
use PVE::VZDump::Common;
|
|
|
|
use PVE::API2::VZDump;
|
|
|
|
use base qw(PVE::VZDump::JobBase);
|
|
|
|
sub run {
|
|
my ($class, $conf, $job_id) = @_;
|
|
|
|
my $props = $class->properties();
|
|
# remove all non vzdump related options
|
|
foreach my $opt (keys %$conf) {
|
|
delete $conf->{$opt} if !defined($props->{$opt});
|
|
}
|
|
|
|
$conf->{'job-id'} = $job_id;
|
|
|
|
# Required as string parameters # FIXME why?! we could just check ref()
|
|
for my $key (keys $PVE::VZDump::Common::PROPERTY_STRINGS->%*) {
|
|
if ($conf->{$key} && ref($conf->{$key}) eq 'HASH') {
|
|
my $format = $PVE::VZDump::Common::PROPERTY_STRINGS->{$key};
|
|
$conf->{$key} = PVE::JSONSchema::print_property_string($conf->{$key}, $format);
|
|
}
|
|
}
|
|
|
|
$conf->{quiet} = 1; # do not write to stdout/stderr
|
|
|
|
return PVE::API2::VZDump->vzdump($conf);
|
|
}
|
|
|
|
1;
|