]> git.proxmox.com Git - pve-storage.git/blobdiff - PVE/API2/Storage/Status.pm
add newline to error message
[pve-storage.git] / PVE / API2 / Storage / Status.pm
index 9e5790a6301813d08854cbb2611aad1832d3b939..c4b6035633b74f425546762eb4b565ab44b8ad5a 100644 (file)
@@ -76,6 +76,7 @@ __PACKAGE__->register_method ({
        my $res = {};
        my @sids = PVE::Storage::storage_ids($cfg);
        foreach my $storeid (@sids) {
+           next if !$info->{$storeid};
            my $privs = [ 'Datastore.Audit', 'Datastore.AllocateSpace' ];
            next if !$rpcenv->check_any($authuser, "/storage/$storeid", $privs, 1);
            next if $param->{storage} && $param->{storage} ne $storeid;
@@ -250,13 +251,15 @@ __PACKAGE__->register_method ({
            $param->{timeframe}, $param->{cf});       
     }});
 
+# makes no sense for big images and backup files (because it 
+# create a copy of the file).
 __PACKAGE__->register_method ({
     name => 'upload',
     path => '{storage}/upload', 
     method => 'POST',
-    description => "Upload file.",
+    description => "Upload templates and ISO images.",
     permissions => { 
-       check => ['perm', '/storage/{storage}', ['Datastore.AllocateSpace']],
+       check => ['perm', '/storage/{storage}', ['Datastore.AllocateTemplate']],
     },
     protected => 1,
     parameters => {
@@ -292,7 +295,7 @@ __PACKAGE__->register_method ({
        my $node = $param->{node};
        my $scfg = PVE::Storage::storage_check_enabled($cfg, $param->{storage}, $node);
 
-       die "cant upload to storage type '$scfg->{type}'" 
+       die "cant upload to storage type '$scfg->{type}'\n
            if !($scfg->{type} eq 'dir' || $scfg->{type} eq 'nfs');
 
        my $content = $param->{content};
@@ -321,13 +324,8 @@ __PACKAGE__->register_method ({
                raise_param_exc({ filename => "missing '.tar.gz' extension" });
            }
            $path = PVE::Storage::get_vztmpl_dir($cfg, $param->{storage});
-       } elsif ($content eq 'backup') {
-           if ($filename !~  m!/([^/]+\.(tar|tgz))$!) {
-               raise_param_exc({ filename => "missing '.(tar|tgz)' extension" });
-           }
-           $path = PVE::Storage::get_backup_dir($cfg, $param->{storage});
        } else {
-           raise_param_exc({ content => "upload content type '$content' not implemented" });
+           raise_param_exc({ content => "upload content type '$content' not allowed" });
        }
 
        die "storage '$param->{storage}' does not support '$content' content\n"