Commit Graph

16 Commits

Author SHA1 Message Date
Stephen Finucane 97d25371b3 scheduler: Remove 'USES_ALLOCATION_CANDIDATES'
There is only one scheduler driver now. This variable is no longer
necessary.

We remove a couple of test that validated behavior for scheduler drivers
that didn't support allocation candidates (there are none) and update
the test for the 'nova-manage placement heal_allocations' command to
drop allocations instead of relying on them not being created.

Change-Id: I64dc67e2bacd7a6c86153db5ae983dfb54bd40eb
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-06-29 11:40:04 +01:00
Stephen Finucane c269285568 tests: Move remaining non-libvirt fixtures
Move these to the central place. There's a large amount of test damage
but it's pretty trivial.

Change-Id: If581eb7aa463c9dde13714f34f0f1b41549a7130
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2021-05-12 16:32:43 +01:00
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
Adam Spiers d47f1db49e Switch some GitHub URLs to point to opendev.org
Also update some outdated URLs at the same time, e.g. defcore is now
interop.

Unfortunately unlike GitHub, gitea doesn't yet support URLs with
shortened SHA1s; however this is being worked on:

    https://github.com/go-gitea/gitea/issues/6450

Change-Id: I6e6b63619f1138cc961b61be548453361d01f73c
2019-08-19 21:08:27 +01:00
Balazs Gibizer b5666fb492 Remove global state from the FakeDriver
The virt driver FakeDriver used in both the functional and in the unit
test used a global state to configure the host and node names the driver
reports. This was hard to use when more then one compute service is started.
Also global state is dangerous.

It turned out that only a set of unit tests are using multiple nodes per
compute the rest of the tests can simply use host=<hostname>,
nodes=[<hostname>] setup.

So this removes the global state.

Change-Id: I2cf2fcbaebc706f897ce5dfbff47d32117064f9c
2019-06-21 10:37:20 +02:00
Stephen Finucane 8f6de35636 tests: Stop starting consoleauth in functional tests
This hasn't been needed since we moved console authentication to the
database in Rocky.

Part of blueprint remove-consoleauth

Change-Id: Ie5e7d70f9d6af77edd22756128937f06d0b961a9
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-06-17 15:18:31 +01:00
Takashi NATSUME bda4ae3884 Remove duplicate cleanup in functional tests
It is not necessary to call the following statement multiple times in
some functional tests.

self.addCleanup(fake.restore_nodes)

So remove duplicate calls in the tests.

TrivalFix
Change-Id: Iaae6fc4a66145576f4a4fc1cea452ef6acbadb15
2019-03-07 23:58:58 +00: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
Matt Riedemann 25dadb94db Remove the CachingScheduler
The CachingScheduler has been deprecated since Pike [1].
It does not use the placement service and as more of nova
relies on placement for managing resource allocations,
maintaining compabitility for the CachingScheduler is
exorbitant.

The release note in this change goes into much more detail
about why the FilterScheduler + Placement should be a
sufficient replacement for the original justification
for the CachingScheduler along with details on how to migrate
from the CachingScheduler to the FilterScheduler.

Since the [scheduler]/driver configuration option does allow
loading out-of-tree drivers and the scheduler driver interface
does have the USES_ALLOCATION_CANDIDATES variable, it is
possible that there are drivers being used which are also not
using the placement service. The release note also explains this
but warns against it. However, as a result some existing
functional tests, which were using the CachingScheduler, are
updated to still test scheduling without allocations being
created in the placement service.

Over time we will likely remove the USES_ALLOCATION_CANDIDATES
variable in the scheduler driver interface along with the
compatibility code associated with it, but that is left for
a later change.

[1] Ia7ff98ff28b7265058845e46b277317a2bfc96d2

Change-Id: I1832da2190be5ef2b04953938860a56a43e8cddf
2018-10-18 17:55:36 -04:00
Matt Riedemann 5fe80b6339 (Re)start caching scheduler after starting computes in tests
This moves the scheduler restart logic from the heal_allocations
tests into a more generic location (like restart_compute_service)
so that we can re-use it in other functional tests that rely on
the caching scheduler. There are a couple of other tests that don't
need to restart the scheduler if we just move the start of the
scheduler to after we start the computes.

Change-Id: I7720fe4a3a0e537b7b356947317766597d4b47cf
Related-Bug: #1781648
2018-08-29 13:16:09 -04:00
Ed Leafe d913de7471 Make conductor pass and use host_lists
The earlier patches in the series generated alternates and Selection
objects, and modified the RPC calls to send them to the conductor. This
patch has the conductor pass these host_lists to the compute for the
build process, and, if the build fails, has the compute pass the
host_list back to the conductor.

Also fixes a bug in the scheduler manager exposed by this change
when using the CachingScheduler in a reschedule functional test.

Blueprint: return-alternate-hosts

Change-Id: Iae904afb6cb4fcea8bb27741d774ffbe986a5fb4
2017-12-21 17:02:35 -05:00
Balazs Gibizer cc83335987 replace chance with filter scheduler in func tests
FilterScheduler is the only scheduler driver that properly integrated
with placement api so this patch changes the functional test environment
to use the FilterScheduler instead of the ChanceScheduler.

The amount of vcpu the SmallFakeDriver reports need to be bumped to 2
as during resize to same host the filter scheduler doubles the
allocation on the host. Simply relying on the 16.0 default allocation
ratio does not work as the max_unit of the vcpu does not use the
allocation ratio to avoid that a single server overallocates the cpu.

The only change in unit test is
test_create_instance_with_oversubscribed_cpu which also loads the
SmallFakeDriver and asserts available resources on it.

Change-Id: I12de2e195022593ea2a3e2894f2c3b5226930d4f
2017-08-16 14:42:51 +00:00
Takashi NATSUME b32174f22e Stop using mox stubs in cast_as_call.py
Replace mox stubs with stub_out
in nova/tests/unit/cast_as_call.py.

Change-Id: I416835a2fa0ad807f3c35c3cb14b0f463a5d1145
Implements: blueprint remove-mox-pike
2017-07-25 00:40:41 +00:00
melanie witt b6b5438c3d Fix functional regression/recreate test for bug 1671648
There are a couple of issues with the test:

  1. It doesn't consider both hosts from the two compute services
     during scheduling.

  2. There is a race where sometimes claims.Claim.__init__ won't
     be called because if the RT instance_claim runs before
     update_available_resource has run, it will create a
     claims.NopClaim instead.

This adds the RetryFilter to enabled_filters, adds set_nodes() calls
to set the nodenames of each compute service to match its host,
resulting in consideration of both hosts for scheduling, and stubs
resource_tracker.ResourceTracker.instance_claim instead of
claims.Claim.__init__.

Related-Bug: #1671648

Change-Id: I541c03a7960b8f135b005c43cb5c7bcb0b63b9ae
2017-03-16 19:39:37 -04:00
ShunliZhou cb4ce72f5f Add populate_retry to schedule_and_build_instances
When boot an instance and failed on the compute node, nova will
not retry to boot on other host.

Since https://review.openstack.org/#/c/319379/ change the create
instance workflow and called schedule_and_build_instances which
not populate the retry into filter properties. So nova will not
retry when boot on compute fail. This patch populate retry to
instance properties when call schedule_and_build_instances.

Change-Id: Ifdaddcd265a7fe8282499e27043936f8212610ad
Closes-Bug: #1671648
2017-03-15 21:18:47 -04:00
Matt Riedemann 72e1506101 Add a functional regression/recreate test for bug 1671648
This adds a test which recreates the regression bug introduced
in Ocata where build retries are not populated when creating
instances in conductor for cells v2.

The change that fixes the bug will go on top of this and modify
the test to show the bug is fixed.

Change-Id: Ie9e955d79b4e1441092183135b3f70b003c94db5
Related-Bug: #1671648
2017-03-15 21:14:42 -04:00