Unify exception thrown in l3-agent-scheduler fails
Since you can only attach a single l3 agent to a router, when you try
to add another l3 agent to a router that already have one, the l3
agent scheduler raises an exception.
This fix removes the discrimination by id: either it is the same agent
or another one, the router can not be hosted and the same exception is
raised.
Mock os.makdirs to avoid directory creation in unit tests
The directory 'dhcp' under neutron state path should not be
created during unit tests. This patch mocks up calls to
os.makedirs and ensures that methods that rely on it, like
_populate_network_cache, are mocked as well.
Carl Baldwin [Tue, 13 Aug 2013 00:11:29 +0000 (00:11 +0000)]
Refactor configuring of floating ips on a router.
This approach to configuring floating ips is stateless and idempotent.
This allows it to handle corner cases, such as reusing a floating ip
address with a different floating ip id in a way that is easier to
understand.
The concept is to wipe the floating ips clean and rebuild them each
time with the following optimizations. To avoid bad performance in
manipulating iptables, it is called in the context of a call to
defer_apply_on. To avoid a disruption in network flow a set
difference is use to determine the set of addresses that no longer
belong on the inteface rather than removing them all blindly.
The call will cause a failure as the router port is already removed
by _nvp_delete_router_port.
This patch also add the support on the fake nvp api client to verify
this kind of condition.
Previously neutron was keeping track of dhcp lease time in order
to ensure it didn't hand out an ip address that was already leased.
This patch removes that logic and instead leverages the dhcp_release
utility. This allows us to reuse ip addresses immediately after a port
is deleted. This patch also bumps the lease time to 24 hours instead
of 2 minutes with reduces the amount of dhcp traffic.
DocImpact
There is a DocImpact for this bug related to the upgrade path. One should
first upgrade their dhcp-agents. Then wait till the dhcp_lease time has
expired. Lastly, update neutron-server in order to avoid the case where
an instance is deleted and the dnsmasq process has not released the lease
and neturon allocates that ip to a new port.
Aaron Rosen [Wed, 7 Aug 2013 18:24:01 +0000 (11:24 -0700)]
Fix some NVP tests do not do cleanup of nvp ports
Some of the NVP test do not execute self.addCleanup(self.fc.reset_all)
from setUp() as NiciraPluginV2TestCase is not the first mixin.
This casuses left over ports to still exist between different testcases.
This patch only fixes this issue for TestNiciraPortsV2 and
NiciraPortSecurityTestCaseas, some of the other tests require the setUp()
for the first mixin to be called for their tests to work.
Note: this is why the tests for the Remove DHCP lease logic are failing.
Ryota MIBU [Mon, 12 Aug 2013 05:10:40 +0000 (14:10 +0900)]
Fix resource status in NEC Plugin
This commit makes sure that the plugin exposes right status in a
response body, and does not overwrite ERROR status until another
operation to the backend has succeeded.
This commit also changes NEC Plguin to use neutron constants instead of
OperationalStatus defined in this plugin.
Add support for the Nexus 1000V into the Cisco Plugin.
This will enable the Cisco Nexus 1000V to integrate with the Cisco plugin
and be used to drive the realization of Neutron constructs.
Network profile and Policy profile are introduced as extended neutron
resources, while n1kv:profile_id is introduced as an extended attribute
for network and port objects. Necessary changes to the Cisco plugin are
made to accomodate Nexus 1000V as a configurable vswitch plugin.
Removes nested transactions wrapping plugin ops, and adds
rollback code where required.
Also ensures NeutronPlugin.py does not attempt to remove router
ports twice.
Enable 'dict validators' to convert composite attributes' items
using a 'convert_to' specification in a way similar to first-level
API attributes.
This is needed in order to ensure boolean sub-attributes are
properly handled.
This change modifies the model hook processing to call the method on the
instance if a hook is registered as a string. If the hook is a
callable, then callable is called with the hook arguments.
Matt Riedemann [Thu, 8 Aug 2013 19:33:10 +0000 (12:33 -0700)]
Make SubnetMismatchForPort extend BadRequest rather than Conflict
Nova is trying to do a better job of mapping Neutron exceptions and
change I4c087684ef77988e5f463d7f2f50fc2a04f37db0 is trying to map 409 to
the proper nova exception. In looking at what raises a 409 exception in
Neutron, the SubnetMismatchForPort exception seemed like a candidate for
changing from Conflict (409) to BadRequest (400) to ease that mapping.
Note that the only thing currently using this exception is the L3 router
extension when removing a router interface and the 400 response code is
already listed in the API docs as a possible response code:
Luis A. Garcia [Wed, 31 Jul 2013 16:04:31 +0000 (16:04 +0000)]
Externalize error messages in the API
This patch does more internationalization for the REST API error
messages that don't currently have it to take advantage of the new
support added by bp user-locale-api to show error messages in the locale
requested by the user through the Accept-Language HTTP header.
Luis A. Garcia [Tue, 30 Jul 2013 18:52:05 +0000 (18:52 +0000)]
Enable localizable REST API responses via the Accept-Language header
Add support for doing language resolution for a request, based on the
Accept-Language HTTP header. Using the lazy gettext functionality, from
oslo gettextutils, it is possible to use the resolved language to
translate exception messages to the user requested language and
return that translation from the API.