nova/nova/tests/unit/scheduler/client
Chris Dent c6b0d8ff5a Reset client session when placement endpoint not found
If the report client is able to access keystone to get a service
catalog, but that catalog does not include a placement service (because
it hasn't been added to the catalog yet), creating resource providers
and other placement entities will fail. This is expected.

What's not expected is that creating entities will continue to fail for
quite some time, even if placement is added to the catalog. This is
because the keystone session caches the service catalog for some amount
of time.

Therefore we need to create a new client session when EndpointNotFound
happens. This has been added in this change by extracting creation of
the report client's _client to its own method that we can call from the
exception handler. The resource provider and aggregate maps are wiped at
this time, to make sure we are starting from a clean slate. While this
isn't likely to cause a problem in real life scenarios, in the manual
testing I was doing it created issues.

I've made the _client method synchronized so that in the unlikely event
that the resource tracker is trying to do its update job while some
other thing is happening, we won't waste the client. This may not be
necessary, but probably doesn't harm anything.

Change-Id: I02ac615dc26a4a0d1fd28a638f622777e41d14e4
Co-Authored-By: zhangzhenzhong <zzzhang0118@gmail.com>
Closes-Bug: #1697825
2017-08-15 09:38:18 +01:00
..
__init__.py rt: isolate report and query sched client tests 2016-08-21 20:43:17 -04:00
test_query.py Pass a list of instance UUIDs to scheduler 2017-06-01 14:54:16 +00:00
test_report.py Reset client session when placement endpoint not found 2017-08-15 09:38:18 +01:00