From 9e9e09590cce321f55996c1a31370ffdf28251b0 Mon Sep 17 00:00:00 2001 From: spisarski Date: Fri, 9 Mar 2018 14:42:34 -0700 Subject: Closing keystone sessions after done with them. By not closing all of the keystone sessions being created when running all of the tests, this may be the root cause to the IOError occasionally being observed: IOError: [Errno 24] Too many open files JIRA: SNAPS-285 Change-Id: I7fc7ab0c6cdd02f1ae32bb3ae4f121cb465d5693 Signed-off-by: spisarski --- snaps/openstack/utils/magnum_utils.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'snaps/openstack/utils/magnum_utils.py') diff --git a/snaps/openstack/utils/magnum_utils.py b/snaps/openstack/utils/magnum_utils.py index 96ba6d1..1f39cfe 100644 --- a/snaps/openstack/utils/magnum_utils.py +++ b/snaps/openstack/utils/magnum_utils.py @@ -24,15 +24,18 @@ __author__ = 'spisarski' logger = logging.getLogger('magnum_utils') -def magnum_client(os_creds): +def magnum_client(os_creds, session=None): """ Retrieves the Magnum client :param os_creds: the OpenStack credentialsf + :param session: the keystone session object (optional) :return: the client """ logger.debug('Retrieving Magnum Client') - return Client(str(os_creds.magnum_api_version), - session=keystone_utils.keystone_session(os_creds)) + if not session: + session = keystone_utils.keystone_session(os_creds) + + return Client(str(os_creds.magnum_api_version), session=session) def get_cluster_template(magnum, template_config=None, template_name=None): -- cgit 1.2.3-korg