Skip to content

Commit ff59152

Browse files
Added logging with attempt number and raise of actual error.
Signed-off-by: Rushikesh Jadhav <[email protected]>
1 parent 2dac13e commit ff59152

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/storage/linstor/test_linstor_sr.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ def _get_diskful_hosts(host, controller_option, volume_name):
140140
attempt = 0
141141
retries = 3
142142
sleep_sec = 5
143+
143144
while attempt < retries:
144145
try:
145146
# Find host where volume is UpToDate
@@ -153,11 +154,12 @@ def _get_diskful_hosts(host, controller_option, volume_name):
153154
hostname = line.split('|')[2].strip()
154155
diskfuls += hostname
155156
return diskfuls
156-
except SSHCommandFailed:
157+
except SSHCommandFailed as e:
158+
logging.error("SSH Command Failed (attempt %d/%d): %s", attempt + 1, retries, e)
157159
attempt += 1
158-
if attempt >= retries:
159-
raise
160-
time.sleep(sleep_sec)
160+
if attempt >= retries:
161+
raise
162+
time.sleep(sleep_sec)
161163

162164
def _ensure_resource_remain_diskless(host, controller_option, volume_name, diskless):
163165
diskfuls = _get_diskful_hosts(host, controller_option, volume_name)

0 commit comments

Comments
 (0)