[pve-devel] r5435 - in pve-storage/pve2: . PVE PVE/API2 PVE/API2/Storage

svn-commits at proxmox.com svn-commits at proxmox.com
Tue Jan 25 10:00:24 CET 2011


Author: dietmar
Date: 2011-01-25 10:00:24 +0100 (Tue, 25 Jan 2011)
New Revision: 5435

Modified:
   pve-storage/pve2/PVE/API2/Storage.pm
   pve-storage/pve2/PVE/API2/Storage/Config.pm
   pve-storage/pve2/PVE/API2/Storage/Content.pm
   pve-storage/pve2/PVE/API2/Storage/Scan.pm
   pve-storage/pve2/PVE/API2/Storage/Status.pm
   pve-storage/pve2/PVE/Storage.pm
   pve-storage/pve2/pvesm
Log:
try to use get_standard_option everywhere


Modified: pve-storage/pve2/PVE/API2/Storage/Config.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Config.pm	2011-01-25 07:48:59 UTC (rev 5434)
+++ pve-storage/pve2/PVE/API2/Storage/Config.pm	2011-01-25 09:00:24 UTC (rev 5435)
@@ -8,6 +8,7 @@
 use PVE::Storage;
 use HTTP::Status qw(:constants);
 use Storable qw(dclone);
+use PVE::JSONSchema qw(get_standard_option);
 
 use Data::Dumper; # fixme: remove
 
@@ -81,7 +82,7 @@
     parameters => {
     	additionalProperties => 0,
 	properties => {
-	    storage => { type => 'string', format => 'pve-storage-id' },
+	    storage => get_standard_option('pve-storage-id'),
 	},
     },
     returns => {},
@@ -102,7 +103,7 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    storage => { type => 'string', format => 'pve-storage-id' },
+	    storage => get_standard_option('pve-storage-id'),
 	    type => { 
 		type => 'string', 
 		enum => $storage_type_enum,
@@ -210,7 +211,7 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    storage => { type => 'string', format => 'pve-storage-id' },
+	    storage => get_standard_option('pve-storage-id'),
 	    content => {
 		type => 'string', format => 'pve-storage-content-list',
 		optional => 1,
@@ -287,7 +288,7 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    storage => { type => 'string', format => 'pve-storage-id' },
+	    storage => get_standard_option('pve-storage-id'),
 	},
     },
     returns => { type => 'null' },

Modified: pve-storage/pve2/PVE/API2/Storage/Content.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Content.pm	2011-01-25 07:48:59 UTC (rev 5434)
+++ pve-storage/pve2/PVE/API2/Storage/Content.pm	2011-01-25 09:00:24 UTC (rev 5435)
@@ -9,6 +9,7 @@
 use PVE::Exception qw(raise_param_exc);
 use PVE::RPCEnvironment;
 use PVE::RESTHandler;
+use PVE::JSONSchema qw(get_standard_option);
 
 use base qw(PVE::RESTHandler);
 
@@ -23,8 +24,8 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    node => { type => 'string', format => 'pve-node' },
-	    storage => { type => 'string',  format => 'pve-storage-id' },
+	    node => get_standard_option('pve-node'),
+	    storage => get_standard_option('pve-storage-id'),
 	    content => { 
 		description => "Only list content of this type.",
 		type => 'string', format => 'pve-storage-content',
@@ -94,8 +95,8 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    node => { type => 'string', format => 'pve-node' },
-	    storage => { type => 'string',  format => 'pve-storage-id' },
+	    node => get_standard_option('pve-node'),
+	    storage => get_standard_option('pve-storage-id'),
 	    filename => { 
 		description => "The name of the file to create/upload.",
 		type => 'string',
@@ -201,11 +202,8 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    node => { type => 'string', format => 'pve-node' },
-	    storage => { 
-		type => 'string', format => 'pve-storage-id',
-		optional => 1,
-	    },
+	    node => get_standard_option('pve-node'),
+	    storage => get_standard_option('pve-storage-id', { optional => 1 }),
 	    volume => {
 		description => "Volume identifier",
 		type => 'string', 
@@ -242,11 +240,8 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    node => { type => 'string', format => 'pve-node' },
-	    storage => { 
-		type => 'string', format => 'pve-storage-id',
-		optional => 1,
-	    },
+	    node => get_standard_option('pve-node'),
+	    storage => get_standard_option('pve-storage-id', { optional => 1}),
 	    volume => {
 		description => "Volume identifier",
 		type => 'string', 
@@ -278,15 +273,9 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    node => { type => 'string', format => 'pve-node' },
-	    sourceNode => {
-		type => 'string', format => 'pve-node',
-		optional => 1,
-	    },
-	    storage => { 
-		type => 'string', format => 'pve-storage-id',
-		optional => 1,
-	    },
+	    node => get_standard_option('pve-node'),
+	    sourceNode => get_standard_option('pve-node', { optional => 1}),
+	    storage => get_standard_option('pve-storage-id', { optional => 1}),
 	    volume => {
 		description => "Volume identifier",
 		type => 'string', 
@@ -331,6 +320,7 @@
 use PVE::SafeSyslog;
 use PVE::INotify qw(read_file);;
 use PVE::Storage;
+use PVE::JSONSchema qw(get_standard_option);
 
 use PVE::RESTHandler;
 
@@ -354,7 +344,7 @@
     parameters => {
     	additionalProperties => 0,
 	properties => {
-	    node => { type => 'string', format => 'pve-node' },
+	    node => get_standard_option('pve-node'),
 	},
     },
     returns => {

Modified: pve-storage/pve2/PVE/API2/Storage/Scan.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Scan.pm	2011-01-25 07:48:59 UTC (rev 5434)
+++ pve-storage/pve2/PVE/API2/Storage/Scan.pm	2011-01-25 09:00:24 UTC (rev 5435)
@@ -7,6 +7,7 @@
 use PVE::INotify qw(read_file);;
 use PVE::Storage;
 use HTTP::Status qw(:constants);
+use PVE::JSONSchema qw(get_standard_option);
 
 use PVE::RESTHandler;
 
@@ -55,10 +56,7 @@
 		enum => [ 'lvm', 'nfs', 'iscsi' ],
 	    },
 	    server => { type => 'string', format => 'pve-storage-server' },
-	    node => { 
-		type => 'string', format => 'pve-node',
-		optional => 1,
-	    },
+	    node => get_standard_option('pve-node', { optional => 1 }),
 	},
     },
     returns => {},

Modified: pve-storage/pve2/PVE/API2/Storage/Status.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Status.pm	2011-01-25 07:48:59 UTC (rev 5434)
+++ pve-storage/pve2/PVE/API2/Storage/Status.pm	2011-01-25 09:00:24 UTC (rev 5435)
@@ -7,6 +7,7 @@
 use PVE::Storage;
 use PVE::RESTHandler;
 use PVE::RPCEnvironment;
+use PVE::JSONSchema qw(get_standard_option);
 
 use base qw(PVE::RESTHandler);
 
@@ -22,7 +23,7 @@
     parameters => {
     	additionalProperties => 0,
 	properties => {
-	    node => { type => 'string', format => 'pve-node' },
+	    node => get_standard_option('pve-node'),
 	},
     },
     returns => {
@@ -60,8 +61,8 @@
     parameters => {
     	additionalProperties => 0,
 	properties => {
-	    node => { type => 'string', format => 'pve-node' },
-	    storage => { type => 'string',  format => 'pve-storage-id' },
+	    node => get_standard_option('pve-node'),
+	    storage => get_standard_option('pve-storage-id'),
 	},
     },
     returns => {},

Modified: pve-storage/pve2/PVE/API2/Storage.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage.pm	2011-01-25 07:48:59 UTC (rev 5434)
+++ pve-storage/pve2/PVE/API2/Storage.pm	2011-01-25 09:00:24 UTC (rev 5435)
@@ -4,6 +4,7 @@
 use warnings;
 
 use PVE::SafeSyslog;
+use PVE::JSONSchema qw(get_standard_option);
 use PVE::INotify qw(read_file write_file);;
 use PVE::Storage;
 use HTTP::Status qw(:constants);
@@ -133,8 +134,8 @@
     parameters => {
     	additionalProperties => 0,
 	properties => { 
-	    node => { type => 'string', format => 'pve-node' },
-	    storage => { type => 'string',  format => 'pve-storage-id' },
+	    node => get_standard_option('pve-node'),
+	    storage => get_standard_option('pve-storage-id'),
 	    filename => { 
 		description => "The name of the file to create/upload.",
 		type => 'string',

Modified: pve-storage/pve2/PVE/Storage.pm
===================================================================
--- pve-storage/pve2/PVE/Storage.pm	2011-01-25 07:48:59 UTC (rev 5434)
+++ pve-storage/pve2/PVE/Storage.pm	2011-01-25 09:00:24 UTC (rev 5435)
@@ -1114,6 +1114,11 @@
     return $storeid;
 }
 
+PVE::JSONSchema::register_standard_option('pve-storage-id', {
+    description => "The storage identifier.",
+    type => 'string', format => 'pve-storage-id',
+}); 
+
 PVE::JSONSchema::register_format('pve-storage-vgname', \&parse_lvm_name);
 sub parse_lvm_name {
     my ($name, $noerr) = @_;

Modified: pve-storage/pve2/pvesm
===================================================================
--- pve-storage/pve2/pvesm	2011-01-25 07:48:59 UTC (rev 5434)
+++ pve-storage/pve2/pvesm	2011-01-25 09:00:24 UTC (rev 5435)
@@ -12,6 +12,7 @@
 use PVE::API2::Storage::Content;
 use PVE::API2::Storage::Status;
 use PVE::API2::Storage::Scan;
+use PVE::JSONSchema qw(get_standard_option);
 
 use PVE::CLIHandler;
 
@@ -66,9 +67,7 @@
     parameters => {
     	additionalProperties => 0,
 	properties => {
-	    storage => { 
-		type => 'string', format => 'pve-storage-id',
-	    },
+	    storage => get_standard_option('pve-storage-id'),
 	    timeout => {
 		type => 'integer',
 		minimum => 1,




More information about the pve-devel mailing list