[pve-devel] [PATCH 2/8] plugin : has_feature

Alexandre Derumier aderumier at odiso.com
Thu Dec 27 16:07:14 CET 2012


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

diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm
index 886117b..25e012c 100644
--- a/PVE/Storage/Plugin.pm
+++ b/PVE/Storage/Plugin.pm
@@ -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) = @_;
 
-- 
1.7.10.4




More information about the pve-devel mailing list