Maru Newby [Tue, 23 Oct 2012 22:25:54 +0000 (22:25 +0000)]
Add unit tests for the ovs quantum agent.
* Supporting the quantum dhcp agent on XenServer/XCP requires
modifying the ovs agent. As no unit tests exist at present for
the ovs agent, this change adds enough test coverage to help
ensure that the modifications to support xen will not break
existing functionality.
* Supports blueprint xenapi-ovs
He Jie Xu [Sat, 13 Oct 2012 10:00:20 +0000 (18:00 +0800)]
add test for create subnet with default gateway and conflict allocation pool
Create subnet with default gateway and conflict allocation pool should return
status code 409:
$ quantum subnet-create net1 --allocation-pool start=10.0.0.1,end=10.0.0.5 \
10.0.0.0/24
Found overlapping allocation pools:{u'start': u'10.0.0.1',
u'end': u'10.0.0.5'} 10.0.0.1 for subnet 10.0.0.0/24.
Due to some issues using OVS internal interfaces across namespaces
with OpenFlow controllers (bug 1048681), a patch introduced the
OVSVethInterfaceDriver in addition to the base OVSInterfaceDriver.
However, OVSVethInterfaceDriver is just a variation of OVSInterfaceDriver
and the difference is how to create an interface (OVS internal vs veth).
This patch merge OVSVethInterfaceDriver into OVSInterfaceDriver
by introducing a new flag 'ovs_use_veth' (which defaults to False).
The patch adds a log entry indication that the service has started. In
addition to this if there is an "exit" statement in the code, then the
log message will indicate that the service has been terminated.
The port creation code did not correctly treat a database error. That is,
if there was an exception the port would be created and an error returned
to the client.
======================================================================
ERROR: test_ofp_server (quantum.tests.unit.ryu.test_ryu_db.RyuDBTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/quantum/tests/unit/ryu/test_ryu_db.py", line 30, in setUp
options = {"sql_connection": cfg.CONF.DATABASE.sql_connection}
File "/quantum/openstack/common/cfg.py", line 1039, in __getattr__
return self._get(name)
File "/quantum/openstack/common/cfg.py", line 1361, in _get
value = self._substitute(self._do_get(name, group))
File "/quantum/openstack/common/cfg.py", line 1377, in _do_get
info = self._get_opt_info(name, group)
File "/quantum/openstack/common/cfg.py", line 1470, in _get_opt_info
raise NoSuchOptError(opt_name, group)
NoSuchOptError: no such option: DATABASE
----------------------------------------------------------------------
Ran 1 test in 0.001s
Julien Danjou [Tue, 2 Oct 2012 13:37:49 +0000 (15:37 +0200)]
Fix filters default value in get_networks
With that change, if get_networks() is called without fields set to
something, _filter_nets_l3 fails because it tries to call "filters.get()"
where filters is None.
Add an explicity user in the configuration file regarding consequences of
enabling overlapping IPs when Quantum is used with nova security groups
and/or metadata.
This patch adds a global configuration option for enabling or disabling
overlapping IPs for subnets in different networks.
If they are disabled, the validation of the CIDR against overlapping
ones should be performed globally and not just among subnets defined for
the current network.
So far unit tests were executed using an in-memory database.
Memory was not being freed thus causing oom frequently due to
the increased number of unit tests.
Since sqlite in memory db do not work very well anyway with nose,
we are moving to file-based databases; slower, but safer.
Also, this patch removes a bunch of unit tests which do not add
anything to code coverage or number or test cases exercised.
the l3 agent checked if the external network bridge exists in its
constructor, raising an uncaught exception if it did not. this does not
make much sense when running the l3-agent as a deamon, especially since
it can be the case that the l3-agent starts before open vswitch.
when running in db-mode, the ovs plugin agent will catch any unexpected
exceptions generated during processing. However, in rpc-mode, this
does not happen, meaning a small error, even a transient one, causes the
agent to exit completely. Thic change adds a try-catch block to the
rcp_loop(), causing the agent to log any unexpected exception, wait for
the polling period, then retry the loop after resetting all state.
Bob Kukura [Thu, 20 Sep 2012 20:03:14 +0000 (16:03 -0400)]
Fix OVS and LB plugins' VLAN allocation table synchronization
In both the openvswitch and linuxbridge plugins, if previous entries
for a physical network have been completely removed from the
network_vlan_ranges configuration variable, allocation table records
for unallocated VLANs on that physical network are now removed from
the DB at startup. The test_ovs_db and test_lb_db unit tests have also
been extended to cover this case. Fixes bug 1052289.
Test assertions that were added to the test_ovs_db unit test in
https://review.openstack.org/#/c/11388 have been added to the
test_lb_db unit test. Fixes bug 1045596.
Python ignores SIGPIPE on startup, because it prefers to check every
write and raise an IOError exception rather than taking the signal. Most
Unix subprocesses don't expect to work this way. This patch (adapted
from Colin Watson's post at http://tinyurl.com/2a7mzh5) sets SIGPIPE
back to the default action for quantum.agent.linux.utils.execute,
quantum.common.utils.execute and quantum-rootwrap created subprocesses.
Checks for the validity of the VLAN ID needed to be performed. In cases where
segmentation ID is not greater than zero, the Nexus sub-plugin does not
need to be invoked for that network.
the l3-agent only pushes down some of the DNAT rules for metadata mapping
if there is a gateway set on a router. However, the nova-api server could
itself be running in the local router namespace (or on the same box as
the quantum-l3-agent in the case were namespaces are disabled. In fact,
with namespaces disabled, this is the likely setup for a simple
environment). Thus, we should simply always push down the metadata nat
rules for a router, router than waiting until a gateway is added.
This patch also refactors the actions taken by the l3-agent when a router
is added or removed into a separate function for improved readability,
as add/removing the nat rules made these code segments even longer.
* eval() was previously used to marshall unchecked strings as
filter parameters for QuantumDbPluginV2.get_ports() via
the --fixed_ips flag.
* This change removes the use of eval and cleans up the filtering
implementation for get_ports().
* The new filtering implementation does not support arbitrary
OR'ing or AND'ing. Instead, multiple values for a given filter
key are logically OR'ed, and filters across keys are AND'ed.
* Example usage - filter for .2 or .3 in the given subnet:
This fixes the exceptions occurring in the virtual switch mode of the
Cisco plugin for create/delete/update network operations. The exceptions
were occurring on account of the recent changes in the OVS module to the
get_vlan and get_vlans methods, which were still being invoked here.
Test configuration has been changed to increase the code coverage to
catch such issues in the future. All changes are limited to the Cisco
plugin and related tests.