Skip to content

Commit

Permalink
Add timeout to iscsi.target.logout_iqn
Browse files Browse the repository at this point in the history
(cherry picked from commit 57e6bcc)
  • Loading branch information
bmeagherix authored and bugclerk committed Aug 28, 2024
1 parent b9b4235 commit d1f4d10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middlewared/middlewared/plugins/iscsi_/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,13 +458,13 @@ async def login_iqn(self, ip, iqn, no_wait=False):
raise OSError(cp.returncode, os.strerror(cp.returncode), err)

@private
async def logout_iqn(self, ip, iqn, no_wait=False):
async def logout_iqn(self, ip, iqn, no_wait=False, timeout=30):
cmd = ['iscsiadm', '-m', 'node', '-p', ip, '-T', iqn, '--logout']
if no_wait:
cmd.append('--no_wait')
err = f'LOGOUT: {ip!r} {iqn!r}'
try:
cp = await run(cmd, stderr=subprocess.STDOUT, encoding='utf-8')
cp = await run(cmd, stderr=subprocess.STDOUT, encoding='utf-8', timeout=timeout)
except Exception as e:
err += f' ERROR: {str(e)}'
raise UnexpectedFailure(err)
Expand Down

0 comments on commit d1f4d10

Please sign in to comment.