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

svn-commits at proxmox.com svn-commits at proxmox.com
Fri Aug 20 12:43:35 CEST 2010


Author: dietmar
Date: 2010-08-20 10:43:35 +0000 (Fri, 20 Aug 2010)
New Revision: 5040

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


Modified: pve-storage/pve2/PVE/API2/Storage/Content.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Content.pm	2010-08-20 10:19:25 UTC (rev 5039)
+++ pve-storage/pve2/PVE/API2/Storage/Content.pm	2010-08-20 10:43:35 UTC (rev 5040)
@@ -336,7 +336,7 @@
 		type => 'string', 
 	    },
 	    move => {
-		destriction => "Delete source after copy",
+		description => "Delete source after copy",
 		type => 'boolean',
 	    }
 	},

Modified: pve-storage/pve2/PVE/API2/Storage/Scan.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Scan.pm	2010-08-20 10:19:25 UTC (rev 5039)
+++ pve-storage/pve2/PVE/API2/Storage/Scan.pm	2010-08-20 10:43:35 UTC (rev 5040)
@@ -4,7 +4,7 @@
 use warnings;
 
 use PVE::SafeSyslog;
-use PVE::INotify qw(read_file write_file);;
+use PVE::INotify qw(read_file);;
 use PVE::Storage;
 use HTTP::Status qw(:constants);
 
@@ -41,9 +41,10 @@
 	return $res;
     }});
 
+# fixme: return value ?
 __PACKAGE__->register_method ({
     name => 'scan', 
-    path => '{method}', 
+    path => '{method:(lvm|iscsi|nfs)}', 
     method => 'GET',
     description => "Scan remote storage server.",
     parameters => {
@@ -52,14 +53,33 @@
 	    method => { 
 		type => 'string',
 		enum => [ 'lvm', 'nfs', 'iscsi' ],
-	    }
+	    },
+	    server => { type => 'string', format => 'pve-storage-server' },
+	    node => { 
+		type => 'string', format => 'pve-node',
+		optional => 1,
+	    },
 	},
     },
     returns => {},
     code => sub {
 	my ($conn, $param) = @_;
 
-	return [];
+	# fixme: proxy to node if requested
+
+	my $server = $param->{server};
+	my $method = $param->{method};
+
+	my $res;
+	if ($method eq 'nfs') {
+	    $res = PVE::Storage::scan_nfs ($server);
+	} elsif ($method eq 'iscsi') {
+	    $res = PVE::Storage::scan_iscsi ($server);
+	} else {
+	    die "can't execute scan for storage type '$method'\n";
+	}
+
+	return $res;
     }});
 
 1;




More information about the pve-devel mailing list