Fix filedescriptor issue with VMTasks scenario.

VMTasks does not close ssh when it runs commands over ssh.
The number of file descriptors increase over time during execution.

Change-Id: I039fb7f8e504619cb3c1a88716942b0f6a8c6e08
This commit is contained in:
Thobias Salazar Trevisan 2020-07-10 15:10:56 -03:00 committed by Andrey Kurilin
parent 09c040fa70
commit 996a7df22c
1 changed files with 8 additions and 2 deletions

View File

@ -223,5 +223,11 @@ class VMScenario(nova_utils.NovaScenario):
pkey = pkey if pkey else self.context["user"]["keypair"]["private"]
ssh = sshutils.SSH(username, server_ip, port=port,
pkey=pkey, password=password)
self._wait_for_ssh(ssh, timeout, interval)
return self._run_command_over_ssh(ssh, command)
try:
self._wait_for_ssh(ssh, timeout, interval)
return self._run_command_over_ssh(ssh, command)
finally:
try:
ssh.close()
except AttributeError:
pass