[pve-devel] [PATCH] use volume_snapshot with testfeature=1 to detect if storage support snapshot

Alexandre Derumier aderumier at odiso.com
Fri Sep 28 16:23:24 CEST 2012


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuServer.pm |   16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 033bc9e..eb3a0b7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -3711,20 +3711,8 @@ my $snapshot_prepare = sub {
 
 	    return if drive_is_cdrom($drive);
 	    my $volid = $drive->{file};
-
-	    my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
-	    if ($storeid) {
-		my $scfg = PVE::Storage::storage_config($storecfg, $storeid);
-		die "can't snapshot volume '$volid'\n"		
-		    if !(($scfg->{path} && $volname =~ m/\.qcow2$/) ||
-			 ($scfg->{type} eq 'nexenta') || 
-			 ($scfg->{type} eq 'rbd') || 
-			 ($scfg->{type} eq 'sheepdog'));
-	    } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
-		die "snapshot device '$volid' is not possible\n";
-	    } else {
-		die "can't snapshot volume '$volid'\n";
-	    }
+	    my $testfeature = 1;
+	    PVE::Storage::volume_snapshot($storecfg, $volid, $snapname, undef, $testfeature);
 	});
 
 
-- 
1.7.10




More information about the pve-devel mailing list