neutron/neutron/tests/unit
Bence Romsics 9e8e987e6c Placement reporting service plugin
This service plugin synchronizes ML2 mechanism driver agents' resource
information to Placement. To use this service an agent must add
'resource_provider_bandwidths' to the 'configurations' field of its
RPC heartbeat. It also may add 'resource_provider_inventory_defaults'
to fine tune Placement inventory parameters. Again to use this service a
mechanism driver must implement get_standrd_device_mappings() and allocate
a UUID as mechanism driver property 'resource_provider_uuid5_namespace'.

The synchronization is triggered by:
* any new agent object in the DB
* restart of an agent (via 'start_flag' in the RPC heartbeat)
* if an agent's 'resources_synced' attribute is not True (None/False)

The latter should autoheal transient errors of the synchronization
process. That is if a sync attemp fails then we store
resources_synced=False which triggers a sync retry at each new heartbeat
message until a sync attempt finally succeeds and we can set
resources_synced=True.

Since this code functionally depends on ML2 we can also consider making
it part of ML2, but at the moment it is a service plugin for better
decoupling. Even if you load the service plugin the logic gracefully
degrades for heartbeat messages not containing resource provider info.

If needed the sync can be forced in multiple ways. First, if you restart
an agent then the RPs belonging to that agent will be re-synced. You may
also delete the agent by 'openstack network agent delete' and let the
next heartbeat message re-create the agent object. On re-creation the
RPs belonging to that agent will be re-synced. On the other hand a
neutron-server restart does not trigger a re-sync in any way. Depending
on the trade-off between the admin's needs to force re-syncs and the
performance of (not absolutely necessary) Placement updates re-sync
conditions may be further fine tuned.

Example config for neutron-server:

neutron.conf:
[DEFAULT]
service_plugins = placement

Change-Id: Ia1ff6f7559ab77913ddb9c3b134420a401b8eb43
Co-Authored-By: Lajos Katona <lajos.katona@ericsson.com>
Depends-On: https://review.openstack.org/586567
Partial-Bug: #1578989
See-Also: https://review.openstack.org/502306 (nova spec)
See-Also: https://review.openstack.org/508149 (neutron spec)
2019-03-01 15:37:48 +01:00
..
agent Class to represent Placement state and sync 2019-02-21 14:06:26 +01:00
api remove neutron.common.rpc 2019-02-06 11:05:55 -07:00
cmd Fix the way how upgrade checks are loaded 2019-02-07 19:42:41 +01:00
common Merge "ovs-agent: Report resource info in heartbeat" 2018-10-22 20:03:06 +00:00
conf/agent Agent common config 2017-03-15 09:52:18 -06:00
core_extensions remove neutron.common.exceptions 2019-02-01 14:35:00 -07:00
db Merge "use payloads for SECURITY_GROUP BEFORE_CREATE events" 2019-02-20 06:16:19 +00:00
debug Use constant IP_VERSION_4/6 in unit tests 2018-08-27 21:45:39 +00:00
extensions Add dependency for service plugin 2019-02-16 00:17:53 +08:00
hacking remove string use of neutron.common.rpc 2019-02-08 09:40:39 -07:00
ipam Merge "Update the processing of assigned addresses when assigning addresses" 2019-02-07 20:30:20 +00:00
notifiers Send global_request_id for tracing calls from neutron to nova 2018-11-30 05:41:24 +00:00
objects New agent attribute: resources_synced 2019-02-21 13:45:15 +01:00
pecan_wsgi Removing deprecated module neutron.api.versions 2018-03-28 14:15:50 +07:00
plugins Placement reporting service plugin 2019-03-01 15:37:48 +01:00
privileged remove neutron.common.exceptions 2019-02-01 14:35:00 -07:00
quota use get reader/writer session from neutron-lib 2018-07-06 14:43:31 -06:00
scheduler remove neutron.common.rpc 2019-02-06 11:05:55 -07:00
services Placement reporting service plugin 2019-03-01 15:37:48 +01:00
tests Update neutron files for new over-indentation hacking rule (E117) 2019-01-29 15:36:20 -05:00
__init__.py Don't set use_stderr to False for tests 2017-04-15 01:41:29 +00:00
_test_extension_portbindings.py Remove the unit test 'test_ports_vnic_type_list' 2018-06-15 15:12:10 +00:00
dummy_plugin.py Add dependency for service plugin 2019-02-16 00:17:53 +08:00
extension_stubs.py Consume ServicePluginBase from neutron-lib 2017-03-17 12:06:57 -06:00
test_auth.py Fix context deprecation warnings 2018-02-13 15:02:49 -05:00
test_manager.py Add dependency for service plugin 2019-02-16 00:17:53 +08:00
test_neutron_plugin_base_v2.py Add unit test to validate non DB base core plugin can be loaded 2017-11-15 21:21:35 +00:00
test_opts.py Fix the sriov agent config group name 2016-05-05 16:16:08 +08:00
test_policy.py Add ext_parent policy check 2018-08-01 02:45:42 +08:00
test_service.py use callback payloads for _SPAWN events 2017-12-21 11:03:36 -07:00
test_worker.py Move AgentStatusCheckWorker to PeriodicWorker 2016-11-17 15:31:19 -08:00
test_wsgi.py remove neutron.common.exceptions 2019-02-01 14:35:00 -07:00
testlib_api.py use context manager from neutron-lib 2018-10-24 07:18:46 -06:00