[pve-devel] [PATCH 1/2] storage : path : add checkaccess param

Alexandre Derumier aderumier at odiso.com
Wed Sep 25 03:03:11 CEST 2013


RPCEnvironnement:check_volume_access only need $path for real file.

Some plugin like nexenta && zfs are doing extra call to api, to find the $path value. (iscsi lun for example).

This can give us big timeouts, as check_volume_access can be call for each volume in a loop when listing volume.

We want to avoid that, so for theses plugin, if checkaccess param exist, we return empty $path without doing extra calls

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

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index 3d01e37..9e220bf 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -350,14 +350,14 @@ sub path_to_volume_id {
 }
 
 sub path {
-    my ($cfg, $volid, $snapname) = @_;
+    my ($cfg, $volid, $snapname, $checkaccess) = @_;
 
     my ($storeid, $volname) = parse_volume_id($volid);
 
     my $scfg = storage_config($cfg, $storeid);
 
     my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
-    my ($path, $owner, $vtype) = $plugin->path($scfg, $volname, $storeid, $snapname);
+    my ($path, $owner, $vtype) = $plugin->path($scfg, $volname, $storeid, $snapname, $checkaccess);
     return wantarray ? ($path, $owner, $vtype) : $path;
 }
 
-- 
1.7.10.4




More information about the pve-devel mailing list