[pve-devel] r5507 - pve-storage/pve2/PVE/API2/Storage

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Feb 11 10:37:26 CET 2011


Author: dietmar
Date: 2011-02-11 10:37:26 +0100 (Fri, 11 Feb 2011)
New Revision: 5507

Modified:
   pve-storage/pve2/PVE/API2/Storage/Status.pm
Log:


Modified: pve-storage/pve2/PVE/API2/Storage/Status.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Status.pm	2011-02-11 07:15:53 UTC (rev 5506)
+++ pve-storage/pve2/PVE/API2/Storage/Status.pm	2011-02-11 09:37:26 UTC (rev 5507)
@@ -9,6 +9,7 @@
 use PVE::RESTHandler;
 use PVE::RPCEnvironment;
 use PVE::JSONSchema qw(get_standard_option);
+use PVE::Exception qw(raise_param_exc);
 
 use base qw(PVE::RESTHandler);
 
@@ -31,6 +32,11 @@
     	additionalProperties => 0,
 	properties => {
 	    node => get_standard_option('pve-node'),
+	    storage => get_standard_option
+		('pve-storage-id', {
+		    description => "Only list status for  specified storage",
+		    optional => 1,
+		 }),
 	},
     },
     returns => {
@@ -48,6 +54,16 @@
 
 	my $info = PVE::Storage::storage_info ($cfg);
 
+	if ($param->{storage}) {
+	    my $data = $info->{$param->{storage}};
+
+	    raise_param_exc({ storage => "No such storage." })
+		if !defined($data);
+
+	    $data->{storage} = $param->{storage};
+
+	    return [ $data ];
+	}
 	return PVE::RESTHandler::hash_to_array($info, 'storage');
     }});
 




More information about the pve-devel mailing list