Following test cases are added:
Common scenarios:
1. No routers scheduled if no agents are present
2. No routers scheduled if it is already hosted
3. No routers scheduled if all agents are down
4. Router scheduled to the agent if router is not yet hosted
5. Router scheduled to the agent even if it already hosts a router
Following scenario specific to least routers scheduler is added:
1. Router is scheduled to agent hosting least routers
For each of Chance and Least Router schedulers auto scheduling is also verified.
Cedric Brandily [Fri, 8 May 2015 21:28:37 +0000 (23:28 +0200)]
Always use BridgeDevice to manage linuxbridges
BridgeDevice[1] class provides methods to manage linuxbridges through
brctl. This change adds some methods to BridgeDevice in order to
always use BridgeDevice to manage linuxbridges and respect DRY
principle.
Carl Baldwin [Tue, 14 Jul 2015 19:00:45 +0000 (19:00 +0000)]
Use only the lower 16 bits of iptables mark for marking
Since a packet can only have one mark, and we will need to mark a
packet for multiple purposes, we need to use a coordinated bitmask for
the two cases of simple marking that we currently do in Neutron
leaving the other bits for address scopes.
Mike Bayer [Fri, 17 Jul 2015 17:19:57 +0000 (13:19 -0400)]
Add address_scope_db to neutron/models/head.py
The head.py file ensures that all relevant models are
imported when ModelsMigrationSync tests are run in
neutron/tests/functional/db/test_migrations. This is
one of the models that needs to be present else the
"address_scopes" table comes out as missing. The
error is usually concealed by the fact that the module
was imported as a side effect of other tests but
is revealed if one runs test_migrations.py alone.
In Python 3:
>>> None > 0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unorderable types: NoneType() > int()
This commit does not change the behaviour of the affected code, but fixes the
TypeError that is raised in Python 3.
Some tests have been added to the py34 section of tox.ini, but are currently
commented out: these are tests that work with this patch and a fixed version of
Routes.
shihanzhang [Tue, 30 Jun 2015 02:14:19 +0000 (10:14 +0800)]
Unplug the VIF if dhcp port is deleted
if user delete the dhcp port, dhcp-agent should unplug
the VIF for this dhcp port, then the driver do
'reload_allocations' will raise a exception, dhcp-agent
resync for this network and re-create dhcp port.
Kevin Benton [Fri, 17 Jul 2015 01:45:30 +0000 (18:45 -0700)]
Alter unit test to match bug and cleanup ext logic
The unit test for bug #1443342 was only testing that a side effect
leading to the bug didn't occur (comparing object identities). This
patch updates the unit test to fully assert that the bug itself
doesn't occur without checking implementation details.
This also eliminates the branching that led to the original issue by
using setdefault to always return a dict to update.
Carl Baldwin [Mon, 13 Jul 2015 18:44:38 +0000 (18:44 +0000)]
Make external_gateway_nat_rules easier to understand
Future patches will change these snat rules for address scopes. I
found it much easier to understand the changes needed after formatting
these like this.
Carl Baldwin [Thu, 9 Jul 2015 19:19:00 +0000 (19:19 +0000)]
Remove perform_snat_action indirection
This indirection seems complicated to me. I don't know the history
behind it but it made some of the address scope work more difficult
than I think it needs to be.
This patch introduces API and DB plugin for flavor framework.
API adds Flavors and Service Profiles which are resources
available only for admins to operate.
This framework then should be leveraged by advanced services.
Yusuke Ide [Sat, 4 Jul 2015 06:38:58 +0000 (15:38 +0900)]
Add breakages in public API of devref
In wiki it is intended to keep track of neutron changes that may affect
external plugins and drivers. The information should be kept in a living
document in the devref area of the neutron code tree.
Kevin Benton [Mon, 15 Jun 2015 09:18:36 +0000 (02:18 -0700)]
Network RBAC DB setup and legacy migration
This patch implements the database model required for the network
RBAC work. In addition it migrates the current network and subnet
'shared' attributes to leverage the new table.
'shared' is no longer a property of the DB model because its status
is based on the tenant ID of the API caller. From an API perspective
this is the same (tenants will see networks as 'shared=True' if the
network is shared with them). However, internal callers (e.g. plugins,
drivers, services) will not be able to check for the 'shared' attribute
on network and subnet db objects any more.
This patch just achieves parity with the current shared behavior so it
doesn't add the ability to manipulate the RBAC entries directly. The
RBAC API is in the following patch.
Kevin Benton [Thu, 16 Jul 2015 09:07:48 +0000 (02:07 -0700)]
Add oslo db retry decorator to non-CRUD actions
The previously added decorators to the create and update handlers
in the API layer only applied to actions that followed the standard
create/update path. However, for API operations like add_router_interface,
a different path is followed that wasn't covered by a retry decorator.
This patch adds the decorator to handle deadlocks in those operations as
well.
Jakub Libosvar [Thu, 16 Jul 2015 08:45:22 +0000 (10:45 +0200)]
Change prefix for namespace fixture
With fullstack in game namespace fixtures are not used only in
functional tests. This patch changes prefix to be "test-" instead of
"func-" to describe better its purpose.
Carl Baldwin [Thu, 9 Jul 2015 22:05:05 +0000 (22:05 +0000)]
Create dvr base class and stop passing around snat_ports
The one thing that I see that the two dvr classes have in common is
the ability to map internal ports to snat ports. The dvr local router
needs it to set up a redirect to the central part. The central part
needs it to create the port for the internal network.
This change renames the mapping method to something more logical and
removes snat_ports as an argument to two methods because it is a quick
O(1) operation to get it from the router dict and passing it around
just tangles things up.
In some cases, logging can grab locks and thusly attempt to reschedule,
which will fail in signal handlers. this patch removes the actions
from the signal handers, just set a flat if it got a signal, then in
rpc_loop, check the flag and perform appropriate actions.
Cedric Brandily [Tue, 16 Jun 2015 07:42:35 +0000 (09:42 +0200)]
Galera multi-writers compliant sync_allocations
Currently sync_allocations[1] uses with_lockmode('update) which implies
possible deadlocks with Galera multi-writers. This change decorates the
method in order to catch and retry sync_allocations.
The change I81806a43ecc6f0a7b293ce3e70d09d1e266b9f02
effectively removed _delete_port from NeutronDbPluginV2.
Unfortunately, it's still used directly by l3_dvr_db.
Fix update_port_postcommit and port not found with DVR
Updating DVR Router interface ports was throwing
errors in the l2pop mechanism drivers function
update_port_postcommit.
PortContext's portbinding information does not show
the status of the ports. For DVR Router interface
ports the DVRPortbinding table contains the status
information for the ports.
In the case of the update_port method, there was
no code related to DVR that retreives the port
binding information from the DVRPortBinding table.
This was working before, since in the driver_context,
the PortContext was just returning the port status for
all router interfaces.
With the recent refactor to the driver_context, this
behavior changed and the PortContext was returning the
_binding.status for the DVR router interface ports and
the _port.status for the non DVR ports.
When the update_port function calls update_port_postcommit
with PortContext for DVR router interface ports, l2pop
was throwing an error saying that Portbinding does not
have the attribute 'status'.
This was causing addition of any second subnet to the
same network with respect to IPv6 to fail.
Because in the case of IPv6, when you add additional
subnets to the existing network, it just updates the port
with the IPv6 prefix instead of creating additional port.
In the case of IPv4 still we could see that there are
two different ports created for each subnet we try to
add.
This patch fixes the above issue in l2pop and allows the
DVR router interface ports to be successfull.
Also the _find_ipv6_router_port_by_network was returning
all the ports for DVR including the DVR CSNAT internal
ports which are not part of the router interface ports.
This patch also fixes this problem by returning false,
when it finds a DVR SNAT port.
oslo_utils raise ImportError if import fails. We should propagate other
failures to callers. Otherwise we may hide issues.
Also report exact failure from import_object in case L3 agent fails to
import interface_driver.
As part of the job, consolidated code to load interface driver into
common function.
Also, stopped checking for specific log messages in dhcp and l3 agent
unit tests: it's too fragile and actually not something we need a unit
test for.
Not to introduce more work for people who handle py3 porting effort,
added the unit test into the list of those that are executed for py34
job until the whole suite is ready for python3.
Ihar Hrachyshka [Mon, 22 Jun 2015 14:23:36 +0000 (16:23 +0200)]
[neutron-db-manage] support separate migration branches
New migration rule scheme is introduced. Now, changes are classified
into the following branches:
- expand (additive changes only)
- contract (contraction changes, including data migration)
Make 'neutron-db-manage revision' generate two separate migration
scripts, one per branch.
Now that we support multiple heads, renamed HEAD file in HEADS. We still
don't allow more branching, so keep validation for the number of
branches.
For backwards compatibility, calling to 'upgrade head' applies both
branches in proper order.
Note that advanced services will be moved to the new migration scheme in
separate patches for respective repos.
This patch does not introduce autogenerate support for multiple branches
for 'revision' command (that depends on a new alembic version yet
unreleased; but alembic/master already has everything to support us).
The patch does not implement 'expand' or 'contract' commands that are
anticipated by the spec proposal. Those will come in consequent patches.
Upgrade impact is backwards compatible: those who are interested in
reducing downtime while applying some migration rules can opt in it by
modifying their upgrade practices, while everything should still work
the old way for those who don't care.
At now, global-requirements has an entry:
Routes!=2.0,!=2.1,>=1.12.3
and this leads to Routes < 2.0 which is not compatible
with Python 3. This blocks updating of global requirements [1].
To avoid the situation, this commit disables python 3 related
error due to Routes version.
Closes-Bug: #1474266
Related to blueprint neutron-python3
Fix typo 'adress_scope' to 'address_scope'
in neutron/extensions/address_scope.py.
Fix typo 'test_remove_adresses_by_interface' to
'test_remove_addresses_by_interface'
in neutron/tests/unit/agent/linux/test_keepalived.py