[pve-devel] [PATCH 15/16] plugin : has_feature : clone from base + fix
Alexandre Derumier
aderumier at odiso.com
Sun Feb 3 09:49:42 CET 2013
Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
PVE/Storage/Plugin.pm | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index de2818c..55bbad9 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -682,20 +682,24 @@ sub volume_snapshot_delete {
}
sub volume_has_feature {
- my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
+ my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running, $isBase) = @_;
my $features = {
snapshot => { current => { qcow2 => 1}, snap => { qcow2 => 1} },
- clone => { current => {qcow2 => 1, raw => 1, vmdk => 1} },
+ clone => { base => {qcow2 => 1, raw => 1, vmdk => 1} },
};
- if ($volname =~ m!^(\d+)/(\S+)$!) {
- my ($vmid, $name) = ($1, $2);
- my (undef, $format) = parse_name_dir($name);
- my $snap = $snapname ? 'snap' : 'current';
- return 1 if defined($features->{$feature}->{$snap}->{$format});
+ my (undef, $format) = parse_name_dir($volname);
+ my $key = undef;
+ if($snapname){
+ $key = $snapname
+ }else{
+ $key = $isBase ? 'base' : 'current';
}
+
+ return 1 if defined($features->{$feature}->{$key}->{$format});
+
return undef;
}
--
1.7.10.4
More information about the pve-devel
mailing list