diff options
author | spisarski <s.pisarski@cablelabs.com> | 2018-03-09 14:42:34 -0700 |
---|---|---|
committer | spisarski <s.pisarski@cablelabs.com> | 2018-03-12 08:28:45 -0600 |
commit | 9e9e09590cce321f55996c1a31370ffdf28251b0 (patch) | |
tree | a0e031d0365604f4a299ad8f748fe10d09a75a8a /snaps/openstack/utils/magnum_utils.py | |
parent | fb0ab37c323717ca10ac3f3bda24ae390635495e (diff) |
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 <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/utils/magnum_utils.py')
-rw-r--r-- | snaps/openstack/utils/magnum_utils.py | 9 |
1 files changed, 6 insertions, 3 deletions
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): |