Sandro Bonazzola has uploaded a new change for review. Change subject: provide better error message when iSCSI luns list is empty ......................................................................
provide better error message when iSCSI luns list is empty Change-Id: I3395502d1af4e16c21db5d8dec34137a3b1f82bb Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1133937 Signed-off-by: Jiri Moskovcak <jmosk...@redhat.com> (cherry picked from commit ebef387cf49f6a829bafa7a0d658cc5c8acfe80a) --- M src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py 1 file changed, 36 insertions(+), 31 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/61/33761/1 diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py b/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py index a0f35a5..8903a56 100644 --- a/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py +++ b/src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py @@ -182,6 +182,7 @@ password=self.environment[ohostedcons.StorageEnv.ISCSI_PASSWORD], iqn=target, ) + lun_list = '' lun_size = {} lun_device = {} @@ -244,8 +245,7 @@ def _iscsi_get_lun_list(self, ip, port, user, password, iqn): retry = self._MAXRETRY iscsi_lun_list = [] - iqn_found = False - while not iqn_found and retry > 0: + for _try in range(0, retry): devices = self.serv.s.getDeviceList( ohostedcons.VDSMConstants.ISCSI_DOMAIN ) @@ -256,35 +256,40 @@ for path in device['pathlist']: if path['iqn'] == iqn: iscsi_lun_list.append(device) - iqn_found = True - if not iqn_found: - self.logger.info('Discovering iSCSI node') - self._iscsi_discovery( - ip, - port, - user, - password, - ) - self.logger.info('Connecting to the storage server') - res = self.serv.s.connectStorageServer( - ohostedcons.VDSMConstants.ISCSI_DOMAIN, - self.vdsClient.BLANK_UUID, - [ - { - 'connection': ip, - 'iqn': iqn, - 'portal': '0', - 'user': user, - 'password': password, - 'port': port, - 'id': self.vdsClient.BLANK_UUID, - } - ] - ) - if res['status']['code'] != 0: - raise RuntimeError(devices['status']['message']) - retry -= 1 - time.sleep(self._RETRY_DELAY) + if iscsi_lun_list: + break + + self.logger.info('Discovering iSCSI node') + self._iscsi_discovery( + ip, + port, + user, + password, + ) + self.logger.info('Connecting to the storage server') + res = self.serv.s.connectStorageServer( + ohostedcons.VDSMConstants.ISCSI_DOMAIN, + self.vdsClient.BLANK_UUID, + [ + { + 'connection': ip, + 'iqn': iqn, + 'portal': '0', + 'user': user, + 'password': password, + 'port': port, + 'id': self.vdsClient.BLANK_UUID, + } + ] + ) + if res['status']['code'] != 0: + raise RuntimeError(devices['status']['message']) + retry -= 1 + time.sleep(self._RETRY_DELAY) + else: + raise RuntimeError("Unable to retrieve the list of LUN(s) please " + "check the SELinux log and settings on your " + "iscsi target") return iscsi_lun_list def _iscsi_get_device(self, ip, port, user, password, iqn, lun): -- To view, visit http://gerrit.ovirt.org/33761 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3395502d1af4e16c21db5d8dec34137a3b1f82bb Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-setup Gerrit-Branch: ovirt-hosted-engine-setup-1.2 Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com> Gerrit-Reviewer: Jiří Moskovčák <jmosk...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches