[pve-devel] r5038 - pve-storage/pve2/PVE/API2/Storage
svn-commits at proxmox.com
svn-commits at proxmox.com
Fri Aug 20 11:48:42 CEST 2010
Author: dietmar
Date: 2010-08-20 09:48:42 +0000 (Fri, 20 Aug 2010)
New Revision: 5038
Modified:
pve-storage/pve2/PVE/API2/Storage/Content.pm
Log:
add dummy for copy/move
Modified: pve-storage/pve2/PVE/API2/Storage/Content.pm
===================================================================
--- pve-storage/pve2/PVE/API2/Storage/Content.pm 2010-08-20 09:24:50 UTC (rev 5037)
+++ pve-storage/pve2/PVE/API2/Storage/Content.pm 2010-08-20 09:48:42 UTC (rev 5038)
@@ -248,7 +248,7 @@
},
volume => {
description => "Volume identifier",
- type => 'string'
+ type => 'string',
},
},
},
@@ -271,9 +271,8 @@
size => $size,
used => $used,
};
-}});
+ }});
-
__PACKAGE__->register_method ({
name => 'delete',
protected => 1,
@@ -290,7 +289,7 @@
},
volume => {
description => "Volume identifier",
- type => 'string'
+ type => 'string',
},
},
},
@@ -299,16 +298,71 @@
my ($conn, $param) = @_;
# fixme: connect to node
-
+
my $volid = &$real_volume_id($param->{storage}, $param->{volume});
-
+
my $cfg = read_file('storagecfg');
PVE::Storage::vdisk_free ($cfg, $volid);
return undef;
-}});
+ }});
+# fixme: the following method can be use to implement copy/move/migrate/convert
+__PACKAGE__->register_method ({
+ name => 'copy',
+ protected => 1,
+ path => '{volume}',
+ method => 'POST',
+ description => "Create copy of existing volume",
+ 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,
+ },
+ volume => {
+ description => "Volume identifier",
+ type => 'string',
+ },
+ source => {
+ description => "Volume identifier",
+ type => 'string',
+ },
+ move => {
+ destriction => "Delete source after copy",
+ type => 'boolean',
+ }
+ },
+ },
+ returns => { type => 'string' },
+ code => sub {
+ my ($conn, $param) = @_;
+
+ # fixme: connect to node
+
+ $param->{sourceNode} = $param->{node} if !$param->{sourceNode};
+
+ my $volid = &$real_volume_id($param->{storage}, $param->{volume});
+
+ eval { PVE::Storage::parse_volume_id ($param->{source}); };
+ raise_param_exc({ source => $@}) if $@;
+
+ my $cfg = read_file('storagecfg');
+
+ # fixme: execute in background
+ print "COPY $param->{source} from node $param->{sourceNode} to $volid\n";
+
+ # fixme: return taskID ?
+ return "implement me";
+ }});
+
package PVE::API2::Storage::ContentIDList;
use strict;
More information about the pve-devel
mailing list