Make test_server work with older versions of oslo.service
Change I18a11283925369bc918002477774f196010a1bc3 fixed the test for
oslo.service >= 0.10.0, but it also broke it for older versions of
oslo.service. Since the library has minimal version of >= 0.7.0 in
requirements.txt, test should pass for those versions too.
Now, instead of validating that either reset() or restart() of workers
are triggered on SIGHUP, just validate that .start() is triggered the
expected number of times (either way, no matter how oslo.service decide
to clean up the children, they exit and then are respawned).
By mocking 'open' at the module level, we can avoid affecting
'open' calls from other modules.
2. Stop using LOG.exception in contexts with no sys.exc_info set
Python 3.4 logger fills in record.exc_info with sys.exc_info() result
[1], and then it uses it to determine the current exception [2] to
append to the log message. Since there is no exception, exc_info[1] is
None, and we get AttributeError inside traceback module.
It's actually a bug in Python interpreter that it attempt to access the
attribute when there is no exception. It turns out that it's fixed in
latest master of cPython [3] (the intent of the patch does not seem
relevant, but it removes the offending code while reshuffling the code).
Note that now cPython correctly checks the exception value before
accessing its attributes [4].
The patch in cPython that resulted in the failure is [5] and is present
since initial Python 3k releases.
When l2 agent execute ipset command, we should pass
parameter 'check_exit_code' to self.execute acording to
action.
The intention is to safely fail if we try to destroy a
non existing set, or delete a non existing member.
Otherwise the agent gets stuck in a loop if such situation
happens. Such kind of event would be logged as errors.
The option force_metadata=True breaks the dhcp agent
Patch I5f6ee9788717c3d4f1f2e2a4b9734fdd8dd92b40 has an issue with
force_metadata = True.
Using the option force_metadata=True while
enable_isolated_metadata=False (which is the default), will break the
dhcp agent because the variable subnet_to_interface_ip is being
referenced before assignment.
Co-Authored-By: Jakub Libosvar <jlibosva@redhat.com>
Change-Id: I4e1d918e3a24dd483ee134021f587ae4520bf431
Closes-Bug: #1499406
(cherry picked from commit 473c338ff8c5526157d297b7e90d5e4f5e94cbb9)
Matt Riedemann [Thu, 1 Oct 2015 13:55:14 +0000 (06:55 -0700)]
Do not log an error when deleting a linuxbridge does not exist
When you're racing to teardown and relying on RPC, it should not be
considered an error that a bridge does not exist when you're trying to
delete it anyway. This is better served as debug level information.
For context, this shows up over 1000 times in successful
gate-tempest-dsvm-neutron-linuxbridge job runs in a week so it's
probably safe to say it's not contributing to test failures.
Henry Gessau [Sun, 27 Sep 2015 19:36:59 +0000 (15:36 -0400)]
Tag the alembic migration revisions for Liberty
Previously when we had one repo with one alembic branch we would
create a milestone revision on that single branch. Now we have
multiple repos and expand/contract branches for each repo.
So from now on we tag the final revision on every branch when we make
a milestone release. Update the cli to support the command:
neutron-db-manage upgrade <milestone>
where <milestone> becomes an alias for all the revisions for a
milestone.
Fixes 'ovs-agent cannot start on Windows because root_helper opt is not found'
Change Ie1224f8a1c17268cd7d1c474ed82fdfb8852eaa8 removed
config.register_root_helper() from ovs_neutron_agent:main, thus the agent
cannot start on Windows since root_helper config option is never
registered.
The fix consists in adding config.register_root_helper in the Windows side
utils.
James Page [Thu, 1 Oct 2015 10:54:28 +0000 (11:54 +0100)]
Use format to convert ints to strings
This ensures that on 32bit architectures, where
sometimes an implicit long is created, the resulting
string does not contain a 'L' suffix as generated
by the hex function.
Fixes 'ovs-agent fails to start on Windows beacause of SIGHUP'
Change Ic0cf8a9ca7f3a16b556a6825e2979471ae136c33 has added the handling
of SIGHUP in neutron_ovs_agent. This does not work on Windows as there is
no SIGHUP signal on windows.
The fix consists in checking if signal has SIGHUP attr before setting the handler
for SIGHUP.
Toni Ylenius [Wed, 5 Aug 2015 12:06:00 +0000 (15:06 +0300)]
usage_audit: Fix usage_audit to work with ML2
The script didn't work with the ML2 plugin as router related
functionality is moved to the L3 router service plugin. The fix assumes
that the L3 router service plugin is in use, and this seems to apply to
most of the current core plugins.
Ihar Hrachyshka [Thu, 1 Oct 2015 15:13:25 +0000 (17:13 +0200)]
metadata: don't crash proxy on non-unicode user data
We attempt to log every successful metadata response with LOG.debug. But
as per oslo.log docs [1], we should make sure that what we pass into the
library is unicode.
Http.request returns a tuple of Response object and a string, which is
bytes in Python 2.x [2].
That's why we need to convert the response content to unicode before
passing it into oslo.log.
To achieve it, we utilize encodeutils.safe_decode with 'replace' errors
handling strategy, so that we don't get exceptions on input that does
not conform unicode.
For the unit test case, we pass a string that is not expected to convert
to unicode with errors='strict' strategy or similar, and check that we
still don't crash.
While at it, we remove a check for the number of log calls being
triggered, because it's something that we should avoid validating in
test cases, and it cannot trigger a real bug. The mock that was used to
count the number would also hide the bug that we try to reproduce.
Note that the bug does not require debug to be set because the crash
occurs before oslo.log machinery decides it should not log the message.
Terry Wilson [Mon, 28 Sep 2015 22:42:25 +0000 (17:42 -0500)]
Check idl.run() return value before blocking
The IDL change_seqno can change as a result of running idl.run(), and
it returns True if there has been a change. The existing code would
block without checking the return value, and therefor could block
until another change occurred, or the timeout was reached.
Kevin Benton [Fri, 18 Sep 2015 14:15:45 +0000 (07:15 -0700)]
Don't write DHCP opts for SLAAC entries
Change I81b4669eadaa9119e08c6a5e1d2a7b5959babdcc
caused DHCP options to be written for SLAAC entries
when they previously were not. This restores the previous
behavior.
Andreas Jaeger [Thu, 24 Sep 2015 18:53:09 +0000 (20:53 +0200)]
Cleanup of Translations
In preparation for the release, do some cleanups for translations.
Removes all po files that are partially translated. The translation
team has decided to exclude files with less than 66 % of translated
content. There is no content lost, all data is in the translation
server, we just remove it from the repository.
This updates also recreates pot (translation source files) to
reflect the state of the repository in case there was no recent
import for them.
This change needs to be done manually since the automatic import does
not handle some of these cases.
This simple patch ensures usage for security group rules is
marked as dirty when a security group rule is deleted.
To this aim, the security group rule is deleted using ORM
in order to ensure the sqlalchemy even if fired.
Miguel Lavalle [Tue, 22 Sep 2015 22:22:31 +0000 (17:22 -0500)]
Eliminate autoaddress check for DNS integration
The autoaddress check for DNS integartion is not required anymore. It is
removed from the DB plugin. This check was being performed to reflect
incorrect functionality in the DHCP agent as indicated in bug
https://bugs.launchpad.net/neutron/+bug/1498665
Carl Baldwin [Wed, 16 Sep 2015 21:53:54 +0000 (21:53 +0000)]
Only get host data for floating ips on DVR routers
First, we are only interested in setting the host attribute when
the router is a DVR router. Second, we don't need to query all of
the ports on the host, we just need to query the ports that are
referenced by the set of floating ips that we already have.
Ryan Moats [Mon, 21 Sep 2015 20:56:26 +0000 (15:56 -0500)]
Link dashboards into generated documentation
Move the dashboard directory under the source tree so that
it is available on generated builds. In addition, recast
image pages as RST so that they will be rendered
Change-Id: I316128491e8dae70ac06e260f5bdd8f440d285aa Signed-off-by: Ryan Moats <rmoats@us.ibm.com>
ml2: don't consider drivers with no bind_port for qos supported rule types
If the driver is not going to bind a port, we should not use it as
justification to limit the subset of rule types available for the user.
The most common scenario for that would be l2pop, that does not handle port
binding, but merely modifies the implementation details of node
interconnection.
service_provider is a 'special' configuration. It is a MultiStr
option that used to be in neutron.conf, but moved into its own *-aas
config files after the service split. We allow for the definition to
be available 'anywhere': either in neutron.conf or in the *-aas
service's config file.
The list of 'service_provider' can include drivers from within the *-aas
tree, or from elsewhere, and can apply to different service types. Due to
the polymorphic nature of this variable it is very tricky to identify only
the drivers that pertain a specific service module: the service module
may as well implement more than one service type and may have support
from drivers out of tree.
For this reason it is best to relax this check and rely on query filters
when the ServiceManager.get_service_providers() is invoked. Furthermore,
without this fix there was a situation where the value returned by
'service_providers' may be differ depending on how the configuration is
passed on the CLI, and this inconsistency may only cause headaches.
ovsdb monitor: get rid of custom _read_stdout/_read_stderr methods
Those methods do the same thing as AsyncProcess counterparts, just
with logging the received output. It's better to move the logging into
AsyncProcess and control it with __init__ arguments.
This allows us to get rid of some duplicate tests for ovsdb monitor.
delete_port: ensure quota usage is marked as dirty
To this aim the ORM session mapper must be used.
This patch simply uses context.session.delete rather than
query.delete, and handles UnmappedInstanceError to safely
complete the operation when the record is deleted by
another transaction.
Miguel Angel Ajo [Thu, 11 Jun 2015 11:15:17 +0000 (13:15 +0200)]
Fix hostname roaming for ml2 tunnel endpoints.
Change I75c6581fcc9f47a68bde29cbefcaa1a2a082344e introduced
a bug where host name changes broke tunneling endpoint updates.
Tunneling endpoint updates roaming a hostname from IP to IP
are a common method for active/passive HA with pacemaker and
should happen automatically without the need for API/CLI calls [1].
delete_endpoint_by_host_or_ip is introduced to allow cleanup of
endpoints that potentially belonged to the newly registered agent,
while preventing the race condition found when deleting ip1 & ip2
in the next situation at step 4:
1) we have hostA: ip1
2) hostA goes offline
3) hostB goes online, with ip1, and registers
4) hostA goes online, with ip2, and registers
Kahou Lei [Sun, 13 Sep 2015 01:48:04 +0000 (18:48 -0700)]
Fix adding tap failure if bridge mapping is not provided
When bridge mapping option is not provided, tap interface cannot be
added properly. The root cause is that linux bridge agent is expecting
bridge mapping option is provided if physical network is presented.
However it is not always the case as Kilo was working fine
without existing bridge mapping
For every router interface added to a router
with a default gateway there will be an internal
SNAT port generated and will be required by the
L3 Agent to process the SNAT rules.
This bug was introduced by the change ID below
Icc099c1a97e3e68eeaf4690bc83167ba30d8099a.
When the gateway is removed these ports have to
be removed from the namespace. These ports are
cached in the router_info and should be provided
to the get_snat_port_for_internal_port function
when called from external_gateway_removed or when
called from _dvr_internal_network_removed.
Ann Kamyshnikova [Fri, 18 Sep 2015 15:21:44 +0000 (18:21 +0300)]
Update _TestModelMigration
_TestModelMigrationTest contain some duplication of code from oslo.db.
As change 94d583acde16860e7ca535bd7a960e8993cd12d2 was merged and
included in oslo.db 2.4.1 this duplication can be avoid.
Pecan defines several efficient mechanism for routing requests to
the appropriate controller, but the current code for Neutron's
Pecan WSGI server basically uses Pecan hooks to route requests.
This patch partially fixes that, removing the 'resource_identifier'
pecan hook and replacing it with explicit pecan routes between
controllers added at resource registration time.
All the remaining hooks, like attribute_population and
policy_enforments, which were relying on finding the resource
name in the pecan.request threadlocal variable have been updated.
This patch also:
- ensures the appropriate plugin is always selected for a given
resource
- add a common NeutronPecanController base class for the classes
CollectionsController and ItemaController
- Fixes the way in which plurals and singulars are handled in
neutron.api.v2.resource_heper
Have you ever wondered why you were making the same mistakes
over and over again and wondered how you can remind yourself not
to repeat them again?
Have you ever felt like you posted review comments on some other
patch, only to see that the same anti-pattern was adopted in
someone else's?
Have you wondered what the heck that test was meant to validate?
Does that sound familiar to you? Yes? Great, we have the answer
for you! 'Effective Neutron' is the solution to all your problems!
From now on, everytime you bang your head against the monitor, do
not despair! You may find the answer to your grief in our collective
guide!
Go check it out!
(Your mileage may vary -- add your disclaimer here)
Jakub Libosvar [Thu, 17 Sep 2015 13:26:05 +0000 (13:26 +0000)]
Introduce kill_signal parameter to AsynProcess.stop()
All stop() calls of instances of AsyncProcess class were sending
hardcoded SIGKILL signal to its process. This patch leaves the default
behavior to SIGKILL but offers any number to be sent to kill command.
Note: Internal private methods also got a new parameter which is not
appended. Given that those methods are private and thus not used
outside of the class, we can afford it.