[pve-devel] [PATCH 15/21] storage : add volume_snapshot_delete

Alexandre Derumier aderumier at odiso.com
Thu Sep 6 10:28:05 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 387ff20..2dfd561 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -168,6 +168,21 @@ sub volume_snapshot_rollback {
     }
 }
 
+sub volume_snapshot_delete {
+    my ($cfg, $volid, $snap, $running) = @_;
+
+    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_delete($scfg, $storeid, $volname, $snap, $running);
+    } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+        die "snapshot delete device is not possible";
+    } else {
+        die "can't delete snapshot";
+    }
+}
+
 sub get_image_dir {
     my ($cfg, $storeid, $vmid) = @_;
 
-- 
1.7.2.5




More information about the pve-devel mailing list