]> git.proxmox.com Git - pve-manager.git/commitdiff
vzdump: move restricted API parameters check
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 12 Oct 2016 13:30:20 +0000 (15:30 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 12 Oct 2016 15:30:45 +0000 (17:30 +0200)
for better visibility and earlier error detection

PVE/API2/VZDump.pm

index 6a760962acbcfd8470d94152bbac35a7794f97ce..8767aa2ffa042a074eec78f87cfa0360e2491104 100644 (file)
@@ -56,6 +56,11 @@ __PACKAGE__->register_method ({
                if $param->{stdout};
        }
 
+       foreach my $key (qw(maxfiles tmpdir dumpdir script bwlimit ionice)) {
+           raise_param_exc({ $key => "Only root may set this option."})
+               if defined($param->{$key}) && ($user ne 'root@pam');
+       }
+
        # by default we set --rsyncable for gzip
        local $ENV{GZIP} = "--rsyncable" if !$ENV{GZIP};
 
@@ -112,11 +117,6 @@ __PACKAGE__->register_method ({
        die "you can only backup a single VM with option --stdout\n"
            if $param->{stdout} && scalar(@vmids) != 1;
 
-       foreach my $key (qw(maxfiles tmpdir dumpdir script bwlimit ionice)) {
-           raise_param_exc({ $key => "Only root may set this option."})
-               if defined($param->{$key}) && ($user ne 'root@pam');        
-       }
-
        $rpcenv->check($user, "/storage/$param->{storage}", [ 'Datastore.AllocateSpace' ])
            if $param->{storage};