This fixes the json response body for GET /allocations/{consumer_id}
in _serialize_allocations_for_consumer.
Change-Id: I3425267cd1e8563eb89cda83ae1ed07ee782526e
Running under a real wsgi environment, such as uwsgi or apache /
mod_wsgi is preferred now, and there is a different logging solution
for that. This was always an eventlet leaky abstraction. So we'll just
deprecate this for now, and the code can be removed once eventlet on
the API side is removed.
Change-Id: I934a1693cbfd539d8575d022519510d19d13aaab
In the notification sample tests big json structures are asserted.
If the difference is only in the number of keys in a dict or in
the number of items in a list then the current assert only states
the number of items. If the list or dict is big it is quite hard to
see what is the missing key or item.
This patch adds more descriptive output to the error message if the
json structures are not equal.
Error message without this patch: http://paste.openstack.org/show/616525/
Error message with this patch: http://paste.openstack.org/show/616526/
Change-Id: Iec15c9ea863db6bbe18afd64bd00a0780798cdf8
The only user of this util method is libvirt, so it should live there.
This is a precursor to re-writing its single caller to use privsep to
read bytes instead of chown'ing files.
Change-Id: Ice5cc70eeef3fbeee9a1a0ec0daa801c6f74480c
To lessen the amount of eventlet socket handling present in the
functional tests, run osapi_compute via wsgi-intercept rather than
spawning an eventlet server to run it in a "thread".
To get this to work three main changes are made to the fixture:
* gain access to the wsgi app via Loader().load_app. This is used
because it involves the least amount of manipulation of CONF. The
init_application in nova/api/openstack/wsgi_app.py tries to
re-read configuration.
* manually register the osapi_compute service (previously built
in as a result of using WSGIService)
* Override the TCPKeepAliveAdapter keystone session adapter. It's
use of socket_options does not work will with the way that six and
wsgi-intercept mess with the HTTPConnection class.
The change in integrated_helpers is required because the new fixture
must provide access to the WSGI app in a different way.
Change-Id: Ia91fd7d7605dfb1a6f4376b1680cd26ea410d0f3
Related-Bug: #1705753
Because we capture stderr during test runs we see warnings that we
have no ability to really impact. 3 of these should just be further
suppressed.
1) Anything dealing with pkg_resources, we consume this through
intermediary layers only, and these warnings have been around forever.
2) Policy enforcement warnings, as is_admin was deprecated well before
there was a transition forward.
3) Anything out of mox3. We're just trying to delete this. No one is
fixing that module as it's effectively dead.
Change-Id: I5eaf953b6a2b0a3efe215f776aa048433b192e90
Using wsgi_intercept to run the placement API in the PlacementFixture,
instead of spawning an eventlet server. This should help with the weird
situation where sometimes requests that are supposed to go to compute or
placement go to the other.
Some combination of six or wsgi-intercept is not happy with the use of
socket_options in the keystoneauth1.session.TCPKeepAliveAdapter, so a
MonkeyPatch is used to skip over it and use the parent Adapter.
The change here continues to monkeypatch the report client so that we
don't have to monkey patch keystone's auth and endpoint handling. We
don't want that as it will also patch the nova side of things.
Change-Id: I03b3abea152d45575ac6dde22ccbe32b6acb4646
Related-Bug: #1705753
Each gabbi yaml file is supposed to be an isolated sequence. The
fixtures were already making sure that the database was wiped, and the
traits sync was reset, but not making sure the _RC_CACHE used to cache
mappings between resource class strings and ids was flushed.
This change clears the _RC_CACHE in the APIFixture stop_fixture method.
For sake of information:
Before fixing the issue it was confirmed by running the two gabbi files
indicated in the bug report, in sequence, in a single process:
.tox/functional/bin/python -m subunit.run discover \
nova.tests.functional.api.openstack.placement \
--load-list /tmp/runthese |subunit-trace
Where runthese contains (with fully qualified package name prefixes):
test_placement_api.allocation-bad-class_allocate_some_of_it_standard.test_request
test_placement_api.resource-class-in-use_delete_resource_class.test_request
Change-Id: Icb3beef7964887f29bf8cca95ac7dbae1511876d
Closes-Bug: #1706207
Few microversions unittest still depend on the stevedore to load few
fake controller. This patch uses the plain routes to instead of stevedore.
For the unittest can injects routes which are used for test, the `custom_routes`
parameter is added to the APIRouterV21.
Partial-implement-blueprint api-no-more-extensions-pike
Change-Id: I1a7c653ab21be41b1a41f748a35ec9a57dd8b15d
The extension/plugin mechanism is removed from the Nova API. This
patch removed related unittest.
Partial-implement-blueprint api-no-more-extensions-pike
Change-Id: I1c5a1dccb08bd0b869cb206b247d6cb744e76163
This patch adds versions related routes by a plain list,
instead of using stevedore.
After all the Nova API endpoints moves to the plain routes list,
the usage of stevedore for API loading will be removed from Nova
To support the redirection from '' to '/', this patch also
enables to put a target patch instead of a dict with supported
methods in the ROUTE_LIST.
Partial-implement-blueprint api-no-more-extensions-pike
Change-Id: Iba340c5dd66cf9d006e2e8d3d0674b2140915014
As part of cleaning up the Nova code base around the Cinder
interaction snippets check_attach was recently removed as Cinder
keeps track of the volume state and performs the necessary checks.
To move forward with the code clean up the other half of these checks
check_detach is proposed for removal due to the same reason.
As we are now introducing the new Cinder attach/detach API in Nova
it is important to make it as straight forward as possible and use
this as an opportunity to clean up the code and remove the parts we
don't need anymore. As part of this activity we are working on to
be able to support volume multi-attach, which will be easier if each
service has their own set of responsibilities.
This patch also handles error translation by catching
InvalidInput exception and raising InvalidVolume to match the former
error handling.
check_detach could also raise VolumeUnattached exception which was
added in preparation to multi-attach support. In case of normal
attach we will hit InvalidVolume before VolumeUnattached, therefore
it is safe to remove that for now. VolumeUnattached is also fully
removed from the code now to stop the status check on volumes
on the Nova side completely.
Change-Id: If63dbd236ce0970ea245707cacb2664e3fdbdfd1
The PUT /allocations Placement API handler was improperly calling
LOG.exception() when two normal-operation events were occurring:
1) When a concurrent attempt to allocate against the same resource
providers had occurred
2) When, due to another process consuming resources concurrently
resulted in capacity being exceeded on one or more of the requested
providers
Neither of the above scenarios is a software error and so the
LOG.exception() calls have been removed.
Change-Id: I569b28313e52d979ac9be5bea88c021a0664d851
Fixes-bug: #1705487
server_external_events was previously making an api db query and a
cell db query for every instance reference. We improve this by
making exactly 1 api db query to fetch all instance mappings, and then
1 cell db query per cell to fetch all relevant instances from that
cell. Further, it wasn't properly handling the case where events
were delivered in one request for multiple instances across cells,
which this also fixes.
We also document an obtuse edge condition in
ComputeAPI.external_instance_event which will cause the current code
to break when we support migration between cells.
Note this includes a tweak to the SingleCellSimple fixture to mock out
the new InstanceMappingList method we use, as well as a fix to the other
InstanceMapping mock, which was returning mappings with bogus instance
uuids. This patch relies on the results of those being realistic and
thus requires those changes.
Closes-Bug: #1702959
Co-Authored-By: Dan Smith <dms@danplanet.com>
Change-Id: If59453f1899e99040c554bcb9ad54c8a506adc56