extract_volname can return an undef $volname

Signed-off-by: Daniel Berteaud <dan...@firewall-services.com>
---
 PVE/Storage/LunCmd/LIO.pm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/PVE/Storage/LunCmd/LIO.pm b/PVE/Storage/LunCmd/LIO.pm
index 5f9794d..5d7a21d 100644
--- a/PVE/Storage/LunCmd/LIO.pm
+++ b/PVE/Storage/LunCmd/LIO.pm
@@ -224,9 +224,11 @@ my $list_lun = sub {
     my $object = $params[0];
     my $volname = $extract_volname->($scfg, $params[0]);
 
-    foreach my $lun (@{$SETTINGS->{$scfg->{portal}.$scfg->{target}}->{luns}}) {
-       if ($lun->{storage_object} eq "$BACKSTORE/$volname") {
-           return $object;
+    if ($volname) {
+       foreach my $lun 
(@{$SETTINGS->{$scfg->{portal}.$scfg->{target}}->{luns}}) {
+           if ($lun->{storage_object} eq "$BACKSTORE/$volname") {
+               return $object;
+           }
        }
     }
 
-- 
2.21.0


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to