]> git.proxmox.com Git - pve-manager.git/blobdiff - PVE/VZDump.pm
api: backup/vzdump: add get_storage_param helper
[pve-manager.git] / PVE / VZDump.pm
index 64a5fd4fca6f2b6242f2bccf2ac6ad9eea4a8547..c58e5f78fcbd1cab77543410500d88e3fb84f896 100644 (file)
@@ -55,6 +55,13 @@ foreach my $plug (@pve_vzdump_classes) {
     }
 }
 
+sub get_storage_param {
+    my ($param) = @_;
+
+    return if $param->{dumpdir};
+    return $param->{storage} || 'local';
+}
+
 # helper functions
 
 sub debugmsg {
@@ -567,8 +574,8 @@ sub new {
        die "cannot use options 'storage' and 'dumpdir' at the same time\n";
     }
 
-    if (!$opts->{dumpdir} && !$opts->{storage}) {
-       $opts->{storage} = 'local';
+    if (my $storage = get_storage_param($opts)) {
+       $opts->{storage} = $storage;
     }
 
     # Enforced by the API too, but these options might come in via defaults. Drop them if necessary.