Commit Graph

14 Commits

Author SHA1 Message Date
Stephen Finucane cc45581a18 functional: Add and use 'GlanceFixture'
This rather beefy (but also quite simple) patch replaces the
'stub_out_image_service' call and associated cleanup in all functional
tests with a new 'GlanceFixture', based on the old 'FakeImageService'.
The use of a fixture means we don't have to worry about teardown and
allows us to stub Glance in the same manners as Cinder, Neutron,
Placement etc.

Unit test cleanup is handled in a later patch.

Change-Id: I6daea47988181dfa6dde3d9c42004c0ecf6ae87a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-09-16 11:31:23 +01:00
Stephen Finucane 1515a229e3 Remove future imports
These particular imports are no longer needed in a Python 3-only world.

Change-Id: Ia1b60ce238713b86f126e2d404199d102fdbc5bc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2020-03-24 15:05:36 +00:00
Zuul 4f69d8e6c7 Merge "Add JSON schema and test for network_data.json" 2020-02-18 18:57:16 +00:00
Ilya Etingof 69ee625a66 Add JSON schema and test for network_data.json
Added JSON schema defining `network_data.json` contents and
beefed up the MetadataTest functional test cases to use a
real instance instead of a database shell. This way the
tests see real data in the metadata service like a real
network_data.json.

Besides internal Nova consumption, this schema might be
helpful to other tools (such as ironic or Glean) to
validate human-generated `network_data.json` prior to
using it.

Co-Authored-By: Balazs Gibizer <balazs.gibizer@est.tech>
Change-Id: Ie5a5a1fc81c7c2d3f61b72d19de464cfc9dab5ec
2020-02-17 15:35:24 +01:00
Stephen Finucane 9142a97f24 nova-net: Remove final references to nova-net from functional tests
Most of this is just removal of unnecessary 'use_neutron=True' conf
overrides. The sole exception is the conversion of the metadata API
tests, which turned out to be far less effort to convert than I
expected.

Change-Id: I5114bf13e7df95ed02be70f29d453116387d4f9c
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-11-29 17:20:02 +00:00
Stephen Finucane fadeedcdea nova-net: Remove layer of indirection in 'nova.network'
At some point in the past, there was only nova-network and its code
could be found in 'nova.network'. Neutron was added and eventually found
itself (mostly!) in the 'nova.network.neutronv2' submodule. With
nova-network now gone, we can remove one layer of indirection and move
the code from 'nova.network.neutronv2' back up to 'nova.network',
mirroring what we did with the old nova-volume code way back in 2012
[1]. To ensure people don't get nova-network and 'nova.network'
confused, 'neutron' is retained in filenames.

[1] https://review.opendev.org/#/c/14731/

Change-Id: I329f0fd589a4b2e0426485f09f6782f94275cc07
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-01-15 14:57:49 +00:00
Stephen Finucane 4e1eb8a2b5 ec2: Move ec2utils functions to their callers
All of these functions only have a single caller now, so move them to
their calling site. Two functions are renamed to better fit their
purpose but there is otherwise no change in functionality.

Change-Id: I48237f306fb901dec9ec805704c891fd3cbb12e3
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-09-27 15:27:08 +01:00
Stephen Finucane 97549a2c41 Handle unsetting '[DEFAULT] dhcp_domain'
Fix a long-standing issue whereby setting 'dhcp_domain' to 'None' would
result in a hostname of '${hostname}None' instead of '${hostname}'.

Change-Id: Ic9aa74f5344ba469b61a87de1ebd27e6f49c3318
Closes-Bug: #1824813
2019-04-15 15:34:04 -04:00
Chris Dent 787bb33606 Use external placement in functional tests
Adjust the fixtures used by the functional tests so they
use placement database and web fixtures defined by placement
code. To avoid making redundant changes, the solely placement-
related unit and functional tests are removed, but the placement
code itself is not (yet).

openstack-placement is required by the functional tests. It is not
added to test-requirements as we do not want unit tests to depend
on placement in any way, and we enforce this by not having placement
in the test env.

The concept of tox-siblings is used to ensure that the
placement requirement will be satisfied correctly if there is a
depends-on. To make this happen, the functional jobs defined in
.zuul.yaml are updated to require openstack/placement.

tox.ini has to be updated to use a envdir that is the same
name as job. Otherwise the tox siblings role in ansible cannot work.

The handling of the placement fixtures is moved out of nova/test.py
into the functional tests that actually use it because we do not
want unit tests (which get the base test class out of test.py) to
have anything to do with placement. This requires adjusting some
test files to use absolute import.

Similarly, a test of the comparison function for the api samples tests
is moved into functional, because it depends on placement functionality,

TestUpgradeCheckResourceProviders in unit.cmd.test_status is moved into
a new test file: nova/tests/functional/test_nova_status.py. This is done
because it requires the PlacementFixture, which is only available to
functional tests. A MonkeyPatch is required in the test to make sure that
the right context managers are used at the right time in the command
itself (otherwise some tables do no exist). In the test itself, to avoid
speaking directly to the placement database, which would require
manipulating the RequestContext objects, resource providers are now
created over the API.

Co-Authored-By: Balazs Gibizer <balazs.gibizer@ericsson.com>
Change-Id: Idaed39629095f86d24a54334c699a26c218c6593
2018-12-12 18:46:49 +00:00
Anh Tran b3cbd71b1a Remove unused logging import
Change-Id: I384312b3eba012367de794517b6eeb1828c35f3c
2017-02-17 15:17:51 +07:00
Michael Still 1f53bfcc79 Use a service account to make vendordata requests.
We should use a service account to make requests to external
vendordata services. This something which we got wrong in the
newton cycle, and discussed how to resolve at the ocata summit.

It is intended that this fix be backported to newton as well.

There is a sample external vendordata server which has been
tested with this implementat at:

   https://github.com/mikalstill/vendordata

Change-Id: I7d29ecc00f99724731d120ff94b4bf3210f3a64e
Co-Authored-By: Stephen Finucane <sfinucan@redhat.com>
2017-01-26 13:39:46 +00:00
Matt Riedemann 6627de4aa5 Enable Neutron by default
This changes the use_neutron configuration option default
value to True. nova-network has been deprecated since Newton
and only runs in a cells v1 configuration now, so it's time
to make Neutron the default configuration for new Nova
deployments.

As far as testing, the unit tests have already been taken
care of for use_neutron=True by default. There are several
functional tests which are converted over to using Neutron
via the fixture in this change. However, the legacy API
samples functional tests were written with nova-network stubs
so it will take some time to convert over to using Neutron
stubs. This patch does not attempt to clean all of those up
and just configures nova-network by default. The remaining
tests will need to be converted to using Neutron in a later
series of changes.

Depends-On: I82721b5d10711401b9b0ebc2b0ed07cc8287bbf7

Implements blueprint use-neutron-by-default

Change-Id: I8388c29ad310cd8800084b4d5c026013158bfbed
2017-01-04 10:09:00 -05:00
Maciej Szankin b7b282ed08 conf: Move api options to a group
Change-Id: Ida4ee57d6e1822e35e3198f6d3a89410e211d57d
Implements: bp centralize-config-options-ocata
2016-11-25 16:32:31 -06:00
Michael Still 34b5ea5f44 New style vendordata support.
The nova team would like to stop dynamically loading python modules to
implement vendordata in the metadata service and configdrive. Instead, we
propose to provide a module which can fetch dynamic vendordata from an
external REST server.

Things still to do:
  - Documentation
  - Support HTTP caching headers
  - Cache vendordata responses
  - Write vendordata documentation
  - Unit test coverage of requests exceptions
  - Unit test coverage of attempted vd overwrites

Blueprint: vendordata-reboot
Change-Id: I19c61a637a640a00f90c6bc8e82c38e7d4084493
2016-07-26 08:15:25 -04:00