[pve-devel] r5919 - in pve-storage/pve2/PVE: . API2/Storage
svn-commits at proxmox.com
svn-commits at proxmox.com
Fri May 6 13:42:01 CEST 2011
Author: dietmar
Date: 2011-05-06 13:42:01 +0200 (Fri, 06 May 2011)
New Revision: 5919
Modified:
pve-storage/pve2/PVE/API2/Storage/Status.pm
pve-storage/pve2/PVE/Storage.pm
Log:
impl. content filter
Modified: pve-storage/pve2/PVE/API2/Storage/Status.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Status.pm 2011-05-06 11:23:48 UTC (rev 5918)
+++ pve-storage/pve2/PVE/API2/Storage/Status.pm 2011-05-06 11:42:01 UTC (rev 5919)
@@ -37,6 +37,11 @@
description => "Only list status for specified storage",
optional => 1,
}),
+ content => {
+ description => "Only list stores which support this content type.",
+ type => 'string', format => 'pve-storage-content',
+ optional => 1,
+ },
},
},
returns => {
@@ -52,7 +57,7 @@
my $cfg = cfs_read_file("storage.cfg");
- my $info = PVE::Storage::storage_info ($cfg);
+ my $info = PVE::Storage::storage_info($cfg, $param->{content});
if ($param->{storage}) {
my $data = $info->{$param->{storage}};
Modified: pve-storage/pve2/PVE/Storage.pm
===================================================================
--- pve-storage/pve2/PVE/Storage.pm 2011-05-06 11:23:48 UTC (rev 5918)
+++ pve-storage/pve2/PVE/Storage.pm 2011-05-06 11:42:01 UTC (rev 5919)
@@ -1956,7 +1956,7 @@
}
sub storage_info {
- my ($cfg) = @_;
+ my ($cfg, $content) = @_;
my $ids = $cfg->{ids};
@@ -1966,6 +1966,8 @@
my $slist = [];
foreach my $storeid (keys %$ids) {
+ next if $content && !$ids->{$storeid}->{content}->{$content};
+
my $type = $ids->{$storeid}->{type};
$info->{$storeid} = {
@@ -1978,7 +1980,7 @@
active => 0,
};
- next if $ids->{$storeid}->{disable};
+ next if $info->{$storeid}->{disable};
$stypes->{$type} = 1;
@@ -2010,6 +2012,8 @@
foreach my $storeid (keys %$ids) {
my $scfg = $ids->{$storeid};
+ next if !$info->{$storeid} || $info->{$storeid}->{disable};
+
my $type = $scfg->{type};
if ($type eq 'dir' || $type eq 'nfs') {
More information about the pve-devel
mailing list