]> git.proxmox.com Git - pve-storage.git/commitdiff
plugin : has_feature
authorAlexandre Derumier <aderumier@odiso.com>
Thu, 27 Dec 2012 15:07:14 +0000 (16:07 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Dec 2012 06:52:20 +0000 (07:52 +0100)
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
PVE/Storage/Plugin.pm

index 886117b5f51688a97f3af41fe9d9244430229dd0..25e012c3979e8d40a1f9f577676c26319c66d3b8 100644 (file)
@@ -558,6 +558,24 @@ sub volume_snapshot_delete {
     return undef;
 }
 
+sub volume_has_feature {
+    my ($class, $scfg, $feature, $storeid, $volname, $snapname, $running) = @_;
+
+    my $features = {
+        snapshot => { current => { qcow2 => 1}, snap => { qcow2 => 1} },
+        clone => { current => {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});
+
+    }
+    return undef;
+}
+
 sub list_images {
     my ($class, $storeid, $scfg, $vmid, $vollist, $cache) = @_;