Skip to content

Commit

Permalink
Add timeout to iscsi.target.logout_iqn (#14358)
Browse files Browse the repository at this point in the history
(cherry picked from commit 57e6bcc)

Co-authored-by: Brian M <[email protected]>
  • Loading branch information
bugclerk and bmeagherix authored Aug 28, 2024
1 parent b9b4235 commit e6b6df7
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 e6b6df7

Please sign in to comment.