[pve-devel] [PATCH 02/21] plugin : add volume_snapshot

Alexandre Derumier aderumier at odiso.com
Thu Sep 6 10:27:52 CEST 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Storage/Plugin.pm |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index be1189a..6360aeb 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -504,6 +504,22 @@ sub volume_resize {
     return undef;
 }
 
+sub volume_snapshot {
+    my ($class, $scfg, $storeid, $volname, $snap, $running) = @_;
+
+    die "can't snapshot this image format" if $volname !~ m/\.(qcow2|qed)$/;
+
+    return 1 if $running;
+
+    my $path = $class->path($scfg, $volname);
+
+    my $cmd = ['/usr/bin/qemu-img', 'snapshot','-c', $snap, $path];
+
+    run_command($cmd, timeout => 1);
+
+    return undef;
+}
+
 sub list_images {
     my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;
 
-- 
1.7.2.5




More information about the pve-devel mailing list