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

index 17a2377076d0a60e142e6939cca461af96e5f095..6a274c65461778c2501e6c50393b1e169408ea11 100755 (executable)
@@ -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) = @_;