]> git.proxmox.com Git - pve-storage.git/commitdiff
storage : add volume_snapshot
authorAlexandre Derumier <aderumier@odiso.com>
Thu, 6 Sep 2012 08:27:51 +0000 (10:27 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 6 Sep 2012 08:36:40 +0000 (10:36 +0200)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/Storage.pm

index 4afdf15e6106a43dd8164fe4290a27f51a9e79c5..188db60405f23cb3e6b654f01b7618c96ea38c5d 100755 (executable)
@@ -138,6 +138,21 @@ sub volume_resize {
     }
 }
 
+sub volume_snapshot {
+    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($scfg, $storeid, $volname, $snap, $running);
+    } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+        die "snapshot device is not possible";
+    } else {
+        die "can't snapshot";
+    }
+}
+
 sub get_image_dir {
     my ($cfg, $storeid, $vmid) = @_;