[pve-devel] [PATCH 08/21] storage: add volume_snapshot_rollback

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


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

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 188db60..387ff20 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -153,6 +153,21 @@ sub volume_snapshot {
     }
 }
 
+sub volume_snapshot_rollback {
+    my ($cfg, $volid, $snap) = @_;
+
+    my ($storeid, $volname) = parse_volume_id($volid, 1);
+    if ($storeid) {
+        my $scfg = storage_config($cfg, $storeid);
+        my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+        return $plugin->volume_snapshot_rollback($scfg, $storeid, $volname, $snap);
+    } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+        die "snapshot rollback device is not possible";
+    } else {
+        die "can't snapshot";
+    }
+}
+
 sub get_image_dir {
     my ($cfg, $storeid, $vmid) = @_;
 
-- 
1.7.2.5




More information about the pve-devel mailing list