From: Alexandre Derumier Date: Thu, 14 Feb 2013 10:05:08 +0000 (+0100) Subject: plugin : has_feature : clone from base + fix X-Git-Url: https://git.proxmox.com/?p=pve-storage.git;a=commitdiff_plain;h=dc4f2cb33dab126ba95b9729a1019706bb7a40a6 plugin : has_feature : clone from base + fix Signed-off-by: Alexandre Derumier --- diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm index 462d9e1..445afe7 100644 --- a/PVE/Storage/Plugin.pm +++ b/PVE/Storage/Plugin.pm @@ -683,16 +683,23 @@ sub volume_has_feature { 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 ($vtype, $name, $vmid, $basename, $basevmid, $isBase) = + $class->parse_volname($volname); + + my (undef, $format) = parse_name_dir($name); + my $key = undef; + if($snapname){ + $key = $snapname + }else{ + $key = $isBase ? 'base' : 'current'; } + + return 1 if defined($features->{$feature}->{$key}->{$format}); + return undef; }