[pve-devel] [PATCH 16/44] plugin : has_feature : clone from base + fix

Alexandre Derumier aderumier at odiso.com
Thu Feb 14 11:05:08 CET 2013


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/Storage/Plugin.pm |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

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;
 }
 
-- 
1.7.10.4




More information about the pve-devel mailing list