mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-22 00:59:47 +00:00

this adds a SectionConfig handling for jobs (only 'vzdump' for now) that represents a job that will be handled by pvescheduler and a basic 'job-state' handling for reading/writing state json files this has some intersections with pvesrs state handling, but does not use a single state file for all jobs, but seperate ones, like we do it in the backup-server. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
55 lines
919 B
Perl
55 lines
919 B
Perl
package PVE::Jobs::VZDump;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
use PVE::INotify;
|
|
use PVE::VZDump::Common;
|
|
use PVE::API2::VZDump;
|
|
use PVE::Cluster;
|
|
|
|
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 => {},
|
|
};
|
|
foreach my $opt (keys %$props) {
|
|
if ($props->{$opt}->{optional}) {
|
|
$options->{$opt} = { optional => 1 };
|
|
} else {
|
|
$options->{$opt} = {};
|
|
}
|
|
}
|
|
|
|
return $options;
|
|
}
|
|
|
|
sub run {
|
|
my ($class, $conf) = @_;
|
|
|
|
# remove all non vzdump related options
|
|
foreach my $opt (keys %$conf) {
|
|
delete $conf->{$opt} if !defined($props->{$opt});
|
|
}
|
|
|
|
$conf->{quiet} = 1; # do not write to stdout/stderr
|
|
|
|
PVE::Cluster::cfs_update(); # refresh vmlist
|
|
|
|
return PVE::API2::VZDump->vzdump($conf);
|
|
}
|
|
|
|
1;
|