mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-19 18:21:25 +00:00

like systemd-timers 'persistent'. so that the user can configure it to not be run after powering up when it was previously missed this reverses the default behaviour to not run missed jobs after pvescheduler was started, since most of the time that's not the desired behaviour since we don't use it for updated schedules anymore, rename 'updated_job_schedule' to 'update_last_runtime' Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> Reviewed-by: Fabian Ebner <f.ebner@proxmox.com>
89 lines
1.7 KiB
Perl
89 lines
1.7 KiB
Perl
package PVE::Jobs::VZDump;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use PVE::INotify;
|
|
use PVE::VZDump::Common;
|
|
use PVE::API2::VZDump;
|
|
use PVE::Cluster;
|
|
use PVE::JSONSchema;
|
|
|
|
use base qw(PVE::Jobs::Plugin);
|
|
|
|
sub type {
|
|
return 'vzdump';
|
|
}
|
|
|
|
my $props = PVE::VZDump::Common::json_config_properties();
|
|
|
|
sub properties {
|
|
return $props;
|
|
}
|
|
|
|
sub options {
|
|
my $options = {
|
|
enabled => { optional => 1 },
|
|
schedule => {},
|
|
comment => { optional => 1 },
|
|
'repeat-missed' => { optional => 1 },
|
|
};
|
|
foreach my $opt (keys %$props) {
|
|
if ($props->{$opt}->{optional}) {
|
|
$options->{$opt} = { optional => 1 };
|
|
} else {
|
|
$options->{$opt} = {};
|
|
}
|
|
}
|
|
|
|
return $options;
|
|
}
|
|
|
|
sub decode_value {
|
|
my ($class, $type, $key, $value) = @_;
|
|
|
|
if ($key eq 'prune-backups' && !ref($value)) {
|
|
$value = PVE::JSONSchema::parse_property_string(
|
|
'prune-backups',
|
|
$value,
|
|
);
|
|
}
|
|
|
|
return $value;
|
|
}
|
|
|
|
sub encode_value {
|
|
my ($class, $type, $key, $value) = @_;
|
|
|
|
if ($key eq 'prune-backups' && ref($value) eq 'HASH') {
|
|
$value = PVE::JSONSchema::print_property_string(
|
|
$value,
|
|
'prune-backups',
|
|
);
|
|
}
|
|
|
|
return $value;
|
|
}
|
|
|
|
sub run {
|
|
my ($class, $conf) = @_;
|
|
|
|
# remove all non vzdump related options
|
|
foreach my $opt (keys %$conf) {
|
|
delete $conf->{$opt} if !defined($props->{$opt});
|
|
}
|
|
|
|
my $retention = $conf->{'prune-backups'};
|
|
if ($retention && ref($retention) eq 'HASH') { # fixup, its required as string parameter
|
|
$conf->{'prune-backups'} = PVE::JSONSchema::print_property_string($retention, 'prune-backups');
|
|
}
|
|
|
|
$conf->{quiet} = 1; # do not write to stdout/stderr
|
|
|
|
PVE::Cluster::cfs_update(); # refresh vmlist
|
|
|
|
return PVE::API2::VZDump->vzdump($conf);
|
|
}
|
|
|
|
1;
|