Commit Graph

53 Commits

Author SHA1 Message Date
Stephen Finucane 89ef050b8c Use unittest.mock instead of third party mock
Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib. Most of this
is autogenerated, as described below, but there is one manual change
necessary:

nova/tests/functional/regressions/test_bug_1781286.py
  We need to avoid using 'fixtures.MockPatch' since fixtures is using
  'mock' (the library) under the hood and a call to 'mock.patch.stop'
  found in that test will now "stop" mocks from the wrong library. We
  have discussed making this configurable but the option proposed isn't
  that pretty [1] so this is better.

The remainder was auto-generated with the following (hacky) script, with
one or two manual tweaks after the fact:

  import glob

  for path in glob.glob('nova/tests/**/*.py', recursive=True):
      with open(path) as fh:
          lines = fh.readlines()
      if 'import mock\n' not in lines:
          continue
      import_group_found = False
      create_first_party_group = False
      for num, line in enumerate(lines):
          line = line.strip()
          if line.startswith('import ') or line.startswith('from '):
              tokens = line.split()
              for lib in (
                  'ddt', 'six', 'webob', 'fixtures', 'testtools'
                  'neutron', 'cinder', 'ironic', 'keystone', 'oslo',
              ):
                  if lib in tokens[1]:
                      create_first_party_group = True
                      break
              if create_first_party_group:
                  break
              import_group_found = True
          if not import_group_found:
              continue
          if line.startswith('import ') or line.startswith('from '):
              tokens = line.split()
              if tokens[1] > 'unittest':
                  break
              elif tokens[1] == 'unittest' and (
                  len(tokens) == 2 or tokens[4] > 'mock'
              ):
                  break
          elif not line:
              break
      if create_first_party_group:
          lines.insert(num, 'from unittest import mock\n\n')
      else:
          lines.insert(num, 'from unittest import mock\n')
      del lines[lines.index('import mock\n')]
      with open(path, 'w+') as fh:
          fh.writelines(lines)

Note that we cannot remove mock from our requirements files yet due to
importing pypowervm unit test code in nova unit tests. This library
still uses the mock lib, and since we are importing test code and that
lib (correctly) only declares mock in its test-requirements.txt, mock
would not otherwise be installed and would cause errors while loading
nova unit test code.

[1] https://github.com/testing-cabal/fixtures/pull/49

Change-Id: Id5b04cf2f6ca24af8e366d23f15cf0e5cac8e1cc
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2022-08-01 17:46:26 +02:00
Balazs Gibizer f1f599d098 Create a fixture around fake_notifier
The fake_notifier uses module globals and also needs careful stub and
reset calls to work properly. This patch wraps the fake_notifier into a
proper Fixture that automates the complexity.

This is fairly rage patch but it does not change any logic just redirect
calls from the fake_notifier to the new NotificationFixture

Change-Id: I456f685f480b8de71014cf232a8f08c731605ad8
2021-05-24 11:00:59 +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
Stephen Finucane 458d37fceb functional: Add unified '_build_server' helper function
'_IntegratedTestBase' has subclassed 'InstanceHelperMixin' since change
I0d21cb94c932e6e556eca964c57868c705b2d120, which means both now provide
a '_build_minimal_create_server_request' function. However, only
'_IntegratedTestBase' provides a '_build_server' function. The
'_build_minimal_create_server_request' and '_build_server' functions do
pretty much the same thing but there are some differences. Combine these
under the '_build_server' alias.

Change-Id: I91fa2f73185fef48e9aae9b7f61389c374e06676
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-01-15 10:31:24 +00:00
Stephen Finucane df00177093 nova-net: Remove final references to nova-network
Strip out everything matching '(is|use)_neutron', except the tests for
nova-network code and two other places that these tests rely on. Along
the way, remove a whole load of apparently unnecessary mocking that
clearly wasn't caught when we switched over the bulk of testing to use
the neutron network driver.

Change-Id: Ifa9c5c468400261a5e1f66b72c575845173a4f8f
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2020-01-08 13:54:12 +00:00
Stephen Finucane 7ae1a10913 functional: Remove 'api' parameter
Pretty much every test case in 'nova.tests.functional' defines an 'api'
attribute, and many define an 'admin_api' attribute. We can pull these
from the class rather than explicitly passing them to helpers. Rework
things so this happens.

Note that the bulk of the changes here are in the
'nova/tests/functional/integrated_helpers.py' file. The rest of the
changes were auto-generated using the following script (my sed-fu is
non-existent):

  $ cd nova/tests/functional
  $ python3
  >>> import glob
  >>> import re
  >>> pattern = r'_state_change\((\n\s+)?self\.(admin_)?api,\s+'
  >>> replace = r'_state_change(\1'
  >>> for path in glob.glob('*.py') + glob.glob('*/*.py'):
  ...     with open(path) as fh:
  ...         data = fh.read()
  ...     new = re.sub(pattern, replace, data, flags=re.MULTILINE)
  ...     if new != data:
  ...         with open(path, 'w') as fh:
  ...             fh.write(new)
  ...
  >>> quit()

(ditto for the other substitutions)

Some manual fixups were required after, which pre-commit highlighted :)

Change-Id: I8c96b337f32148f8f5899c9b87af331b1fa41424
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2019-12-06 15:35:33 +00:00
Matt Riedemann 5294af8b92 Dump versioned notifications when len assertions fail
When versioned notification sample tests fail asserting
the number of expected notifications it is easier to debug
what is wrong if we have the tracked notifications in the
MismatchError message, so this adds that for the test_instance
and test_compute_task modules and one spot in the base class.

Change-Id: Ibc31e6af1ab4eecb7add065976315647d54e05a6
2019-08-08 19:27:33 -04:00
Balazs Gibizer a428601cb6 Do not start nova-network in the notification func test
The notification sample tests uses neutron from day 0 but somehow it
also starts the nova-network service. This is unnecessary so this patch
removes it.

Change-Id: Ieac9791928822b26e590d99965632225acb9a464
2019-05-23 13:05:07 +02:00
Michael Still 7b9bc39024 Move binding ips to privsep.
Change-Id: If76fc076e964c9492727dabdc1f5d7e9c295c7fe
2019-02-08 00:23:06 +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
Előd Illés 70c7ba7324 Transform scheduler.select_destinations notification
Transform the scheduler.select_destinations.start and
scheduler.select_destinations.end notifications to the
versioned notification framework.

Change-Id: I019e88fabd1d386c0d6395a7b1969315873485fd
Implements: bp versioned-notification-transformation-stein
2018-11-30 13:20:35 +01:00
Alex Szarka fe4e47d989 Transform compute_task notifications
The following notifications have been transformed to
the versioned notification framework.

* compute_task.build_instances
* compute_task.migrate_server
* compute_task.rebuild_server

Co-Authored-By: Takashi Natsume <natsume.takashi@lab.ntt.co.jp>
Change-Id: Ibfb0a6db5920d921c4fc7cabf3f4d2838ea7f421
Implements: bp versioned-notification-transformation-stein
2018-11-21 16:23:28 +09:00
Matthew Booth c333e7e12e Raise error on timeout in wait_for_versioned_notifications
fake_notifier.wait_for_versioned_notifications previously returned
None if it timed out. This is counter-intuitive, and several callers
were failing to check its return. Every one of these represents a race
as it means we can continue past a barrier without its condition
having been met.

This change makes it default to safe by raising an exception if it
times out. Note that it's possible this may subsequently result in new
non-deterministic errors in functional. I would consider this a
feature, as these were previously hidden. They should be addressed
individually.

This change highlights several deterministically incorrect uses of
wait_for_versioned_notifications which were previously always silently
timing out. These are all fixed.

We also increase the default timeout from 1 to 10 seconds as we seem
to hit the 1 second timeout in practise, e.g.:

  http://logs.openstack.org/46/578846/14/check/nova-tox-functional/8a444c1/job-output.txt.gz

Change-Id: I017d1a31139c9300642dd706eadc265f7c954ca8
2018-09-29 00:29:49 +01:00
Kevin_Zheng 94de8d75ff Add request_id to instance action notifications
As it was agreed on the Rocky PTG [1] it is useful to have the
request_id of in the payload of every instance action versioned
notification. For example it could help the deployer connect
the state change described in the notification with the user
action, the request, on the REST API.

So this patch proposes to extend the InstanceActionPayload
versioned object with a new request_id field and populate
the request_id from the context object used for emitting
the instance action notifications.

[1] https://etherpad.openstack.org/p/nova-ptg-rocky L391

Implements: bp add-request-id-to-instance-action-notifications

Change-Id: I7243b60938d6e9c7c2bc2aacdba5c667cca8ec9b
2018-04-19 13:06:59 -04:00
Takashi NATSUME c4397d5e5a Transform servergroup.addmember notification
The servergroup.addmember notification has been transformed
to the versioned notification framework.

Change-Id: I5291e453ba06f0f26c4928e4f7482c40e725a781
Implements: bp versioned-notification-transformation-rocky
2018-03-06 22:03:00 +00:00
Balazs Gibizer 8b444de795 Increase notification wait timeout in functional tests
In the baseline the wait_for_notification() functional test util
function by default waits maximum 1 second for a notification to
arrive. Based on recent gate failures it seems that it is not enough
in some cases for the notitification to arrive. Therefore this patch
bumps the default timeout to 10 seconds. This will only make the test
execution slower if the notifiication arrives later or does not even
arrive. So in the happy case the test execution will not be slower.

Change-Id: I75e2bcd87535de7e44bdf317c3ab12ba8952dcca
Closes-Bug: #1742688
2018-01-11 14:23:15 +01:00
Balazs Gibizer 937db90146 Stabilize test_live_migration_abort func test
The test_live_migration_abort test step in the
test_live_migration_actions notification sample test was unstable.
The test starts a live migration and then deletes the migration object
via the REST API to abort it. The test randomly failed to find the
migration object on the REST API. Based on the comparision of the logs
of the successful and unsuccesful runs it was visible that in the
unsuccesful case the test gave up to wait for the migration object too
early. In a succesful run it took 1.5 seconds after the the migration
API call to have the migration object appear on the API while in an
unsuccessful case the test gave up after 1 second.

This early give up was cause by the fact that the loop trying to
get a migration does not applied any delay between such trials and
therefore the 20 attempts run out quickly.

This patch introduces a short sleep between trials to stabilize the
test.

Change-Id: I6be3b236d8eadcde5714c08069708dff303dfd4d
Closes-Bug: #1736976
2017-12-12 16:50:39 +01:00
liyingjun 8e793a6c6f Versioned notifications for service create and delete
New notifications service.create and service.delete are introduced
with INFO priority and the payload of the notification is the serialized
form of the already existing Service versioned object. Service.create
notification will be emitted after the service is created (so the uuid
is available) and also send the service.delete notification after the
service is deleted.

Implement blueprint: service-create-destroy-notification

Change-Id: I955d98f9fd4b121f98e172e5ab30eb668a24006d
2017-11-27 11:11:44 -05:00
Zuul a41c484d3e Merge "Factor out duplicated notification sample data" 2017-11-11 01:50:36 +00:00
Alex Szarka b4b61240f7 Transform instance-live_migration_abort notification
Co-Authored-By: Gábor Antal <antal@inf.u-szeged.hu>
Change-Id: I27608f60dd5f8458e476286c6991c47dba7852b1
Implements: bp versioned-notification-transformation-queens
2017-11-06 16:05:16 +01:00
Balazs Gibizer 5a5155ea4e Factor out duplicated notification sample data
Versioned notifications are functionally tested against stored sample
data. Also most of the instance notitication shares payload structure.
Today we store a separate sample for every instance notification.
These samples store similar, mostly redundant data. When a new field
is added to the InstancePayload then every instance notification
related sample file needs to be modified. This leads to big and
redundant changes like I18af99479562e2fe5e74e6e1252b804b074fee58.

To remove the redundancy this patch proposes to use json references
in the sample files instead of copy pasting the same notification
sample fragment to every sample.

As a first step this patch introduces a small json ref resolver.
Then subsequent patches will replace the duplicated sample data
with references to common sample fragments.

This proposed resolver supports resolving the refs recursively so
a referenced json fragment can reference further fragments. However
the current implementation does not handle reference loops.
The resolver also supports overriding parts of the referenced
json fragment to support content customization needed in the next
patch.

Change-Id: Ic3ab7d60e4ac12b767fe70bef97b327545a86e74
2017-11-03 11:36:57 +01:00
Béla Vancsics a4c7ab8851 Transform keypair.import notification
The keypair.import.start and keypair.import.end notifications
has been transformed to the versioned notification framework.

Change-Id: Icadc53d84fa021aae0f9ec2e18e9125de98e00f6
Implements: bp versioned-notification-transformation-queens
2017-10-30 16:44:29 -04:00
melanie witt 956a17ec2f Make expected notifications output easier to read in tests
Some notifications tests use a list of expected notifications to
compare and when such a test fails, it's difficult to debug which
notification is missing and why. This adds a newline between each
expected notification to make them easier to read when debugging.

Change-Id: Ibce59077be071cab9514883ebc958e8cd464f693
2017-10-11 15:43:52 +00:00
Matthew Booth ea00db9cca fake_notifier: Refactor wait_for_versioned_notification
A subsequent change will add wait_for_legacy_notifications(). This
refactor achieves 2 things:

* Make it easier to return the notifications we were waiting for,
  required in both current tests and subsequent legacy tests.
* Allow code re-use between fake legacy and versioned notifications.

It incidentally fixes a minor bug in
NotificationSampleTestBase._wait_for_notifications where we may wait for
up to double the specified timeout. It is also thread safe without
having to audit all code paths for potential eventlet context switch
points.

Change-Id: Ie4676eed0039c927b35af7573f0b57fd762adbaa
2017-09-12 14:20:05 +00: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
Balazs Gibizer 8dd11ca1b3 Test resize with placement api
Test cases for resize with confirm and revert scenarios have been
added.

This test depends on the periodic update_available_resources call to heal
the resource allocations. The fake virt driver needed to be tweaked to
work when more than one compute service is created and periodic tasks
are enabled.

The accounting of the current code is very incorrect at the moment, so this
asserts the existing (wrong) behavior, but marks the actual expected
values everywhere so that we can follow up with fixes to remove all of the
annotations.

Change-Id: If7b02bcd8d77e94c7fb42b721792c1391bc0e3b7
blueprint: placement-claims
2017-08-01 11:49:26 -04:00
Gábor Antal 47469ac868 Add helper method for waiting migrations in functional tests
In functional tests, this method will be used in some places. This
method waits for the migrations and if there is at least one  active
migration in progress, the method return with the migrations.

Change-Id: Ia068de2dac34f2399025fb28fec9af75c1442d63
Co-Authored-By: Alex Szarka <szarka@inf.u-szeged.hu>
Implements: bp versioned-notification-transformation-pike
2017-07-26 10:23:35 +02:00
Dan Peschman 2f7bf29d47 Use uuid for id in os-services API
This patch introduces a new microversion to identify services by uuid
instead of id, to ensure uniqueness across cells. GET /os-services
returns uuid in the id field, and uuid must be provided to delete a
service with DELETE /os-services/{service_uuid}.

The old PUT /os-services/* APIs are now capped and replaced
with a new PUT /os-services/{service_uuid} which takes a uuid path
parameter to uniquely identify the service to update. It also restricts
updates to nova-compute services only, since disabling or forcing-down
a non-compute service like nova-scheduler doesn't make sense as it
doesn't do anything.

The new update() method in this microversion also avoids trying to
re-use the existing private action methods like _enable and _disable
since those are predicated on looking up the service by host/binary,
are confusing to follow for code flow, and just don't really make sense
with a pure PUT resource update method.

Part of blueprint service-hyper-uuid-in-api

Co-Authored-By: Matt Riedemann <mriedem.os@gmail.com>

Change-Id: I45494a4df7ee4454edb3ef8e7c5817d8c4e9e5ad
2017-07-18 15:39:57 -04:00
Balazs Gibizer 1928ec5606 Add BDM to InstancePayload
This patch adds bdm related data to InstancePayload. As loading BDM
can be expensive a new configuration flag 'bdms_in_notifications' is
introduced. If this is set to false (as by default) then the instance
notifications will contain 'null' value in block_devices field.
If this configuration flag is set to true then the block devices will
be loaded from the db and will be included in the notification payload.

Implements: bp additional-notification-fields-for-searchlight
Change-Id: I18e7483ec9a484a660e1d306fdc0986e1d5f952b
2017-07-12 16:55:17 +02:00
Jay Pipes 48268c73e3 placement: scheduler uses allocation candidates
This patch replaces the scheduler's use of GET
/resource_providers?resources=XXX with GET
/allocation_candidates?resources=XXX.

In doing so, we move the interaction with the placement API out of the
scheduler driver interface and up into the scheduler manager. This
allows us to make fewer changes to the underlying HostManager and
SchedulerDriver interfaces and isolate communication with the placement
API in a single place.

The provider_summaries part of the response from GET
/allocation_candidates is used to generate the UUIDs that winnow the
number of compute nodes retrieved by the filter scheduler during
scheduling. Following patches will add in support for actually doing
the claim from the scheduler against one or more resources providers by
examining the allocation_requests part of the HTTP response and picking
one that contains the host the scheduler picked during its _schedule()
loop.

Change-Id: I1c0bd2987dcbc38f23b71db2bc8e3267f85168c8
blueprint: placement-allocation-requests
2017-07-07 11:35:54 -04:00
Balazs Gibizer f756964b22 Add keypairs field to InstanceCreatePayload
Add keypairs field to instance.create notifications based on
instance.keypairs field.

Change-Id: I30e068d4de4b45f34308665de37d4cb9d6502111
Implements: bp additional-notification-fields-for-searchlight
2017-06-28 11:03:44 +02:00
Sujitha eb1ac77dd7 add tags field to instance.update notification
Tags field is added to the InstanceUpdatePayload based on the
tags field fo the related Instance object. Adding tags to instance.create
notification will be handled in the bp tag-instances-when-boot.

Implements: bp additional-notification-fields-for-searchlight

Change-Id: Ifad6487de200767fc16d035ad830c77bba49154a
2017-04-21 12:44:12 +02:00
Béla Vancsics c2d38a50ba Using max api version in notification sample test
Notification payloads always reflect the data needed for every
supported API microversion so we can safely use the latest
API version in the notification sample tests. This helps the test
to use the new API features too.

Change-Id: I851bd2e7ef13a1efa4fed4176996d71f6e2de94a
2017-04-20 18:50:22 -04:00
Balazs Gibizer 189a4a7c76 Fix race condition in instance.update sample test
The test case test_create_delete_server_with_instance_update failed randomly
because the last expected instance.update notification was not received due
to a race condition.

The test polls the REST API and waits for the instance to reach ACTIVE state.
However the last instance.update is sent from the instance.save after the
state of the instance is updated in the DB. Therefore it is possible that
the test saw ACTIVE instance state before the last instance.update
notification is emitted.

This patch introduce an extra wait call to receive the last notification
as well.

Closes-Bug: #1657087
Change-Id: I438bbb6de0733d0c3fd8361fdc4149c88abb53aa
2017-01-25 14:00:52 +01:00
Balazs Gibizer af17b95073 Improve flavor sample in notification sample tests
This patch adds an extra_specs key to the flavor used in the
instance action sample test to make the samples more realistic.

Change-Id: I5ec2b536469daaea16efb1ef1537a951dc52997a
Implements: bp flavor-notifications
2017-01-11 19:50:20 +01:00
liyingjun 8d9b3d6b9d Notifications for flavor operations
This patch implements the versioned notifications for flavor
create and destroy.

Implement blueprint: flavor-notifications

Change-Id: Icc2169b87ffba4e7e2079076a82029156c584c6a
2017-01-09 20:39:58 +08:00
Sean Dague 9fd8014cf5 restore locking in notification tests
The notification samples tests are mocking out locking entirely, which
means that all code using locking for safety no longer is. As this is
spawning services that talk over the oslo.message fake bus, this seems
like a bad idea.

Change-Id: Icdb9e77a1be3efc0068bd1add1d3c72d44183329
Related-Bug: #1649403
2016-12-12 22:44:43 +00:00
ChangBo Guo(gcb) d9a7c16c30 conf: Remove config option compute_ manager
compute_manager config options were deprecated in
13.0.0, we can remove it now.

Depends-On: I93b62372e357db4f7c39992c244b2ec9e594ad9c

Implements: bp centralize-config-options-ocata

Change-Id: I84503655bd9675ff441073e51059202142db22ab
2016-12-08 20:05:52 +08:00
Jenkins 92c251f85f Merge "conf: Remove deprecated service manager opts" 2016-12-07 13:23:25 +00:00
ChangBo Guo(gcb) 694fee938d conf: Remove deprecated service manager opts
The following service manager config options were deprecated in
13.0.0 and remove them now:

- metadata_manager
- console_manager
- consoleauth_manager
- cert_manager
- scheduler_manager
- conductor.manager

Implements: bp centralize-config-options-ocata

Co-Authored-By: Stephen Finucane <sfinucan@redhat.com>
Change-Id: Ia50d18c350dbc4ca88da9543e1236e3398ea28ee
2016-12-05 23:28:49 +08:00
Balazs Gibizer 705b3d0524 support polling free notification testing
There are multiple instance action notifications where the only
way to test notification sample is to wait for the notfication
to arrive as there is no indication on the REST API that the
certain action has been finished.

Until now the only way to implement such test was to poll the
fake_notifier.VERSIONED_NOTIFICATIONS list to see if the notification
is arrived.

This patch adds a polling free solution based on threading.Event

Change-Id: I50f2a3325e3aae4298b18f0929d19c04cecdaa18
2016-12-05 16:16:17 +01:00
Gábor Antal 569e463f02 Fix a TypeError in notification_sample_base.py
In notification_sample_base, a possible error is found and fixed, as

    extra_params['return_reservation_id'] = True

is a valid code only when extra_params is not None.
However, this is not checked. So when we try to boot a server
without extra parameters, a TypeError is raised:

    TypeError: 'NoneType' object does not support item assignment

In this patchset, the possible bug is fixed.

Change-Id: I80e2286b231da39b8c1e4225145422ac48daee68
2016-11-07 17:31:38 +01:00
Takashi NATSUME 6fba36a442 Fix import statement order
Fix import statement order to comply with
OpenStack Style Guidelines(*1).

*1: http://docs.openstack.org/developer/hacking/#import-order-template

TrivialFix
Change-Id: I8ded09c14396a46f9d0f8f565d1294b179ce09bc
2016-10-31 21:42:42 +09:00
Alexis Lee 7d0381c91a conf: Group scheduler options
Move all scheduler options into their one of two groups. Many of the
options are simply renamed to remove their 'scheduler_' prefix, with
some exceptions:

* scheduler_default_filters -> enabled_filters
* scheduler_baremetal_default_filters -> baremetal_enabled_filters
* scheduler_driver_task_period -> periodic_task_interval
* scheduler_tracks_instance_changes -> track_instance_changes

Change-Id: I3f48e52815e80c99612bcd10cb53331a8c995fc3
Co-Authored-By: Stephen Finucane <sfinucan@redhat.com>
Implements: blueprint centralize-config-options-ocata
2016-10-07 14:36:21 +01:00
EdLeafe fe3d6dba3d Remove support for deprecated driver import
Support for specifying the scheduler driver via a full classpath was
deprecated in Mitaka, and with this patch is removed in Ocata.

Change-Id: I72e392aafa886ba19c874f1e0a0c95f6d1757ab9
2016-09-22 09:43:56 +01:00
Balazs Gibizer 08d66e2e2b Assert reservation_id in notification sample test
Until now the reservation_id of the instance was ignored
in the notification sample test, this patch adds the way
to assert it properly.

Change-Id: Ie287a2cdad9996c75fd22a3e332b83b0c32570b4
2016-07-13 12:36:48 +02:00
Balazs Gibizer 87e13112b1 Transform instance.update notification
Change-Id: I4e1ca357322bdbcb95e4803001f4a7dc1bd37f04
Implements: bp versioned-notification-transformation-newton
2016-06-30 16:54:57 +02:00
Balazs Gibizer 998235da63 Transform instance.delete notifications
The instance.delete.start and instance.delete.end notifications
are transformed to the versioned framework using the generic
InstanceActionNotification and InstanceActionPayload class.

There is no instance.delete.error notification in legacy so
it is not added here but considered as a future improvement.

Change-Id: Iddbe50ce0ad3c14562df800bbc09ec5a7e840485
Implements: bp versioned-notification-transformation-newton
2016-06-30 16:54:51 +02:00
Balazs Gibizer 2b47c8335d Enhance notification sample test base
The subsequent notification transformation patch needs that
the notification sample matching handles more than one notification
per test and allow accepting any value of a particular notification
field during the matching

Change-Id: Idbb78b0996343636d2708c2d4f8d1862ef033c75
2016-06-21 09:39:54 +02:00
Balazs Gibizer 55469df239 Stop using mox stubs in tests/unit/fake_notifier
Replace 'stubs.Set' with 'stub_out' in the following files.

* nova/tests/unit/fake_notifier.py

Change-Id: Ie161780e748e3e8f1959a99d6d69e3518ccc958e
Implements: blueprint remove-mox-newton
2016-06-10 11:27:09 +02:00