Simone Tiraboschi has uploaded a new change for review.

Change subject: iscsi: detecting empty LUN list
......................................................................

iscsi: detecting empty LUN list

Detecting and reporting an empty LUN list to provide a better user experience.

Change-Id: Iab293c172746a36779f8c2623c1c2542bf5aaca0
Signed-off-by: Simone Tiraboschi <stira...@redhat.com>
---
M src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py
1 file changed, 12 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup 
refs/changes/38/35138/1

diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py 
b/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py
index 5b8ddf6..c85e930 100644
--- a/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py
+++ b/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py
@@ -182,6 +182,9 @@
             password=self.environment[ohostedcons.StorageEnv.ISCSI_PASSWORD],
             iqn=target,
         )
+        if len(available_luns) == 0:
+            self.logger.error(_('Cannot find any LUN on the selected target'))
+            return None
 
         lun_list = ''
         lun_size = {}
@@ -456,14 +459,15 @@
                 default=valid_targets[0]
             )
             lun = self._customize_lun(target)
-            try:
-                self._validate_domain(target, lun)
-                valid_lun = True
-            except Exception as e:
-                self.logger.debug('exception', exc_info=True)
-                self.logger.error(e)
-                if not self._interactive:
-                    raise RuntimeError(_('Cannot access iSCSI LUN'))
+            if lun is not None:
+                try:
+                    self._validate_domain(target, lun)
+                    valid_lun = True
+                except Exception as e:
+                    self.logger.debug('exception', exc_info=True)
+                    self.logger.error(e)
+                    if not self._interactive:
+                        raise RuntimeError(_('Cannot access iSCSI LUN'))
 
         self.environment[ohostedcons.StorageEnv.ISCSI_TARGET] = target
         self.environment[ohostedcons.StorageEnv.ISCSI_LUN_ID] = lun


-- 
To view, visit http://gerrit.ovirt.org/35138
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iab293c172746a36779f8c2623c1c2542bf5aaca0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-hosted-engine-setup
Gerrit-Branch: master
Gerrit-Owner: Simone Tiraboschi <stira...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to