10644 Commits

Author SHA1 Message Date
Jay Pipes
4c2e11af67 placement: use single-shot INSERT/DELETE agg
When replacing a provider's set of aggregate associations, we were
issuing a call to:

 DELETE resource_provider_aggregates WHERE resource_provider_id = $rp

and then a single call to:

 INSERT INTO resource_provider_aggregates
 SELECT $rp, aggs.id
 FROM provider_aggregates AS aggs
 WHERE aggs.uuid IN ($agg_uuids)

This patch changes the _set_aggregates() function in a few ways.
First, we grab the aggregate's internal ID value when creating new
aggregate records (or grabbing a provider's existing aggregate
associations). This eliminates the need for any join to
provider_aggregates in an INSERT/DELETE statement.

Second, instead of a multi-row INSERT .. SELECT statement, we do
single-shot INSERT ... VALUES statements, one for each added aggregate.

Third, we no longer DELETE all aggregate associations for the provider
in question. Instead, we issue single-shot DELETE statements for only
the aggregates that are being disassociated.

Finally, I've added a number of log debug statements so that we can have
a little more information if this particular patch does not fix the
deadlock issue described in the associated bug.

Change-Id: I87e765305017eae1424005f7d6f419f42a2f8370
Closes-bug: #1786703
2018-08-16 18:04:40 -04:00
Chris Dent
6dcdc85d6c Add trait query to placement perf check
This updates the EXPLANATION and sets the pinned version placeload
to the just release 0.3.0. This ought to hold us for a while. If
we need to do this again, we should probably switch to using
requirements files in some fashion, but I'm hoping we can avoid
that until later, potentially even after placement extraction
when we will have to moving and changing this anyway.

Change-Id: Ia3383c5dbbf8445254df774dc6ad23f2b9a3721e
2018-08-16 18:32:12 +01:00
Chris Dent
3673258049 Add explanatory prefix to post_test_perf output
The pirate on crack output of placeload can be confusing
so this change adds a prefix to the placement-perf.txt log
file so that it is somewhat more self-explanatory.

This change also pins the version of placeload because the
explanation is version dependent.

Change-Id: I055adb5f6004c93109b17db8313a7fef85538217
2018-08-16 18:21:47 +01:00
Zuul
fe4754f8bd Merge "Add placement perf info gathering hook to end of nova-next" 2018-08-15 21:52:02 +00:00
Zuul
0ed6c78835 Merge "Remove blacklisted py3 xen tests" 2018-08-15 07:10:21 +00:00
Eric Fried
38dfc8f56f Remove blacklisted py3 xen tests
Xen UT failures seem to have cleared up, which may or may not have
anything to do with [1]. Remove the blacklist file and get these back
in the py3 jobs.

[1] https://review.openstack.org/#/c/591061/

Change-Id: Iacc1ae01f535caed64793d57b757ea07a8c46620
2018-08-14 16:34:19 +00:00
Chris Dent
fc45edca78 Add placement perf info gathering hook to end of nova-next
This change adds a post test hook to the nova-next job to report
timing of a query to GET /allocation_candidates when there are 1000
resource providers with the same inventory.

A summary of the work ends up in logs/placement-perf.txt

Change-Id: Idc446347cd8773f579b23c96235348d8e10ea3f6
2018-08-14 15:42:08 +01:00
Zuul
2e912c6153 Merge "placement: ignore policy scope check failures if not enforcing scope" 2018-08-14 09:19:14 +00:00
Zuul
5aec2bd1aa Merge "[placement] api-ref: Add missing aggregates example" 2018-08-13 17:03:01 +00:00
Takashi NATSUME
01c682e8be [placement] api-ref: Add missing aggregates example
About "PUT /resource_providers/{uuid}/aggregates"
in the Placement API reference,
the example of the response body in microversion 1.1 - 1.18 is missing.
So add it.

Change-Id: Ic3dc665124ae7927cfa20cf70a08c39b856b8961
Closes-Bug: #1786759
2018-08-13 13:09:49 +00:00
Zuul
8e352717bd Merge "placement: use simple code paths when possible" 2018-08-13 04:05:19 +00:00
Zuul
f245b4a96e Merge "Test case for multiple forbidden traits" 2018-08-13 03:58:48 +00:00
Zuul
7d1190e6b8 Merge "Adds a test for _get_provider_ids_matching()" 2018-08-13 03:58:41 +00:00
Zuul
a7643e3bfa Merge "Remove patching the mock lib" 2018-08-10 21:00:44 +00:00
Jay Pipes
4f54c204dc placement: use simple code paths when possible
Somewhere in the past release, we started using extremely complex code
paths involving sharing providers, anchor providers, and nested resource
provider calculations when we absolutely don't need to do so.

There was a _has_provider_trees() function in the
nova/api/openstack/placement/objects/resource_provider.py file that used
to be used for top-level switching between a faster, simpler approach to
finding allocation candidates for a simple search of resources and
traits when no sharing providers and no nesting was used. That was
removed at some point and all code paths -- even for simple "get me
these amounts of these resources" when no trees or sharing providers are
present (which is the vast majority of OpenStack deployments) -- were
going through the complex tree-search-and-match queries and algorithms.

This patch changes that so that when there's a request for some
resources and there's no trees or sharing providers, we do the simple
code path. Hopefully this gets our performance for the simple, common
cases back to where we were pre-Rocky.

This change is a prerequisite for the following change which adds
debugging output to help diagnose which resource classes are running
out of inventory when GET /allocation_candidates returns 0 results.
That code is not possible without the changes here as they only
work if we can identify when a "simpler approach" is possible and
call that simpler code.

Related-Bug: #1786055
Partial-Bug: #1786519
Change-Id: I1fdbcdb7a1dd51e738924c8a30238237d7ac74e1
2018-08-10 16:19:42 -04:00
Eric Fried
27fd442fd3 Test case for multiple forbidden traits
Test case to expose a bug at [1] where symmetric difference (^) is being
used instead of difference (-).

[1] https://review.openstack.org/#/c/590041/6/nova/api/openstack/placement/objects/resource_provider.py@2911

Change-Id: I2e80fe75da1d1104d0562f087c74117fbe6b457b
2018-08-10 16:19:41 -04:00
Tetsuro Nakamura
4faaf492af Adds a test for _get_provider_ids_matching()
This patch adds a test for _get_provider_ids_matching()
to verify it works correctly with required traits.

Related-Bug: #1786519
Change-Id: I2512e361f5eaa4e60701be7c8bf57b2e0a02a146
2018-08-10 16:19:41 -04:00
Zuul
1286a4eb75 Merge "Add additional info to resource provider aggregates update API" 2018-08-10 19:59:39 +00:00
Zuul
91f107ea0a Merge "Nix 'new in 1.19' from 1.19 sections for rp aggs" 2018-08-10 15:35:42 +00:00
Matt Riedemann
685c9382f1 placement: ignore policy scope check failures if not enforcing scope
Rather than spam the placement API logs with scope check
warnings from oslo.policy when placement isn't configured
for scope type enforcement, ignore those warnings.

Note that the same warnings filter in the placement WarningsFixture
is left intact because the configuration defaults setting code in
wsgi.py which allows the warning filter to be set in deploy.py,
is not run by the functional tests. In future changes this will
be resolved by unifying configuration handling.

Closes-Bug: #1786498
Related-Bug: #1784663
Change-Id: I34e4e550c9c31a654308e555210588156418f9e3
2018-08-10 16:29:17 +01:00
Balazs Gibizer
1ea074730d Remove patching the mock lib
Since [1] was fixed we don't need to manually patch the mock lib to
avoid silently passing mistyped assert methods on mocks.

[1] https://bugs.python.org/issue21238

Change-Id: Iecf4dcf8e648c9191bf8846428683ec81812c026
2018-08-10 10:58:52 +02:00
Chen
e154ca668d Add additional info to resource provider aggregates update API
Mention that if any nonexistent aggregate uuids are provided, those
aggregates will be created automatically first during the update call.
I think this is a good addition since in fact I was much confused how
the aggregates can be created in the first place when playing with
the placement APIs.

Change-Id: I2f86715a21784eb974b73fc3edc74eedd73ad48b
2018-08-10 11:17:51 +08:00
Zuul
e4cfbc2e57 Merge "[placement] api-ref: add description for 1.29" 2018-08-09 19:37:22 +00:00
Eric Fried
ee9951c6b3 Nix 'new in 1.19' from 1.19 sections for rp aggs
In the placement API reference, there is a separate section for
"microversions 1.19 -" for both List and Update resource provider
aggregates, so there's no need for the resource_provider_generation
field to mention that it's "New in version 1.19" in those sections.

Change-Id: I3fd02f21d4af11633c4aeb33925c279a1c3b4abd
2018-08-09 10:23:37 -05:00
Takashi NATSUME
3809042678 [placement] api-ref: add description for 1.29
Add description for nested resource providers
in allocation candidates, Placement API microversion 1.29
in the Placement API reference.

Change-Id: I22c2068ae860c1ef2cbdb0801e85a40acc2a097a
Implements: blueprint nested-resource-providers-allocation-candidates
2018-08-09 02:56:30 +00:00
Zuul
024086330a Merge "api-ref: fix min_version for parent_provider_uuid in responses" 2018-08-08 23:57:47 +00:00
Zuul
79145f08c9 Merge "[placement] Avoid rp.get_by_uuid in allocation_candidates" 2018-08-08 23:57:39 +00:00
Zuul
8b8c37f13c Merge "Add tempest-slow job to run the tempest slow tests" 2018-08-08 23:57:20 +00:00
Zuul
aad1e673aa Merge "get provider IDs once when building summaries" 2018-08-08 23:34:40 +00:00
Zuul
77931e0f62 Merge "Add the guideline to write API reference" 2018-08-08 21:38:15 +00:00
Zuul
a2f5e9deeb Merge "Add explicit functional-py36 tox target" 2018-08-08 21:38:08 +00:00
Zuul
f76e402653 Merge "conf: Deprecate 'network_manager'" 2018-08-08 17:40:38 +00:00
Takashi NATSUME
7a7c2fe142 Add the guideline to write API reference
Adapted from the wiki:
https://wiki.openstack.org/wiki/NovaAPIRef

Compute API reference:
https://developer.openstack.org/api-ref/compute/

Placement API reference:
https://developer.openstack.org/api-ref/placement/

Change-Id: I78ded463142fc50af3b77721500ed190448632c7
2018-08-08 12:15:15 -04:00
Jay Pipes
c086111fa3 get provider IDs once when building summaries
We were calling ResourceProvider.get_by_uuid() inside
_build_provider_summaries() main loop over all providers involved in the
resulting allocation candidates. This results in a query per provider
involved, which is quite obviously not going to perform well. This patch
modifies the _build_provider_summaries() function to make a single call
to a new _provider_ids_from_rp_ids() function instead of multiple calls
to ResourceProvider.get_by_uuid().

Change-Id: I0e0a44e833afece0775ec712fbdf9fcf4eae7a93
Related-bug: #1786055
2018-08-08 11:42:04 -04:00
Chris Dent
97e2663284 [placement] Avoid rp.get_by_uuid in allocation_candidates
We already have a fully loaded resource provider object in the loop, so
we don't need to create another one. Doing so has a very large
performance impact, especially when there are many resource providers
in the collection of summaries (which will be true in a large and
sparsely used cloud).

The code which creates the summaries used here as a data source has the
same expensive use of get_by_uuid in a loop. That will be fixed in a
separate patch.

Existing functional tests cover this code.

Change-Id: I6068db78240c33a1dcefedc0c94e76740fd8d6e2
Partial-Bug: #1786055
2018-08-08 16:29:05 +01:00
Chris Dent
640d49f283 Add explicit functional-py36 tox target
Without this, you can successfully run a 'functional-py36' environment,
but no actual tests are run. Python 3.6 is common in many environments
these days, and we want devs to test locally. This helps.

Change-Id: I2c04b7a8b6ee06638c6ce92dc51e200fa2b13539
2018-08-08 11:03:25 +01:00
Zuul
fca4556af5 Merge "Use common functions in granular fixture" 2018-08-07 23:16:15 +00:00
Zuul
e57c643ec0 Merge "[placement] Add version directives in the history doc" 2018-08-07 23:15:58 +00:00
Matt Riedemann
0f98cfbb13 api-ref: fix min_version for parent_provider_uuid in responses
Due to a regression in I8624e194fe0173531c5aa2119c903e3c68b8c6cd, the
min_version on the parent_provider_uuid response parameter was missing
and is added back here. For sanity reasons, the variables are renamed
and substitution anchor usage is dropped.

To recap the microversions:

1.14
----

parent_provider_uuid and root_provider_uuid were added to the
responses for:

* GET /resource_providers (list)
* GET /resource_providers/{uuid} (show)
* PUT /resource_providers/{uuid} (update)

parent_provider_uuid was added to the request for:

* POST /resource_providers (create)
* PUT /resource_providers/{uuid} (update)

1.20
----

We started returning a response body from
POST /resource_providers (create) which included
parent_provider_uuid and root_provider_uuid but the parameters
are not versioned in that case since the entire response is
versioned for 1.20.

Change-Id: I6c9a1072fa2a59e408472f1a4b52b3a8c6a9b343
Closes-Bug: #1779700
2018-08-07 20:16:53 +09:00
Takashi NATSUME
9df90312b1 [placement] Add version directives in the history doc
Add 'versionadded' directives ("New in version Rocky.")
in microversion 1.28 and 1.29
in the placement API history document.

TrivialFix
Change-Id: If91da9d59938ecaca20f37aa25941d863299a88a
2018-08-07 16:55:59 +09:00
Zuul
7d3a8fd5af Merge "Use common functions in NonSharedStorageFixture" 2018-08-07 05:01:48 +00:00
Zuul
fdf622df5a Merge "Define irrelevant-files for tempest-full-py3 job" 2018-08-07 02:57:59 +00:00
Tetsuro Nakamura
db143a2ba2 Use common functions in granular fixture
For code refactoring purpose in the placement granular fixture
setup, this patch substitutes common functions in test_base.py
for existing local functions of _create_providers(),
_add_inventory(), and _set_traits().

Change-Id: I76a3f7d7e446e0f3af379f83c9d8333279884c73
2018-08-07 11:03:37 +09:00
Zuul
845ae6d9c7 Merge "Not use project table for user table" 2018-08-07 01:11:39 +00:00
Zuul
b4604cf273 Merge "Adds a test for getting allocations API" 2018-08-07 00:50:17 +00:00
Zuul
e3a609ea78 Merge "Refactor AllocationFixture in placement test" 2018-08-07 00:46:16 +00:00
Zuul
66e5f4baff Merge "[placement] Debug log per granular request group" 2018-08-06 20:46:25 +00:00
Zuul
573d2f144c Merge "Increase max_unit in placement test fixture" 2018-08-06 20:21:40 +00:00
ghanshyam
65f5b92e1a Define irrelevant-files for tempest-full-py3 job
tempest-full-py3 job runs on nova check and gate pipeline
as part of 'integrated-gate-py35' template.

Unlike tempest-full or other job, nova job definition list on
project-config side[1] does not define the irrelevant-files for
tempest-full-py job which leads to run this job on doc/test file
only change also.

This commit defines the irrelevant-files for tempest-full-py3 on
nova's zuul.yaml.

Closes-Bug: #1785425

[1] 57907fbf04/zuul.d/projects.yaml (L9283)

Change-Id: I887177c078a53c53e84289a6b134d7ea357dfbef
2018-08-06 15:05:52 +00:00
Matt Riedemann
e68362dfeb Add tempest-slow job to run the tempest slow tests
By default, tempest-full jobs don't run the "slow" tests
which test useful things like encrypted volumes, swap
volume, etc. The slow tests aren't part of the default
tempest run since they can be, well, slow.

Tempest has tempest-slow job now which run all the slow
tagged tests.[1]

Detailed discussion on ML[2].

[1] http://git.openstack.org/cgit/openstack/tempest/tree/.zuul.yaml#n146
[2] http://lists.openstack.org/pipermail/openstack-dev/2018-May/130394.html

Change-Id: I5cb829beebcc59de682cba927f5b01793ec70d00
2018-08-06 07:59:03 +00:00