[pve-devel] [PATCH 1/8] storage : add volume_clone
Alexandre Derumier
aderumier at odiso.com
Mon Nov 5 14:46:00 CET 2012
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Storage.pm | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index b13df21..4c69890 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -183,6 +183,22 @@ sub volume_snapshot_delete {
}
}
+sub volume_clone {
+ my ($cfg, $volidsrc, $voliddst, $snap, $running) = @_;
+
+ my ($storeid, $volnamesrc) = parse_volume_id($volidsrc, 1);
+ my (undef, $volnamedst) = parse_volume_id($voliddst, 1);
+ if ($storeid) {
+ my $scfg = storage_config($cfg, $storeid);
+ my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+ return $plugin->volume_clone($scfg, $storeid, $volnamesrc, $volnamedst, $snap, $running);
+ } elsif ($volidsrc =~ m|^(/.+)$| && -e $volidsrc) {
+ die "cloning device is not possible";
+ } else {
+ die "can't clone";
+ }
+}
+
sub get_image_dir {
my ($cfg, $storeid, $vmid) = @_;
--
1.7.10.4
More information about the pve-devel
mailing list