The agent code is enhanced to allow the trunk agent-side counterpart
to be activated seamlessly by means or local registry notifications.
Some integration with the server side is provided by loading the
RPC agent-side skeleton. Basic unit testing provides some coverage.
More effective functional and system coverage will be provided once
everything comes together.
Partially-implements: blueprint vlan-aware-vms
Co-Authored-By: Adolfo Duarte <adolfo.duarte@hpe.com>
Change-Id: Id70553e8980593f99548a4d2b0a78355933f7c2c
This patch revisits the is_bound() condition for ports that
are about to be used as parent in a trunk. The existing
logic checked that for a port to be bound it is either an
unbound compute port or it is associated to a host. In pratice
only the latter suffices.
Partially-implements: blueprint vlan-aware-vms
Change-Id: I1c2c877b5cc421e05d97c7f528546a6a2c14aa46
This patch introduces the RPC backbone required for the trunk plugin to work
with agent-based L2 drivers (like Open vSwitch); to this aim it uses the RPC
callback registry to send/receive trunk and subports OVOs over the wire.
More patches will follow up to complete the RPC integration; some stuff is
still work in progress, but there is enough substance that make this
patch worth it.
Partially-implements: blueprint vlan-aware-vms
Co-Authored-By: Ryan Tidwell <ryan.tidwell@hpe.com>
Co-Authored-By: Armando Migliaccio <armamig@gmail.com>
Co-Authored-By: Adolfo Duarte <adolfo.duarte@hpe.com>
Change-Id: I3c749e9287cc778e12d3e022ddfd157ac9c1569b
Some drivers, like the Open vSwitch one, may restrict the creation of a
trunk from a bound port (i.e. prevents from creating trunks after a VM
is already booted on the port).
This limitation frees us from worrying about dataplane migrations for OVS
as trunk ports and regular ports are wired differently.
However, other drivers, like the Linux Bridge one, may not be affected by
this limitation, and the existing rule should be relaxed to allow the
operation based on whether not the driver can support it.
Partially-implements: blueprint vlan-aware-vms
Change-Id: Ia938eb7cc845f6f144924acdb0e333d23516fcca
This patch follows up on the Nova work that allows Neutron to pass an
OVS 'bridge_name' in a port's vif_details [1] and the os-vif work that
ensures the OVS bridge passed in as 'bridge_name' (or the config default
of 'br-int') is created [2].
If the port is a trunk's parent port, then bridge_name will be set to a
generated trunk bridge name for vlan-aware VMs. Otherwise, the
bridge_name field will remain empty.
Note: until Nova integrates os-vif [3] and uses a release that contains
the change in [2], the trunk bridge will not actually be created by
Nova/os-vif. It is expected to be integrated for the Newton release.
Until then, this Nova-equivalent patch can be used for testing
purposes [4].
[1] https://review.openstack.org/#/c/260700/
[2] https://review.openstack.org/#/c/330818/
[3] https://review.openstack.org/#/c/269672/
[4] https://review.openstack.org/#/c/332474/
Partially-implements: blueprint vlan-aware-vms
Change-Id: Iad72d163bc406df65866f6d962abcb78596828e7
This adds the server side trunk driver for the linux bridge
agent.
Partially-Implements: blueprint vlan-aware-vms
Change-Id: I4c655d69ad45a46c5363727767396dabadc861c8
This patch introduces a framework and enhancements that allow the trunk
plugin to support multiple trunk drivers that integrate with Neutron core
technologies. A mechanism to validate the deployment configuration is
provided so that the trunk plugin can verify that it can start correctly.
Fail fast is desired to give prompt feedback to the operator in case of
configuration inconsistencies.
The OVS driver is developed as a proof of concept and the Linux Bridge
driver will be added as a follow up patch.
Partially-implements: blueprint vlan-aware-vms
Change-Id: I5f9f8845e4108754748be3b64cce250c06e20f1f
A trunk is a complex resource. This patch introduces the
states and documents the state machine for the trunk resource.
Only user initiated state transitions are introduced in this
patch. Driver-initiated state transitions will be introduced
as follow up.
Partially-implements: bp/vlan-aware-vms
Change-Id: I0446e26f9ee5193a3270336ac64d0186fe5a6c7b
All occurences of ``tenant_id`` across the database are renamed
to ``project_id``. Both options are equally valid, but ``project_id``
is preferred.
To inform external users about the change, HasTenant class was
deprecated.
UpgradeImpact
Partially-Implements: blueprint keystone-v3
Change-Id: I87a8ef342ccea004731ba0192b23a8e79bc382dc
Registry notifications should be added for trunk create/update/delete,
and SDN controllers as subscribers will need more callbacks as PRECOMMIT
events.
A standardized notification payload will consist of the following:
- context
- trunk_id
- current_trunk
- original_trunk
- subports
This standardized payload will be used in all trunk-related
notifications (trunk create/update/delete and subport add/remove) and
represents the maximum possible amount of information that can be given
in order to future-proof them.
As a bug fix, AFTER_REMOVE event on subport shouldn't be called
during the db transaction, but after the db commit.
Partially-implements: blueprint vlan-aware-vms
Change-Id: Ic1f44fa53cf9f10bd029ea47824e8ba91a8ab485
Co-Authored-By: Isaku Yamahata <isaku.yamahata@intel.com>
For usage convenience, add in base class update_fields method. This would
handle the updating of allowed fields, leaving the fields_no_update without
modification.
Usage of update_fields for SubnetPool integration in db_base_plugin_v2 and
for trunk plugin update_trunk.
Change-Id: Ia1fb22e75d71b1baf1b4a8fed1b185c250a41c1c
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
A port that is currently in use as a trunk port or a subport cannot be
deleted. The trunk or subport that the port is owned by must be deleted
first.
Partially-implements: blueprint vlan-aware-vms
Change-Id: I35aec716b44b85a686c9d0f8f591d7d1ec21a794
Segmentation ID is meant to be an Integer as per model,
and as such it is best to attempt a conversion in case
it happens to be sent as string as done in [1]. The
failure mode in this case is not immediately obvious
as the ID range check fails and yet the ID is indeed
in range.
This patch also dedups some logic, clean up and add a
test.
[1] https://review.openstack.org/#/c/340624/7/neutronclient/osc/v2/trunk/subport.py@36
Partially-implements: blueprint vlan-aware-vms
Change-Id: I7ca4c93fdf0ab83088194e9a343448ed511d4cdb
The neutronclient [1] expects to serialize a dictionary any
time there is a body in the request. The (add|remove)_subports
methods were expecting a list of dicts instead.
This patch rectifies the issue by assuming a dict in the
body of the format {'sub_ports': [<my-subports]}. This is
indeed the most conventional way to pass request data to
Neutron server, and it was overlooked during a past review.
This was discovered during development of the client side
patch [2].
[1] https://github.com/openstack/python-neutronclient/blob/master/neutronclient/v2_0/client.py#L292
[2] https://review.openstack.org/#/c/340624/
Partially-implements: blueprint vlan-aware-vms
Change-Id: I8d36c61dd877d0ccb73c18702ed64897b71f001b
Add missing sqlalchemy cascade="all, delete-orphan" on the
trunk-subports relationship to disable child object loading
on a trunk delete operation, otherwise sqlalchemy would
attempt to update the children with a NULL key, and cause
an integrity violation.
Deleting a trunk with subports is allowed, and a test is
added to cover that.
Partially-implements: blueprint vlan-aware-vms
Change-Id: I143c436ce6d2d3a441c26a4b08730981f1ec2973
This patch adds the following attributes to the trunk model:
* name: this is added for convenience, especially to speed
up resource lookup via CLI commands. This is also added
for consistency with other Neutron resources.
* admin_state_up: this is added for management needs. There
may be maintenance situations where preventing the user
from adding/removing subports to a trunk while in disabled
state is desired.
* status: this can be used to track the aggregate status
of all the resources (parent + subports) participating
into a trunk.
The API extension is modified accordingly, coverage added.
The hash for the trunk object is revised, while the object
version is left as is, since all of this is still unreleased.
The patch leaves the logic to handle the trunk status aggregation
to be added at a later date, whilst minor refactoring
improves readability and use of the database sessions.
Partially-implements: blueprint vlan-aware-vms
Change-Id: Ibe39378d43b1d63c2b006c2da574f52d9934a0df
This patch fills in the trunk_details field with trunk_id and
sub_ports, exposing trunk-related information on the ports
resource to consumers of the Neutron API.
Change-Id: I1678301734e7f945e6f0400e62970b908da77a71
Partially-implements: blueprint vlan-aware-vms
When a list of subports has been added or removed from a trunk, the
registry should emit a corresponding event and pass the list of added or
removed SubPort objects as the payload.
Trunk agent RPC callbacks can then be subscribed to these events in
order to relay subport information to the agents.
Partially-implements: blueprint vlan-aware-vms
Change-Id: Icb8da23cdd2244da5183058c31d8acef22d78eaa
This patch enables basic CRUD operations on trunk ports and defines
related API extensions. Trunk ports and sub-ports can be persisted
in the Neutron model and are made visible through the API, but the
L2 agent is not notified and no trunk ports or subports are actually
instantiated on compute hosts.
This one of the main patches in the series that implement the end
to end functionality.
Partially-implements: blueprint vlan-aware-vms
Co-Authored-By: Armando Migliaccio <armamig@gmail.com>
Change-Id: I26453eb9a1b25e116193417271400994ac57e4c1
This patch overrides the inherited 'create' methods of Trunk and
SubPort to provide several enhancements:
- throw proper exceptions instead of DBReferenceError on foreign key
constraint violation;
- allow Trunk to be created along with its children sub-ports (passed
as a list of dict-like objects in 'sub_ports' argument of Trunk's
constructor).
Partially-Implements: blueprint vlan-aware-vms
Change-Id: I4dcfdbed905298ccefc4394f8baf9c5c037b9605
It was pointed out after merge that the index is, in fact, redundant.
This reverts commit 6d8d00fea1.
Change-Id: I1dad14079d01f5441005be8fa0b3de8d3d06429c
First, the nullable attribute on port_id was redundant because it is
in the primary key.
Second, trunk_id shouldn't be in the primary key. Since port_id was
already marked unique, it didn't add any extra uniqueness constraint
and it doesn't help to have it in a primary key index either since
we'll either search the table for a given port_id *or* search for
subports with a given trunk_id.
The original model was not released in Mitaka. Also, this is
effectively a cosmetic change, it doesn't really effect the operation
of the DB. So, developers and trunk chasers who have deployed with
the previous model will still work.
Change-Id: Ia43a2a772f654e26c3234e153fd8a5501e585c9b
Partially-Implements: blueprint vlan-aware-vms
An index on trunk_id will make queries that return subports from a given
trunk_id efficient. When I first approved the trunk and subports model,
I thought that having trunk_id in the primary key would be sufficient.
However, thinking about it some more, I realize that isn't the case
because trunk_id is listed as the second column in the primary key.
Think about it like searching a string index for something that matches
in the last half of a string. The index doesn't make that efficient.
The DB must still search all entries for matches. It is the same with
the index on (port_id, trunk_id) that the primary key provides. You
need to look through every row to find matching trunk_ids. Hence the
addition of an index.
Change-Id: I566863fd44aa402230d2eb83e99bc66e7fed8d80
Partially-Implements: blueprint vlan-aware-vms
This patch introduces the following:
- data models and related schema migrations
- first stub at DB operations
- trunk module structure
This is a tepid attempt to land the first functional code
for this sorely needed feature.
Partially-implements: blueprint vlan-aware-vms
Change-Id: I84b2a7604b6a282ec7cb953482bf7b567ae2344d