}
}
+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) = @_;