Fix random OverflowError exceptions in gate-neutron-python26 tests
These errors seem to be linked to the NEC plugin and http connections
not being stubbed out correctly. This patch ensures do_request is
stubbed out prior to the tests execution; this should be enough
to prevent timeouts from occurring again. Stubbing out the call has
no effect on the coverage of the agent scheduler tests for the NEC
plugin.
Kevin Benton [Wed, 10 Jul 2013 23:28:12 +0000 (16:28 -0700)]
Prevent possible server list damage in BigSwitch plugin
The old failover logic for the BigSwitch plugin modified a
list of controllers as it tested them. If the code for one
thread unexpectedly raised an exception or died, the global
server list could lose a server permanently.
This patch addresses that by flagging servers as failed instead
so the global server list is never modified.
Kyle Mestery [Fri, 14 Jun 2013 14:25:08 +0000 (14:25 +0000)]
Modify the OVS agent to support multiple tunnel_types concurrently.
This change modifies the "tunnel_type" configuration option to be a ListOpt
instead of a StrOpt. This is intended to allow the agent to work in an ML2
environment where multiple, disparate "tunnel_types" are supported at the
same time. For now, the agent will enforce a single "tunnel_type".
This commit refactors the base class of unit tests for NEC Plugin to
make writing new tests easier.
Add fake OFC Manager and change unit tests which use OFC Manager mock
to using this fake. With this fake, we don't need to set return_value
and side_effect to the mock instance of OFC Manager in each test case.
This fake keeps all resources on OFC, and returns existence of
resources properly. This fake is attached to OFC Manager mock instance
by setting all side_effects. We can also set it to raise an exception.
Make NEC Plugin configurable in each test case. Now we can configure
NEC Plugin by setting string in class value "_nec_ini" which will be
written into a temporal file and loaded by NEC plugin.
Move setup for callbacks into NecPluginV2TestCase() so that other unit
tests can use callbacks.
Kevin Benton [Wed, 10 Jul 2013 23:49:31 +0000 (16:49 -0700)]
Add option to ignore backend HTTP error in BigSwitch plugin
This patch fixes the way the BigSwitch plugin ignores 404
errors from the backend controller by allowing HTTP codes
to be selectively ignored on REST calls. This prevents
unnecessary exception handling and failover logic in calls
where 404 codes are acceptable.
Firstly, we update the oslo.config dep to 1.2.0a3 because of the issue
with namespace packages (bug #1194742).
But the main issue here is that if you currently do:
$> pip install -r quantum/requirements.txt
then you end up with the oslo.config 1.1.1 code installed. This is
because oslo.config>=1.1.0 gets pulled in as a transitive dep and pip
gets confused. You can reproduce with e.g.
This is because of a bug with pip where it sees oslo.config-1.2.0a3 and
oslo.config as two unrelated things. It should strip the version part of
the egg= fragment before using it as a package name, but it doesn't.
However, we can simply use the -f/--find-links pip option in our
requirements.txt to add the tarball URL to the list of URLs considered
and also add the oslo.config>=1.2.0a3 dependency:
This is actually exactly the semantics we want and we go to great
lengths in pbr to get these semantics while using a single tarball URL.
The only downside to this --find-links strategy is that we gain an extra
line in our requirements.txt ... but it does work around the pip bug.
Carl Baldwin [Thu, 11 Jul 2013 18:17:40 +0000 (18:17 +0000)]
Quiet down a large log file heavy hitter.
This line of code serialized the python structure for the device and throws it
at the log file. The string is about 90K characters, isn't very useful and we
found that it takes a very large amount of space in the log file causing them
to grow very quickly and fill our log disk. This change extracts the device
name (e.g. "tapcdc07af9-8a") and uses that in the log message.
Dirk Mueller [Mon, 24 Jun 2013 18:56:32 +0000 (20:56 +0200)]
Be compatible with oslo.config 1.2.0a3+
The private API of oslo.config changed, and the Cisco
options parsing code was using it.
Use an explicit MultiConfigParser instance for parsing
the config files.
Define the Mechanism Driver interface for create/update/delete
operations on networks and ports. For each of these event, the
Mechanism Driver provides one method that is called within the
database transaction of the ml2 plugin method, and one that is called
after the transaction is completed.
Support for mechanism drivers is still a work-in-progress, and the
interface is subject to change in future versions before the release
of Havana. However this initial version should be sufficient to enable
others to start defining their own mechanism drivers.
Previously neutron would raise a 500 error if the dscp value was greater
than 63. This patch adds validation to neutron so that a clear error
message is returned if the value is greater than 63.
When we run "tox -e cover" to generate coverage report, testr will make
"cover" directory which contains the same html in "covhtml" made by
"./run_test.sh --coverage". So, make git ignore this directory.
Aaron Rosen [Sun, 12 May 2013 21:53:18 +0000 (14:53 -0700)]
Improve DHCP agent performance
Previously when starting the dhcp agent the sync_state() process would
be extremely expensive as it would query quantum server for each network.
In order to improve performance a get_active_networks_info() was added
so this information could be retrieved in one query rather than doing a
query for each active network.
The second part of this patch optimizes the logic to avoid calling
get_dhcp_port(). Previously, this method was called once for each network
which makes a call to get_subnets() and get_ports() unnecessarily as
the dhcp agent can determine itself if it needs to update a port or create a
port for dhcp.
This patch also threads the inital sync process and maintains backwards
compatibility with the previous rpc api.
There was also a trivial change to the nvp_plugin where filters are assumed to
be a dict.
Allow gateway address to be unset for an existing subnet
Validation of the gateway IP address was taken place even
if the gateway IP was set to None; this was causing an
AddrFormatError exception to be raised by method
'_validate_gw_out_of_pools'. With this change we skip
the validation in case the gateway is set to None.
Jason Dillaman [Tue, 9 Jul 2013 14:22:05 +0000 (10:22 -0400)]
Ensure that the neutron server is properly monkey patched
The legacy 'quantum-server' script will apply the eventlet
monkey patch whereas the new 'neutron-server' entry point
does not. This prevents the server from properly handling
the REST interface.
Bob Melander [Fri, 5 Jul 2013 13:53:49 +0000 (15:53 +0200)]
Allow router route update in XML.
Fixes: bug 1198188
Router updates of routes in XML format fails.
This patch fixes that problem. It also executes
unit tests for XML-based requests to update
router routes.
Thierry Carrez [Thu, 27 Jun 2013 13:19:05 +0000 (15:19 +0200)]
Import Oslo's common rootwrap to Neutron
Use the common oslo-incubator rootwrap rather than maintain a
specific fork within Neutron.
- Migrated DnsmasqFilter use in dhcp.filters to the new EnvFilter
- Changed environment passing in ip_lib's netns.execute so that
it can be properly matched using IpNetNsExecFilter + EnvFilter.
It now calls "ip netns exec ns env A=B C=D command" instead of
"A=B C=D ip netns exec ns command". Adjusted tests accordingly.
All the other changes are coming directly from the Oslo "rootwrap"
module sync.
Notes:
- Neutron locates its rootwrap.conf in etc/ rather than in etc/neutron
- Neutron maintains a specific bin/quantum-rootwrap-xen-dom0 which
requires additional config in rootwrap.conf
Both behaviors were preserved in this commit, but this may need to be
addressed in the future to simplify future oslo-rootwrap updates.
Divide dhcp and l3 agent scheduling into separate extensions
Rationale behind this is that some plugins may support only dhcp or l3 agent scheduling.
The patch is nothing more than refactoring. Functionality was not changed.
This patch fixes programming error in the unit test for ryu-agent.
- Change the way of patch to cfg of ryu-agent
- Fix typo
s/assert_calls/assert_has_calls/
With this patch we avoid masking NotImplementedError(s).
Previously, a catch-all clause returned 500, and it makes
sense to distinguish between genuine 500 errors (i.e. a bug),
versus 501 ones.
This opens up the issue of keeping the server behavior
consistent from one release to another, but one might argue
that this was bad design decision in the first place.
Jay S. Bryant [Sun, 9 Jun 2013 13:43:55 +0000 (08:43 -0500)]
Allow non-root ip in subnet CIDR
If a subnet is created using an IP that isn't a root IP
(doesn't end with .0) the code that handles IP checking
for fixed IPs fails. This fix changes the check for a
valid IP to use the net.network IP address to
avoid problems in subnets created with the non-root CIDR.
This patch leverages the same approach as bug 1174111 for avoiding
loading ExternalNetwork element from db for each network element.
make_network_dict, _extend_network_dict_l3 are refactored accordingly.
Also, this patch sligthly alters the logic of process_l3_network_create
and process_l3_network_update as these methods assumed
_extend_network_dict_l3 was always executed before retuerning.
Finally, calls to get_network and get_networks in plugins which only
extended the response with l3 attributes have been completely removed.
This patch improves the Nicira plugin test coverage by:
- adding a suite of test cases for nvplib
- removing unused exception handling code
- removing 'vestigial' code in nvp plugin modules
This patches also fixes a few minor glitches with the plugin
and the fake api client.
Aaron Rosen [Wed, 19 Jun 2013 20:46:06 +0000 (13:46 -0700)]
Remove duplicate _check_provider_update from plugins
This patch removes the duplicated method _check_provider_update
and adds a check for it in the NVP plugin that was missing so that an error
is raised if someone tries to update a provider network.
Carl Baldwin [Fri, 28 Jun 2013 03:07:00 +0000 (03:07 +0000)]
Update code to properly use dict returned from get_gateway.
Calling get_gateway was a late addition to my code to add a default
route in the DHCP namespace. The code did not properly handle the
dict returned from that method. This changes it to properly extract
the 'gateway' attribute from the dict.
Kanzhe Jiang [Fri, 28 Jun 2013 21:23:46 +0000 (14:23 -0700)]
Support a timeout argument when instantiating a bigswitch plugin
The timeout argument overwrites the timeout value set in the config file.
The change permits any standalone script to interact with the bigswitch controller
through the quantum plugin with customized timeout value without changing the plugin
behavior.
Instead of spawning ovs-vsctl for every port on br-int, we just dump the
required columns from the Interfaces table and grab the rows that we need. This
is a big win because the time it takes for ovs-vsctl to connect to the
openvswitch controller is orders of magnitude greater than the time it takes to
parse the rows. In practice, instead of taking roughly 1s per interface, the
agent's periodic task only takes 1s in total.
Mate Lakat [Fri, 28 Jun 2013 15:22:04 +0000 (16:22 +0100)]
dom0 rootwrap - case insensitive xenapi section
As per change https://review.openstack.org/33429 the config sections
became lowercase. This patch makes the quantum-rootwrap-xen-dom0
rootwrap to be case insensitive for the xenapi section.
This patch also changes the default config file to use a lowercase
xenapi section.