Close XenAPI sessions in neutron-rootwrap-xen-dom0
Neutron with XenServer properly doesn't close XenAPI sessions. If it creates these sessions so rapidly, the XenServer host eventually exceeds its maximum allowed number of connections. This patch adds a close process for session. Closes-Bug: 1558721 Change-Id: Ida90a970c649745c492c28c41c4a151e4d940aa6
This commit is contained in:
parent
2644c12155
commit
9d21b5ad7e
@ -113,11 +113,14 @@ def run_command(url, username, password, user_args, cmd_input):
|
||||
try:
|
||||
session = XenAPI.Session(url)
|
||||
session.login_with_password(username, password)
|
||||
host = session.xenapi.session.get_this_host(session.handle)
|
||||
result = session.xenapi.host.call_plugin(
|
||||
host, 'netwrap', 'run_command',
|
||||
{'cmd': json.dumps(user_args), 'cmd_input': json.dumps(cmd_input)})
|
||||
return json.loads(result)
|
||||
try:
|
||||
host = session.xenapi.session.get_this_host(session.handle)
|
||||
result = session.xenapi.host.call_plugin(
|
||||
host, 'netwrap', 'run_command',
|
||||
{'cmd': json.dumps(user_args), 'cmd_input': json.dumps(cmd_input)})
|
||||
return json.loads(result)
|
||||
finally:
|
||||
session.xenapi.session.logout()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
sys.exit(RC_XENAPI_ERROR)
|
||||
|
Loading…
Reference in New Issue
Block a user