Signed-off-by: Alexandre Derumier <[email protected]>
---
 PVE/Storage.pm |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index f8cf5ad..03eaf64 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -198,6 +198,22 @@ sub volume_has_feature {
     }
 }
 
+sub volume_clone {
+    my ($cfg, $volid, $snap, $vmid) = @_;
+
+    my ($storeid, $volname) = parse_volume_id($volid, 1);
+    if ($storeid) {
+       my $scfg = storage_config($cfg, $storeid);
+       my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+       my $volname = $plugin->volume_clone($scfg, $storeid, $volname, $snap, 
$vmid);
+       return "$storeid:$volname";
+    } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+       die "cloning device is not possible";
+    } else {
+       die "can't clone";
+    }
+}
+
 sub volume_protect {
     my ($cfg, $volid, $snap, $read_only) = @_;
 
-- 
1.7.10.4

_______________________________________________
pve-devel mailing list
[email protected]
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to