mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-07-16 17:40:11 +00:00

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>
37 lines
846 B
Perl
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;
|