From d1f4d105fdfa94187b2708c26b70e9a738079a2d Mon Sep 17 00:00:00 2001 From: Brian M Date: Tue, 27 Aug 2024 13:06:01 -0700 Subject: [PATCH] Add timeout to iscsi.target.logout_iqn (cherry picked from commit 57e6bcc22ab04a4fded45f8e42109d0ac0fe05f1) --- src/middlewared/middlewared/plugins/iscsi_/targets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/middlewared/middlewared/plugins/iscsi_/targets.py b/src/middlewared/middlewared/plugins/iscsi_/targets.py index c6b82bea82514..616308594ca02 100644 --- a/src/middlewared/middlewared/plugins/iscsi_/targets.py +++ b/src/middlewared/middlewared/plugins/iscsi_/targets.py @@ -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)