RobinWang [Tue, 9 Dec 2014 03:52:14 +0000 (11:52 +0800)]
Add OVS status and fix OVS crash
OVS crash/restart is unpredictable, so neutron-ovs-agent should be
robust enough under that situation. But currently ovs-agent doesn't
figure out this error status(only check ovs restart/normal status)
and still continue to apply subsequent operations(set br/add patch
port/...) till causing exceptions/crash. Add flag to fully represent
ovs status. Base on that, we can add proper fail-over code in method
rpc_loop, to treat ovs dead/restart gracefully to prevent agent
crashes while it is running.
Closes-bug: #1296202
Angus Lees [Wed, 17 Dec 2014 04:44:12 +0000 (15:44 +1100)]
Cisco: unsupported format character in log format
CiscoCfgAgent.hosting_devices_removed() contains an error in the
format string used to log errors:
LOG.error(_LE("Invalid payload format for received RPC message "
"`hosting_devices_removed`. Error is %{error}s. "
"Payload is %(payload)s"),
{'error': e, 'payload': payload})
"%{error}s" should be "%(error)s"
The existing version raises "ValueError: unsupported format character
'{' (0x7b)" when invoked.
rossella [Tue, 19 Aug 2014 17:41:16 +0000 (19:41 +0200)]
Remove locking from network and subnet delete op
delete_subnet in Ml2 plugin instead of using SELECT FOR
UPDATE deletes the IPAllocations that can be auto-deleted
straight away.
An exception is raised if there are ports that cannot be
autodeleted.
delete_network in ML2 plugin tries to delete all ports
and subnets before performing the network deletion.
No lock is needed here - if some other process modifies
the Port or Subnet table, adding new items, the network
deletion will fail because of a violation of a foreign
key contraint.
In that case the operation will be retried.
Cedric Brandily [Fri, 21 Nov 2014 22:11:25 +0000 (23:11 +0100)]
Add functional test for l3-agent metadata proxy
This change add a functional test for l3-agent metadata proxy to
verify:
* iptables redirection from 169.254.169.254:80
* headers added by the neutron-ns-metadata-proxy
* proxy to the metadata_socket by the neutron-ns-metadata-proxy
Jakub Libosvar [Fri, 12 Dec 2014 17:39:56 +0000 (18:39 +0100)]
Set timeout for functional job
As functional jobs take more time to finish than unit tests and also
there is a chance that test will hang due to system interaction, this
patch sets maximum execution time to 90 seconds per test.
AKamyshnikova [Thu, 11 Dec 2014 10:00:48 +0000 (13:00 +0300)]
Enable test_migration
After splitting in neutron database was left a number of tables
that don't have any models. Test should be improved to skip these
tables from checking.
Ihar Hrachyshka [Mon, 8 Dec 2014 12:51:02 +0000 (13:51 +0100)]
tests: initialize admin context after super().setUp call
New policy code requires that CONF is already initialized when policy
checks are invoked. It means that no Neutron context objects should be
created before BaseTestCase.setUp() is called that will set
configuration, among other things.
Ideally, we would just make sure that all test cases invoke
super().setUp() as the very first line of any subclass setUp() methods.
But since some of test cases require prior setup (like mocking extension
manager) before proceeding to base class, we end up with magically
shuffling context instantiations to occur below super() calls.
Roey Chen [Tue, 9 Dec 2014 13:57:33 +0000 (05:57 -0800)]
Fixed test test_update_port_security_off_address_pairs
This test checks that port-update fails with 409 return code when
port-security is turned off on a port which contains address-pairs.
The test had a typo ('security-groups' -> 'security-group') which would
have cause it to produce false-positive.
This change rewrites the test and eliminates the possibility of this
false-positive to occurs.
Paul Michali [Wed, 10 Dec 2014 23:50:56 +0000 (18:50 -0500)]
L3 Agent restructure - observer hierarchy
This commit creates the basic observer hierarchy for advanced
services, as part of a multi-step refactoring effort of the L3 agent.
The change set has these modifications:
- Device drivers for VPN and FW services are loaded.
- AdvancedService child instances are created for VPN and FW.
- L3EventObservers is created by the L3 agent and the VPN and FW
service objects are registered for notifications of events.
- VPN device driver event handlers moved to VPN service instance.
- VPN device driver callbacks to VPN agent, moved to VPN service.
to service from the VPN device driver.
- Test cases updated and moved related to these changes.
- UT updated to test new methods and refactoring changes.
Future commits will massage the event notification points in the
L3 agent, and implement handlers.
Please keep these things in mind, when reviewing:
- The goal is to refactor the code and not 'improve/change'
functionality (other than broken tests).
- This is one step of a series of steps to move to the 'final'
restructuring.
- Because we're incrementally changing the code, there may be
temporary changes to allow existing code to continue to work.
Terry Wilson [Fri, 12 Dec 2014 17:12:02 +0000 (10:12 -0700)]
Replace non-ovs_lib calls of run_vsctl with libary functions
There is already an OVSBridge.set_controller() function, so replace
calls to run_vsctl(['set-controller', ...]) with calls to
OVSBridge.set_controller().
This is also the only non-ovs_lib call to run_vsctl. This change
will also make it easier to abstract out the ovsdb-related code in
the future.
Jakub Libosvar [Tue, 30 Sep 2014 16:13:50 +0000 (18:13 +0200)]
Separate wait_until to standalone function
It makes wait_until more usable outside of unittest.TestCase classes.
Part of this patch is renaming pinger module to helpers thus we can have
helpers module with useful utilities for testing.
RobinWang [Wed, 10 Dec 2014 02:46:05 +0000 (10:46 +0800)]
Mock up time.sleep to avoid unnecessary wait in test_ovs_tunnel
Unnecessary wait in ovs tunnel UT introduces extra 6 seconds time cost,
and makes 3 test_daemon_loop cases the slowest tests. Mock up time.sleep
to reduce UT time, from around 6.272s to 0.135s.
Kevin Benton [Thu, 16 Oct 2014 09:10:36 +0000 (02:10 -0700)]
Catch duplicate errors scheduling SNAT service
Catch DBDuplicateEntry errors when scheduling SNAT to
a service node to prevent harmless tracebacks in the log.
These can occur if scheduling occurs concurrently,
so they are safe to ignore.
Michael Smith [Tue, 2 Dec 2014 22:22:04 +0000 (14:22 -0800)]
Fix for KeyError: 'gw_port_host' on l3_agent
The dictionary field 'gw_port_host' was added for
DVR routers and is used by the scheduler and l3_agent
to schedule where the SNAT port for a DVR router
will be hosted. In some code flows on the l3_agent,
this field is checked to determine what the agent
should do if the host matches its own or not.
Recently it has been seen that the router data sent
from the scheduler is missing this field in some cases.
This causes the agent to throw a KeyError and not function
properly. This patch will make the l3_agent more robust
and less fragile by calling 'get' instead of assuming the
field will be there.
More work may be needed on the scheduler side to see why
this field is missing. That is why I am marking this as a
partial-fix for now. But this patch will make the l3_agent
less prone to errors and therefore an improvement.
Ihar Hrachyshka [Thu, 11 Dec 2014 19:36:48 +0000 (20:36 +0100)]
Migrate to oslo.context
That's just a matter of adding requirements.txt entry, fixing imports,
and dropping the corresponding oslo-incubator module from the tree.
While at it, made all imports to import the module into 'oslo_context' and
not just 'context', so that we don't override the module locally in
multiple methods that receive their context arguments with the same
name, making the library inaccessible from inside those methods.
Terry Wilson [Tue, 9 Dec 2014 22:24:37 +0000 (15:24 -0700)]
Have L3 agent catch the correct exception
L3 agent imports the processutils module to catch exceptions that
wouldn't ever be thrown because the underlying execute() being
called is the one from neutron.agent.linux.utils which raises a
RuntimeError on failure.
Also, processutils is now part of oslo.concurrency. So when we
actually start using it, we'll use it from there.
Carl Baldwin [Tue, 28 Oct 2014 17:30:55 +0000 (17:30 +0000)]
Remove broad exception catch from periodic_sync_routers_task
Although this change removes a broad exception from
periodic_sync_routers_task (neutron.agent.l3_agent), the
implementation still ensures if an exception --caught or uncaught --
prevents a call to the method to disable the fullsync, then the next
call to the method will perform a fullsync again.
Author: Cedric Brandily <zzelle@gmail.com> Co-Authored-By: Carl Baldwin <carl.baldwin@hp.com>
Change-Id: I6281886f3334100a18952578250c8154a0ed15a9
Miguel Angel Ajo [Wed, 10 Dec 2014 11:21:52 +0000 (12:21 +0100)]
Fix race condition in ProcessMonitor
If any new external process was enabled/disabled during
the process monitoring loop time, a RuntimeError: dictionary
changed size during iteration was thrown. This is fixed
by pre-building the service list from the dictionary
for the iteration.
Miguel Lavalle [Tue, 9 Dec 2014 00:40:25 +0000 (18:40 -0600)]
Refactor process_router method in L3 agent
Refactors the process_router method of the L3NATAgent class to several methods
that coherently group functionallity. The aim is to make the code more readable
and maintainable. There is no functional change in this patch.
Carl Baldwin [Mon, 1 Dec 2014 21:49:10 +0000 (16:49 -0500)]
Move classes out of l3_agent.py
The file l3_agent.py has become too large. This patch is a simple
pure refactor to move some of the functionality in to other files
where things aren't too tangled up. There is no functional change
with this patch and I avoided gratuitous other fixups in this patch in
order to make it easier to review.
I plan to follow up on the new l3_dvr and l3_agent_router modules with
more restructuring in the near future.
Change I6a079ad introduced some magic to enable showing test output
as the test run. Do the same for *-functional tests too, by reusing
the default testenv
Doug Wiegley [Tue, 9 Dec 2014 22:55:04 +0000 (15:55 -0700)]
Services split, pass 2
- Nuke more services code, killing some refs in vmware plugin
- Vmware plugin foreign key relationships are temporary disabled
- Vmware unit tests are temporarily disabled
- Remove router insertion test, as its only user is going away
- Add thin service plugin shims
- Temporarily disable model sync test
Post services-split, existing neutron.conf configurations may contain
references to in-tree plugin classes. Add thin shims so that those configs
will continue to work.
Xu Han Peng [Wed, 10 Dec 2014 06:07:42 +0000 (14:07 +0800)]
Fix IPv6 RA security group rule for DVR
Current IPv6 RA security group rule doesn't work for
DVR because the code only allows RA from device_owner
is network:router_interface. When DVR is enabled, the
router interface is network:router_interface_distributed.
This fix fixes the RA rule to allow RA from DVR router
interface, so router advertisement from DVR RADVD can
pass to VM.
Co-Authored-By: Baodong (Robert) Li <baoli@cisco.com>
Change-Id: Idd1324c653dcb15f5dacf2d897a7048bca22fc38
Partial-Bug: 1376325