[pve-devel] [PATCH 1/8] storage : has_feature

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


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

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 17a2377..6a274c6 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -183,6 +183,21 @@ sub volume_snapshot_delete {
     }
 }
 
+sub volume_has_feature {
+    my ($cfg, $feature, $volid, $snap, $running) = @_;
+
+    my ($storeid, $volname) = parse_volume_id($volid, 1);
+    if ($storeid) {
+        my $scfg = storage_config($cfg, $storeid);
+        my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
+        return $plugin->volume_has_feature($scfg, $feature, $storeid, $volname, $snap, $running);
+    } elsif ($volid =~ m|^(/.+)$| && -e $volid) {
+	return undef;
+    } else {
+	return undef;
+    }
+}
+
 sub get_image_dir {
     my ($cfg, $storeid, $vmid) = @_;
 
-- 
1.7.10.4




More information about the pve-devel mailing list