Commit Graph

15 Commits

Author SHA1 Message Date
Brian Haley 4f627b4e8d Change ip_lib network namespace code to use pyroute2
Change network namespace add/delete/list code to use
pyroute2 library instead of calling /sbin/ip.

Also changed all in-tree callers to use the new calls.

Closes-bug: #1717582
Related-bug: #1492714

Change-Id: Id802e77543177fbb95ff15c2c7361172e8824633
2017-10-04 21:09:28 +00:00
Inessa Vasilevskaya 7322bd6efb Make code follow log translation guideline
Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.

Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
2017-08-14 02:01:48 +00:00
Hunt Xu a15c849563 ProcessManager: honor run_as_root when stopping process
Without this commit, the run_as_root parameter is always True when
stopping a process, which leads to the usage of unnecessary sudo such as
in some functional tests, like the keepalived ones.

This commit fixes the aforemetioned problem by taking run_as_root into
account when stopping a process. However, run_as_root will still always
be True if the process is spawned in a netns.

Closes-Bug: #1491581

Change-Id: Ib40e1e3357b9a38e760f4e552bf615cdfd54ee5a
Signed-off-by: Hunt Xu <mhuntxu@gmail.com>
2017-04-22 15:23:59 +08:00
Swaminathan Vasudevan acd04d668b DVR: Clean stale snat-ns by checking its existence when agent restarts
At present there is no clear way to distinguish when the snat_namespace
object is initialized and when the actual namespace is created.
There is no way to check if the namespace already existed. The
code was only checking at the snat_namespace object instead of its
existence.

This patch addresses the issue by adding in an exists method to the
namespace object to identify the existence of the namespace in the
given agent.

This would allow us to check for the existence of the namespace,
and also allow us to identify the stale snat namespace and
delete the namespace when the gateway is cleared as the agent restarts.

This also applies for conditions when the router is manually moved
from one agent to another agent while the agent is dead. When the
agent wakes up it would clean up the stale snat namespace.
Change-Id: Icb00297208813436c2a9e9a003275462293ad643
Closes-Bug: #1557909
2016-08-04 10:39:15 -07:00
Doug Wiegley dd726ed494 Move i18n to _i18n, as per oslo_i18n guidelines
- This does NOT break other projects that rely on neutron.i18n,
  as this change includes a debtcollector shim to maintain those
  older entry points, until they can migrate.
- Also updates _i18n.py to the latest pattern defined by oslo_i18n
- Guidance and template are from the reference:
  http://docs.openstack.org/developer/oslo.i18n/usage.html

Partially-Closes-Bug: #1519493
Change-Id: I1aa3a5fd837d9156da4643a367013c869ed8bf9d
2015-12-01 19:29:10 -07:00
Cedric Brandily 23b907bc6e Remove deprecated use_namespaces option
The use_namespaces option has been defined as a workaround to kernels
not properly supporting namespaces. This limitation is behind us, it's
time to remove use_namespaces after its deprecation in Kilo in order to
simplify code and remove a poorly tested case (use_namespaces=False).

This change prepares for removal pullup_route method[1] which was only
used when use_namespaces=False.

[1] neutron.agent.linux.ip_lib

DocImpact
UpgradeImpact
Closes-Bug: #1508188
Related-Bug: #1435382
Depends-On: I303038eec560a6d99421140c2822aed8b518470b
Depends-On: I4feb2a15c7e1e4bfdbed2531b18b8e7d798ab3cc
Change-Id: I2fbf65df1250d9f9f1656b3964ee3b6de1ef1118
2015-11-18 19:17:29 +01:00
Dongcan Ye d18833dd6a Trivial fix in l3 agent
Remove unnecessary blank line and keep consistence about
blank space in l3 config.

Change-Id: Ia69393db85aacabad266f056995c15f043f32bfb
2015-11-09 18:20:23 +08:00
Oleg Bondarev b220d10125 Do not delete fip namespace during l3 dvr agent resync
This was introduced by commit 46608806aa
which didn't take into account that fip namespace name is composed
from external network id rather than router id.
The fix is to ensure fip namespaces for the known routers are kept
by namespace manager on agent resync.

Closes-Bug: #1482521
Change-Id: I0ffd0a3f6d83f7356638827a1cfe4dabef24b891
2015-08-07 20:10:25 +03:00
Oleg Bondarev 46608806aa DVR: cleanup stale floating ip namespaces
During l3 agent periodic resync NamespaceManager takes care
of cleaning up stale router namespaces. This is true
for qrouter- and snat- namespaces. However stale fip-
namespaces also need to be cleaned up.
The patch adds fip-ns handling to the NamespaceManager.

Closes-Bug: #1470909
Change-Id: Ib6a8ae2ff66c0e1dd0978838c3f274748898f73e
2015-07-03 18:29:07 +03:00
Oleg Bondarev 9efa1fdeed l3 agent: do router cleanup for unknown routers
The patch adds cleanup on router delete for routers which
are unknown to agent. This should cover the case when router is
deleted during resync on agent init.

Functional tests were updated and now handle 3 cases for l3 sync:
 - no routers were deleted during agent downtime,
 - some routers were deleted during agent downtime
 - some routers were deleted during agent resync

Closes-Bug: #1464238
Change-Id: Id98111849fa88d6807f757864187b059c491aaac
2015-06-22 16:13:35 +03:00
Oleg Bondarev b058658780 Cleanup stale metadata processes on l3 agent sync
Currently l3 agent only cleans up stale namespaces.
The fix adds checking and deleting stale metadata processes
to NamespaceManager class responsible for clearing stale
namespaces

Change-Id: I2b081803e312589d3d8a7808d286a6c9827ef53f
Closes-Bug: #1455042
2015-05-29 13:55:55 +03:00
Carl Baldwin d0d7030ce7 Utilities for building/parsing netns names to facilitate testing
Creating these utilities allows functional tests to mock them out more
easily to in order to change the namespace identification and cleanup
behavior.

Change-Id: I76cb2dc43a0ca4a7ea27c2ea71b27068b92154ce
Related-Bug: #1446261
2015-04-24 16:43:26 +00:00
Martin Kletzander 94951504a1 Fix common misspellings
Wikipedia's list of common misspellings [1] has a machine-readable
version.  This patch fixes those misspellings mentioned in the list
which don't have multiple right variants (as e.g. "accension", which can
be both "accession" and "ascension"), such misspellings are left
untouched.  The list of changes was manually re-checked for false
positives.

[1] https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines

Partial-Bug: #1390035
Change-Id: Ie5d86247cc4f50b6578a9b76c9c8cade35128d5a
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2015-03-24 11:44:15 +01:00
Ihar Hrachyshka 22328baf1f Migrate to oslo.log
It's mostly a matter of changing imports to a new location.

Non-obvious changes needed:
* pass overwrite= argument to oslo_context since oslo.log reads context
  from its thread local store and not local.store from incubator
* don't store context at local.store now that there is no code that
  would consume it
* LOG.deprecated() -> versionutils.report_deprecated_feature()
* dropped LOG.audit check from hacking rule since now the method does
  not exist
* WritableLogger is now located in oslo_log.loggers

Dropped log module from the tree. Also dropped local module that is now
of no use (and obsolete, as per oslo team).

Added versionutils back to openstack-common.conf since now we use the
module directly from neutron code and not just as a dependency of some
other oslo-incubator module.

Note: tempest tests are expected to be broken now, so instead of fixing
all the oslo.log related issues for the subtree in this patch, I only
added TODOs with directions for later fix.

Closes-Bug: #1425013
Change-Id: I310e059a815377579de6bb2aa204de168e72571e
2015-03-12 11:22:56 +01:00
Miguel Lavalle 01a7ba19cf Refactor management of namespaces in the L3 Agent
Creates classes representing the 3 types of namespaces handled by the L3 agent:
router, snat and fip.

The scope of this change is:

- Creation and deletion methods are provided for each namespace class
- Creation and deletion of router and snat namespaces are moved to the router
  classes. These namespaces are now members of the corresponding router class
- Invocation of Fip namespace creation and deletion is left in the agent, since
  the agent owns it
- A context manager is provided to move the namespaces (router and snat)
  cleanup code out of the agent

A follow up patchset will add methods to create and delete interfaces in the
namespaces. These methods are intended to be used by the router classes

Change-Id: I54b14e593ded6b2990d57a3ae9d598a699ae133e
Partially-Implements: bp restructure-l3-agent
2015-03-04 21:28:23 +00:00