neutron/neutron/services
Bence Romsics b99dee2df6 Locate RP-tree parent by hypervisor name
Previously we assumed that we can look up the resource provider (created
by nova) to be used as the parent of the agent and physical NIC resource
provider tree by the name set in the config option DEFAULT.host. This
assumption was wrong.

While nova-compute's DEFAULT.host and neutron-agent's DEFAULT.host
must match for port binding to work, the root resource provider created
by nova does not belong to the compute host (where nova-compute runs)
but it belongs to the compute nodes (i.e. hypervisors). Actually there
may be multiple compute nodes managed by a single nova-compute (think
of ironic). Plus the value of DEFAULT.host and the compute node's ID
may be different even when nova-compute manages a hypervisor on the
same host because of various deployment considerations. For example
when tripleo does not manage the undercloud (so a libvirt hypervisor
returns the plain hostname), but the same tripleo enforces it's host
naming conventions in nova's and neutron's DEFAULT.host settings.

This change enables neutron to use the hypervisor name to locate the
root of the resource provider tree.

We introduce a new configuration option for

(1) ovs-agent: resource_provider_hypervisors, for example:

[ovs]
bridge_mappings = physnet0:br-physnet0,...
resource_provider_bandwidths = br-physnet0:10000000:10000000,...
resource_provider_hypervisors = br-physnet0:hypervisor0,...

(2) sriov-agent: resource_provider_hypervisors, for example:

[sriov_nic]
bridge_mappings = physnet1:ens5,...
resource_provider_bandwidths = ens5:10000000:10000000,...
resource_provider_hypervisors = ens5:hypervisor1,...

For both agents 'resource_provider_hypervisors' values default to
socket.gethostname() for each key in resource_provider_bandwidths.

We try to not block later developments in which one neutron
agent may manage devices on multiple hosts. That's why we allow
the each physdev to be associated with a different hypervisor.

But here we do not try to solve the problem that the natural physdev
identifiers may not be unique accross multiple hosts. We leave solving
this problem to whoever wants to implement an agent handling devices of
multiple hosts.

(3) We extend report_state message's configurations field alike:

{
'bridge_mappings': {'physnet0': 'br-physnet0'},
'resource_provider_bandwidths': {
    'br-physnet0': {'egress': 10000000, 'ingress': 10000000}},
'resource_provider_hypervisors': {'br-physnet0': 'hypervisor0'},
...
}

(4) In neutron-server we use
report_state.configurations.resource_provider_hypervisors.PHYSDEV
when selecting parent resource provider for agent and physdev
RP-tree. When not available in the message we fall back to using
report_state.host as before.

Since we only changed the free-format configurations field of the
report_state message rpc version is not bumped and we expect this
change to be backported to stein and train.

Removed unapplicable TODO notes from backport.

Conflicts:
  neutron/plugins/ml2/drivers/mech_sriov/agent/sriov_nic_agent.py
  neutron/tests/unit/plugins/ml2/drivers/mech_sriov/agent/test_sriov_nic_agent.py

Change-Id: I9b08a3a9c20b702b745b41d4885fb5120fd665ce
Closes-Bug: #1853840
(cherry picked from commit 258eebea71)
(cherry picked from commit 9a6766470e)
2019-12-23 12:11:14 +01:00
..
auto_allocate Fix pep8 E128 warnings in non-test code 2019-03-12 21:22:33 +00:00
externaldns Fix all pep8 E129 errors 2018-05-03 13:44:04 +09:00
flavors Implement filter validation 2018-07-19 04:13:43 +00:00
l3_router use api def ALIAS in _supported_extension_aliases 2019-02-15 11:26:28 -07:00
logapi remove neutron.common.rpc 2019-02-06 11:05:55 -07:00
loki use sqla functions from neutron-lib 2018-07-25 21:04:20 +00:00
metering Retry creating iptables managers and adding metering rules 2019-11-06 14:11:38 +00:00
network_ip_availability Fix pep8 E128 warnings in non-test code 2019-03-12 21:22:33 +00:00
network_segment_range Fix error 500 during segment range creation 2019-04-09 06:48:54 +00:00
placement_report Locate RP-tree parent by hypervisor name 2019-12-23 12:11:14 +01:00
portforwarding Add dependency for service plugin 2019-02-16 00:17:53 +08:00
qos Refactor qos_plugin._extend_port_resource_request 2019-07-05 16:39:11 +00:00
rbac Neutron RBAC API and network support 2015-08-20 20:00:17 -07:00
revisions Merge "Fix _find_related_obj() RuntimeError output" 2019-03-02 06:41:04 +00:00
segments Fix pep8 E128 warnings in non-test code 2019-03-12 21:22:33 +00:00
tag Fix pep8 E128 warnings in non-test code 2019-03-12 21:22:33 +00:00
timestamp remove the neutron.db._model_query module 2019-01-25 08:55:25 -07:00
trunk Increase number of retries in _process_trunk_subport_bindings 2019-08-29 08:18:35 +00:00
__init__.py Empty files should not contain copyright or license 2014-10-20 00:50:32 +00:00
provider_configuration.py Merge "Select service_provider on the basis of service_module" 2018-11-15 12:47:09 +00:00
service_base.py Make code follow log translation guideline 2017-08-14 02:01:48 +00:00