The double back-tick formatting in a title makes the title extra
loud in the docs so just drop that formatting.
Note we don't do that same kind of formatting in other
titles like 1.20 and 1.31 so I'm not breaking with precedent
or something we have to get all knifey about.
Change-Id: I5224776133afa6d9855c535af68f8d73575bad9b
We had carried over the full list of pep8 whitespace ignores from nova.
Trying to address them all in the entire nova repository would have been
too big a task; but it's tenable here in placement.
Do it now rather than letting these whitespace issues compound.
This change removes the E* whitespace ignores and fixes the pep8 issues
they were masking.
Change-Id: Icbabdb9b56fd5a3e9fd14ab537abf3d0d6456fee
A typo was made in the original change [1]. This fixes it.
[1] Ie43a69be8b75250d9deca6a911eda7b722ef8648
Change-Id: I23d25cf432a98fa34fa5bcf47d6cdacd28331f0c
There are cases where it is necessary to use the PlacementFixture
without it running a wsgi-intercept, for example when you'd like
to run an indepdendent wsgi-intercept, as in the nova tests that
exercise the report client.
In the bug listed as partial below those report client tests were
using a nova conf global to initialize the wsgi intercept. They
just happened to be working because that CONF has the required
configuration settings. When placement's conf diverged [1] things
broke. A nova change which depends on this one will resolve the
bug.
Note that as a part of this change, the code which deletes
'sync_on_startup' (the new conf option) before configuring the
database, is adapted to be more flexible. There really is only
one conf setting that is required to start the placement database,
connection, and we'd like to make it possible for people to set
just that when doing tests or experiments and not have to worry
about extraneous optional things.
Some parameter descriptions are added to the PlacementFixture
__init__.
We should add more robust testing to all three of PlacementFixture,
fixtures.Database, and PlacementDirect, but at the moment we are
trying to fix a gate blocking bug.
Partial-Bug: #1818560
[1] Ie43a69be8b75250d9deca6a911eda7b722ef8648
Change-Id: I8c36f35dbe85b0c0db1a5b6b5389b160b68ca488
In preparation for extending the testing documentation to include
information about more than just gabbi, including the tempest,
grenade and perload jobs, pull the content out to its own page.
As noted in a TODO within, making subpages show up is cumbersome
for the moment, but we can iterate to something swell.
Change-Id: I71d000804985aaf5f3a1c467974ac7f8d0250a98
Consumer.increment_generation() was previously a thin wrapper around a
module-level _increment_consumer_generation method. With this patch, we
inline that method. In so doing, we remove a @writer decorator; but the
one place this was being called from was already wrapped in a @writer.
Change-Id: I32240fa6fefd9f431db59a656af000df95f146b6
Remove the AllocationList class and make the retrieval and
replace methods on it module level in placement.objects.allocation.
The methods that perform write operations on a list of allocations
take the list as an argument.
Adapting to this change requires a lot of changes in tests and
the allocation handler.
Change-Id: I2b59156e6f376df630bb0b574682964428c65c04
This is a precursor to getting rid of the AllocationList
class in favor of operating on native python lists.
When objects/allocation.py exists and is well-formed, the next
step will be to get rid of AllocationList similar to [1] but more
complex as there are write operations to deal with.
[1] I0066fc8fa9b61196ea99e35e780a7d123612023f
Change-Id: Ic673dfa95f6c8e42692c6287fb8d7cc27ee6cbf6
Move the _increment_provider_generation method into the ResourceProvider
class as an instance method.
Change-Id: I7a4e2526f43f5f0c679f8350261e5ed0343d899a
Introduce a new module, placement.objects.reshaper, to house the
reshape() method.
NB: reshaper isn't an object, but there's a feeling that the
'placement.objects' package should soon be renamed to something less
object-y, and we don't want to create a package like 'placement.tasks'
or similar.
Change-Id: I9a22963759aa17e2d97f0d305c5160d508c8a79f
The base TestCase for unit/objects tests is moved into its
own file, along with some common methods and constants.
This is to prepare for future changes which will move some
tests to their own files.
Change-Id: If6472817dfcf5b81476d757a05db8cd767de127a
The refactoring to remove oslo versioned objects and then to
DRY out the ListObjects into common code makes it pretty
clear that the ListObjects, at least in some cases, are not
really doing all that much and using simple Python lists
works just fine.
This change moves Usage into its own own file, deletes UsageList,
and makes the get_all* query methods on UsageList module level
The unit and functional tests related to Usage* are moved into
their own files. Since both test_resource_provider and test_usage
use the DISK_INVENTORY and DISK_ALLOCATION globals, they are
moved to db/test_base.
Change-Id: I0066fc8fa9b61196ea99e35e780a7d123612023f
In future patches, the RC_CACHE is going to be used
by multiple modules, so we want it in a reasonable
centralized location: resource_class_cache is a fair
choice.
Change-Id: Ic7115d444d7d8b0de91cd098c028b26c39de2a05
Defining ITEM_CLS on *List classes allows us to be explicit (more than
just the naming convention) about what kind of thing is being List'd. It
also lets us do away with the argument that was that class.
_set_objects was also taking an instance of the *List class itself,
which we can do away with by making _set_objects a @classmethod
instead of a @staticmethod.
Change-Id: I76039ef9f3c62713577c58b45399efdd79953762
Continue to DRY listy classes by moving the __repr__ method into the
ObjectList base class.
Note: unlike previous refactors, this is not a no-op change, as it will
affect the repr() of some *List classes that didn't previously override
__repr__. Since the repr is just used to make pretty logs/errors, this
should be copacetic. (Besides, I'm pretty sure we wildly changed the
default __repr__ when we de-OVO-ified.)
Also note: For lists of objects that are especially long this could
result in very long log messages, which can cause issues with some
logging tools. We will want to watch this and explore other options.
Change-Id: Ia35403c5fe2afefd9b8d077b36561963abe16b34
Continue factoring out common *List methods by moving _set_objects into
the ObjectList superclass.
UsageList had a version of _set_objects which created a Usage
without a context. Instead of maintaining that, Usage now
takes an unused context as its first arg. Since within
UsageList is the only way a Usage gets created, this is a
low impact change.
Change-Id: Iefa45c52bff98c2b1e81be94bce825e84572e92e
While de-OVO-ifying objects, all the *List classes ended up with a
common pattern of __init__, __len__, and __getitem__ methods to make
them behave listily. Here we factor these out into a base ObjectList
class in a new placement.objects.common module.
Note that there's still commonality among the *List classes that could
be factored into ObjectList - e.g. the _set_objects method. That is left
for a future change.
AllocationList was previously saving a context arg as an instance
variable and using it in replace_all and delete_all. All calling paths
of those methods had a context in scope that was the same as the one
used to init the AllocationList object itself. This change adds a
context arg to replace_all and delete_all, allowing us to remove the
instance variable. This allows us to remove the __init__ method from
AllocationList, since it can now simply use the one from the ObjectList
superclass.
Change-Id: Ice41cbdcec62d0e7d0f058bcae677e416189b1ae
In the commit 10e7228707a6d878c834608ae0826685fa9e2fe1, we changed
it to log the number of matched providers for each resource class
requested via allocation candidates API, but the other path used
in non-granular request for sharing nested providers still misses
the debug log. This patch adds it like this:
found 1 providers under 1 trees with available 1 VCPU
found 1 providers under 1 trees after filtering by previous result
found 1 providers under 1 trees with available 512 MEMORY_MB
found 1 providers under 1 trees after filtering by previous result
found 1 providers under 1 trees with available 1 DISK_GB
found 1 providers under 1 trees after filtering by previous result
found 1 providers under 1 trees after applying traits filter
- required: ['HW_CPU_X86_SSE'], forbidden: []
got 1 allocation requests under root provider
ef25274c-aa21-41f7-81aa-46e77b45cb85
Change-Id: I952d5229d6c40588cde6197683117a7e19127939
_get_trees_matching_all() is used to get allocation candidates,
but it is difficult to read using specific indexes like p[0].
This patch makes it more readable adding a new helper class,
`RPCandidateList`, which have several explanatory functions.
This is also a preparation for adding crisp debug logs coming
in a following patch.
Change-Id: If815d98a92e411b8006f147cd5ccf419e90f06fc
At high concurrency of setting aggregates, _ensure_aggregate() could
raise a DBDuplicateEntry error. The oslo_db_api wrapper caught it and
retried the same function, but it couldn't find the new entry again
because it tried to find it in the same transaction.
This blindness of the new record could happen depending on the DB
transaction isolation level, but it happens with "REPEATABLE_READ"
level, to which MySQL defaults.
This patch moves the retrying wrapper to the upper layer,
_set_aggregate(), to restart a new transaction when the
DBDuplicateEntry error happens so that it can find the new entry
another transaction has added.
Change-Id: I85ebc98502e9ca694ff07746e8e23c26e386df3c
Closes-Bug: #1818498
The nova report client used to scrape the error message text to
determine whether a 409 represented an "inventory in use" scenario. As
of the dependency, it properly uses the error code instead. This change
removes notes that reference the now-dead regular expression.
Depends-On: https://review.openstack.org/568639
Change-Id: Id56a975481f360a6ddacb64c424c1c9bf49449cc
We used a list for duplicate check of `AllocationRequest`s,
but now they are hashable so this patch refactors it to use
set instead of list for the check.
Change-Id: Idb56eb0047b8b26a7a918610b1ab277462172440