From 2a66963d1deb7694f7b5a4df4a5a610cdb14486c Mon Sep 17 00:00:00 2001 From: yong-huang Date: Fri, 28 Jan 2022 14:05:38 +0800 Subject: [PATCH] Unity: fix host_luns issue (#356) --- storops/unity/resource/host.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storops/unity/resource/host.py b/storops/unity/resource/host.py index ebe2f3b1..f79bf91c 100644 --- a/storops/unity/resource/host.py +++ b/storops/unity/resource/host.py @@ -264,12 +264,12 @@ def _attach_with_retry(self, lun_or_snap, skip_hlu_0): # If the same lun/snap attach to the same host, return the existed hlu self.update() - if is_lun: + if self.host_luns and is_lun: host_luns = [x for x in self.host_luns if not x.snap] for host_lun in host_luns: if lun_or_snap.id == host_lun.lun.id: return host_lun.hlu - else: + if self.host_luns and not is_lun: host_snaps = [x for x in self.host_luns if x.snap] for host_snap in host_snaps: if lun_or_snap.id == host_snap.snap.id: