pve-manager/PVE/Jobs/VZDump.pm
Thomas Lamprecht 8c791952d5 job manager: run cfs_update before starting a job
we may want to even do this only once, before the loop, but for now
this is basically the same as it was previously but avoids the need
for every (future) plugin to do this manually; which is just the
wrong place.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-13 15:59:32 +01:00

37 lines
846 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) = @_;
my $props = $class->properties();
# remove all non vzdump related options
foreach my $opt (keys %$conf) {
delete $conf->{$opt} if !defined($props->{$opt});
}
# 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;