diff --git a/nova/scheduler/client/report.py b/nova/scheduler/client/report.py index 26fc368857bc..3da52c3dedb0 100644 --- a/nova/scheduler/client/report.py +++ b/nova/scheduler/client/report.py @@ -21,7 +21,6 @@ import time from keystoneauth1 import exceptions as ks_exc from keystoneauth1 import loading as keystone -from keystoneauth1 import session from oslo_log import log as logging from nova.compute import utils as compute_utils @@ -188,7 +187,8 @@ class SchedulerReportClient(object): self._provider_aggregate_map = {} auth_plugin = keystone.load_auth_from_conf_options( CONF, 'placement') - self._client = session.Session(auth=auth_plugin) + self._client = keystone.load_session_from_conf_options( + CONF, 'placement', auth=auth_plugin) # NOTE(danms): Keep track of how naggy we've been self._warn_count = 0 self.ks_filter = {'service_type': 'placement', diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py index 8cb9b6eb56d3..561129f401f0 100644 --- a/nova/tests/unit/scheduler/client/test_report.py +++ b/nova/tests/unit/scheduler/client/test_report.py @@ -132,23 +132,25 @@ class SafeConnectedTestCase(test.NoDBTestCase): class TestConstructor(test.NoDBTestCase): - @mock.patch('keystoneauth1.session.Session') + @mock.patch('keystoneauth1.loading.load_session_from_conf_options') @mock.patch('keystoneauth1.loading.load_auth_from_conf_options') - def test_constructor(self, load_auth_mock, ks_sess_mock): + def test_constructor(self, load_auth_mock, load_sess_mock): client = report.SchedulerReportClient() load_auth_mock.assert_called_once_with(CONF, 'placement') - ks_sess_mock.assert_called_once_with(auth=load_auth_mock.return_value) + load_sess_mock.assert_called_once_with(CONF, 'placement', + auth=load_auth_mock.return_value) self.assertIsNone(client.ks_filter['interface']) - @mock.patch('keystoneauth1.session.Session') + @mock.patch('keystoneauth1.loading.load_session_from_conf_options') @mock.patch('keystoneauth1.loading.load_auth_from_conf_options') - def test_constructor_admin_interface(self, load_auth_mock, ks_sess_mock): + def test_constructor_admin_interface(self, load_auth_mock, load_sess_mock): self.flags(os_interface='admin', group='placement') client = report.SchedulerReportClient() load_auth_mock.assert_called_once_with(CONF, 'placement') - ks_sess_mock.assert_called_once_with(auth=load_auth_mock.return_value) + load_sess_mock.assert_called_once_with(CONF, 'placement', + auth=load_auth_mock.return_value) self.assertEqual('admin', client.ks_filter['interface'])