[pve-devel] [PATCH 3/5] Do not expose every value from storage.cfg as PMXCFG_*, and instead expose those few 'usefull' values like portal, target, pool, etc. Everything else should be handled by helper's own configuration mechanism.

Pablo Ruiz García pablo.ruiz at gmail.com
Sun Apr 13 02:08:12 CEST 2014


Signed-off-by: Pablo Ruiz García <pablo.ruiz at gmail.com>
---
 PVE/Storage/ZFSPlugin.pm |   16 +++-------------
 1 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/PVE/Storage/ZFSPlugin.pm b/PVE/Storage/ZFSPlugin.pm
index 80fc0ea..ac8eb0a 100644
--- a/PVE/Storage/ZFSPlugin.pm
+++ b/PVE/Storage/ZFSPlugin.pm
@@ -23,16 +23,6 @@ my $lun_cmds = {
     'get-lu-no' => 1, # Resolves a LUN's number, from it's assigned unique id.
 };
 
-sub encode_cfg_value {
-    my ($key, $value) = @_;
-
-    if ($key eq 'nodes' || $key eq 'content') {
-        return join(',', keys(%$value));
-    }
-
-    return $value;
-}
-
 sub run_lun_command {
     my ($scfg, $timeout, $method, @params) = @_;
 
@@ -69,13 +59,13 @@ sub run_lun_command {
     }
 
     # Common environment variables
+    $vars{POOL} = $scfg->{pool};
+    $vars{TARGET} = $scfg->{target};
+    $vars{PORTAL} = $scfg->{portal};
     $vars{SSHKEY} = "$id_rsa_path/$scfg->{portal}_id_rsa";
     $vars{LUNDEV} = $lundev if $lundev;
     $vars{LUNUUID} = $guid if $guid;
 
-    foreach my $k (keys %$scfg) {
-        $env .= "PMXCFG_$k=\"". encode_cfg_value($k, $scfg->{$k}) ."\" ";
-    }
     foreach my $k (keys %vars) {
         $env .= "PMXVAR_$k=\"$vars{$k}\" ";
     }
-- 
1.7.1



More information about the pve-devel mailing list