From b4a9cd27ea6fb1ca8ea62a35b75dc7776f2ac4f8 Mon Sep 17 00:00:00 2001 From: Kevin Scott Adams Date: Mon, 20 Jul 2020 09:59:52 -0400 Subject: [PATCH] Cleanup of code created issue for some calls to run_lun_command - When cleaning up code from last commit, I removed a line from the run_lun_command that initialize the code thinking that the way it would work would be throught the freenas_api_check when calling the freenas_api_call. Well certain procedures from the Proxmox ZFSPlugin call procedures that do not have the $freenas_api_methods variable set yet because freenas_api_check has NOT been called yet. Inserted the freenas_api_check() in the run_lun_command() to get the variable initialized. Fixes #62 and other tests that I found to have this issue. freenas-proxmox-2.0.0-0beta4 will also have the fix. --- perl5/PVE/Storage/LunCmd/FreeNAS.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/perl5/PVE/Storage/LunCmd/FreeNAS.pm b/perl5/PVE/Storage/LunCmd/FreeNAS.pm index 83acca5..5dec053 100644 --- a/perl5/PVE/Storage/LunCmd/FreeNAS.pm +++ b/perl5/PVE/Storage/LunCmd/FreeNAS.pm @@ -130,6 +130,10 @@ sub run_lun_command { die "Undefined freenas_user and/or freenas_password."; } + if (!defined $freenas_server_list->{defined($scfg->{freenas_apiv4_host}) ? $scfg->{freenas_apiv4_host} : $scfg->{portal}}) { + freenas_api_check($scfg); + } + if($method eq "create_lu") { return run_create_lu($scfg, $timeout, $method, @params); }