[pve-devel] [PATCH 16/48] rbd: add volume_clone

Alexandre Derumier aderumier at odiso.com
Tue Jan 29 17:13:58 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Storage/RBDPlugin.pm |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/PVE/Storage/RBDPlugin.pm b/PVE/Storage/RBDPlugin.pm
index b2f17bc..08bb161 100644
--- a/PVE/Storage/RBDPlugin.pm
+++ b/PVE/Storage/RBDPlugin.pm
@@ -410,6 +410,20 @@ sub volume_protect {
     }
 }
 
+sub volume_clone {
+    my ($class, $scfg, $storeid, $volname, $snap, $vmid) = @_;
+
+    $class->volume_protect($scfg, $storeid, $volname, $snap, 1);
+
+    my $volnamedst = $class->find_free_volname($storeid, $scfg, $vmid);
+
+    my $cmd = &$rbd_cmd($scfg, $storeid, 'clone', $volname, '--snap', $snap, $volnamedst);
+    run_command($cmd, errmsg => "rbd clone $volname' error", errfunc => sub {});
+
+    return "$volname/$volnamedst";
+}
+
+
 
 
 1;
-- 
1.7.10.4




More information about the pve-devel mailing list