From cce719afb7333d481772ed78665530b210986ade Mon Sep 17 00:00:00 2001 From: Tristan Lostroh Date: Mon, 16 Jul 2018 09:16:10 +1000 Subject: [PATCH] Add a function to return NAA Adds a function to return NAA. This is required to match the WWID for multipath --- perl5/PVE/Storage/LunCmd/FreeNAS.pm | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/perl5/PVE/Storage/LunCmd/FreeNAS.pm b/perl5/PVE/Storage/LunCmd/FreeNAS.pm index 3332791..be34f05 100644 --- a/perl5/PVE/Storage/LunCmd/FreeNAS.pm +++ b/perl5/PVE/Storage/LunCmd/FreeNAS.pm @@ -52,6 +52,9 @@ sub run_lun_command { if($method eq "list_view") { return run_list_view($scfg, $timeout, $method, @params); } + if($method eq "list_extent") { + return run_list_extent($scfg, $timeout, $method, @params); + } if($method eq "list_lu") { return run_list_lu($scfg, $timeout, $method, "name", @params); } @@ -109,6 +112,29 @@ sub run_list_lu { return $result; } +# +# +# +sub run_list_extent { + my ($scfg, $timeout, $method, @params) = @_; + my $object = $params[0]; + my $result = undef; + + my $luns = freenas_list_lu($scfg); + foreach my $lun (@$luns) { + if ($lun->{'iscsi_target_extent_path'} =~ /^$object$/) { + $result = $lun->{'iscsi_target_extent_naa'}; + syslog("info","FreeNAS::list_extent($object): naa found $result"); + last; + } + } + if(!defined($result)) { + syslog("info","FreeNAS::list_extent($object): naa not found"); + } + + return $result; +} + # # #