OpenStack resource provider inventory allocation service
Go to file
Chris Dent b09f2f917f Make a TraitCache similar to ResourceClassCache
The Trait and ResourceClass db objects have the same essential
structure and are used throughout the code in similar ways:

* turn a name into an id
* turn an id into a name
* get an unfiltered list of names
* make a mapping of ids to names

In I409a5e819a72d64e66ee390e4528da0c503d8d05 we made the resource
class cache request specific. Doing that work made it pretty clear
we could have a similar cache for traits and as a result visit the
traits db fewer times per request.

The implementation is straightforward: make an _AttributeCache super
class that is a parent to ResourceClassCache. Create TraitCache as
a sibling. The sole difference is the table used for the data authority
and the exception raised when an attribute is not found.

The new super class has been refactored to use private attributes and
methods.

A 'get_all' method is added to the cache to list the full collection
of dicts it contains. That can be be directly transformed into Trait
and ResourceClass objects. The order of the results of this method
are not predictable, and sorting them would add cost for no benefit,
so gabbi tests which had previously relied on the ordered of returned
resource classes have been removed.

From the API, listing traits and resource classes (without filters) now
uses the cache instead of going to the db. Where filters (in traits) are
required, the db is accessed.

The research_context turns lists of trait names into id, name maps for
required and forbidden traits.

Further, anywhere the traits table was joined to create a name of an id,
the cache is used instead. This allows to drop some joins and operate
fully in-process and in-RAM. No additional loops are added to make this
happen: the translation is done in existing loops.

The upshot of these changes is that unless there is a write operation on
a trait or resource class, both tables are scanned at most once in any
request. And when they are scanned it is to list their entire contents.

As noted in the _AttributeCache docstring there are restrictions
on what kinds of entities can use the cache and some necessary
precautions.

Change-Id: Ia19ea2b4ecdde25323579edf60ad6269d05e75a2
2019-07-24 11:23:50 +01:00
api-ref Update api-ref to point to API-SIG microversion spec 2019-07-23 11:33:05 +01:00
doc Update api-ref location 2019-07-22 19:17:01 +02:00
etc/placement Add OsProfiler config options to generated reference 2019-06-27 09:37:56 +02:00
gate Fix up some inaccuracies in perfload comments and logs 2019-07-01 15:58:29 +00:00
placement Make a TraitCache similar to ResourceClassCache 2019-07-24 11:23:50 +01:00
placement_db_tools Package db migration scripts in placement pypi dist 2019-05-07 00:08:39 +00:00
playbooks Move non-nested perfload shell commands to script 2019-06-20 12:38:08 +01:00
releasenotes Follow up fix for same_subtree documentation 2019-07-09 10:23:54 +00:00
tools Package db migration scripts in placement pypi dist 2019-05-07 00:08:39 +00:00
.coveragerc Use both unit and functional for coverage testing 2018-09-14 13:30:14 -06:00
.gitignore Clean up .gitignore file 2018-10-16 00:14:36 +09:00
.gitreview OpenDev Migration Patch 2019-04-19 19:41:22 +00:00
.stestr.conf Put stestr group_regex in .stestr.conf 2018-09-14 13:30:14 -06:00
.zuul.yaml Add Python 3 Train unit tests 2019-07-10 21:09:52 +00:00
babel.cfg Get rid of distutils.extra. 2012-02-08 19:30:39 -08:00
bindep.txt Merge "Bindep does not catch missing libpcre3-dev on Ubuntu" 2018-02-14 07:31:09 +00:00
CONTRIBUTING.rst Update CONTRIBUTING and HACKING 2019-03-11 18:28:36 +00:00
LICENSE initial commit 2010-05-27 23:05:26 -07:00
lower-constraints.txt Bump os-resource-classes requirements 2019-07-18 13:26:12 +01:00
README.rst Update api-ref location 2019-07-22 19:17:01 +02:00
requirements.txt Bump os-resource-classes requirements 2019-07-18 13:26:12 +01:00
setup.cfg Add Python 3 Train unit tests 2019-07-10 21:09:52 +00:00
setup.py Updated from global requirements 2017-03-02 11:50:48 +00:00
test-requirements.txt Make placement testing easier on osx 2019-07-17 13:24:44 +01:00
tox.ini Update api-ref location 2019-07-22 19:17:01 +02:00

If you are viewing this README on GitHub, please be aware that placement development happens on OpenStack git and OpenStack gerrit.

Team and repository tags

image

OpenStack Placement

OpenStack Placement provides an HTTP service for managing, selecting, and claiming providers of classes of inventory representing available resources in a cloud.

API

To learn how to use Placement's API, consult the documentation available online at:

For more information on OpenStack APIs, SDKs and CLIs in general, refer to:

Operators

To learn how to deploy and configure OpenStack Placement, consult the documentation available online at:

In the unfortunate event that bugs are discovered, they should be reported to the appropriate bug tracker. If you obtained the software from a 3rd party operating system vendor, it is often wise to use their own bug tracker for reporting problems. In all other cases use the master OpenStack bug tracker, available at:

Developers

For information on how to contribute to Placement, please see the contents of CONTRIBUTING.rst.

Further developer focused documentation is available at: