Jiří Moskovčák 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 <[email protected]> --- M src/plugins/ovirt-hosted-engine-setup/storage/iscsi.py 1 file changed, 36 insertions(+), 29 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/59/32859/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..0a18d38 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 = {} @@ -245,7 +246,7 @@ 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 ) @@ -257,34 +258,40 @@ 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/32859 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: master Gerrit-Owner: Jiří Moskovčák <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
