--- Begin Message ---
1: storage snapshot
2: qemu internal snapshot
3: qemu external snapshot
can be use be qemu-server to known the type of snapshot supported
Signed-off-by: Alexandre Derumier <alexandre.derum...@groupe-cyllene.com>
---
src/PVE/Storage/LVMPlugin.pm | 6 +++---
src/PVE/Storage/Plugin.pm | 11 ++++++++---
src/PVE/Storage/RBDPlugin.pm | 8 +++++---
3 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/src/PVE/Storage/LVMPlugin.pm b/src/PVE/Storage/LVMPlugin.pm
index b20fe98..710933f 100644
--- a/src/PVE/Storage/LVMPlugin.pm
+++ b/src/PVE/Storage/LVMPlugin.pm
@@ -863,8 +863,8 @@ sub volume_has_feature {
current => { qcow2 => 1, raw => 1},
},
snapshot => {
- current => { qcow2 => 1 },
- snap => { qcow2 => 1 },
+ current => { qcow2 => 3 },
+ snap => { qcow2 => 3 },
},
# fixme: add later ? (we need to handle basepath, volume activation,...)
# template => {
@@ -885,7 +885,7 @@ sub volume_has_feature {
}else{
$key = $isBase ? 'base' : 'current';
}
- return 1 if defined($features->{$feature}->{$key}->{$format});
+ return $features->{$feature}->{$key}->{$format} if
defined($features->{$feature}->{$key}->{$format});
return undef;
}
diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm
index 0319ab2..a26af8a 100644
--- a/src/PVE/Storage/Plugin.pm
+++ b/src/PVE/Storage/Plugin.pm
@@ -1409,10 +1409,15 @@ sub storage_can_replicate {
sub volume_has_feature {
my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running,
$opts) = @_;
+ #1: only storage snapshot
+ #2: support internal snapshot
+ #3: support external snapshot
+ my $snapshot_type = $scfg->{snapext} ? 3 : 2;
+
my $features = {
snapshot => {
- current => { qcow2 => 1 },
- snap => { qcow2 => 1 },
+ current => { qcow2 => $snapshot_type },
+ snap => { qcow2 => $snapshot_type },
},
clone => {
base => { qcow2 => 1, raw => 1, vmdk => 1 },
@@ -1455,7 +1460,7 @@ sub volume_has_feature {
$key = $isBase ? 'base' : 'current';
}
- return 1 if defined($features->{$feature}->{$key}->{$format});
+ return $features->{$feature}->{$key}->{$format} if
defined($features->{$feature}->{$key}->{$format});
return undef;
}
diff --git a/src/PVE/Storage/RBDPlugin.pm b/src/PVE/Storage/RBDPlugin.pm
index c78db00..c991f10 100644
--- a/src/PVE/Storage/RBDPlugin.pm
+++ b/src/PVE/Storage/RBDPlugin.pm
@@ -854,8 +854,10 @@ sub volume_snapshot_needs_fsfreeze {
sub volume_has_feature {
my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
- my $features = {
- snapshot => { current => 1, snap => 1},
+ my $snapshot_type = $scfg->{krbd} ? 1 : 2;
+
+ my $features = {
+ snapshot => { current => $snapshot_type, snap => $snapshot_type},
clone => { base => 1, snap => 1},
template => { current => 1},
copy => { base => 1, current => 1, snap => 1},
@@ -871,7 +873,7 @@ sub volume_has_feature {
} else {
$key = $isBase ? 'base' : 'current';
}
- return 1 if $features->{$feature}->{$key};
+ return $features->{$feature}->{$key} if $features->{$feature}->{$key};
return undef;
}
--
2.39.5
--- End Message ---