Commit Graph

24 Commits

Author SHA1 Message Date
Lucian Petrut 89915a752e Trivial: Move platform independent modules to common dir
async_process.py and ovsdb_monitor.py are now platform
independent, for which reason we can move them to
neutron/agent/common.

Note that a few subprojects are using async_process. We'll use
debtcollector so that we don't break those projects, while logging
a deprecation warning.

Change-Id: I6a7418cb8680cd71fe16c5d98b9b09ef2d260d37
2018-08-14 09:54:01 +03:00
Sławek Kapłoński 85b46cd51e Monitor phys_bridges to reconfigured it if created again
In case when external bridge configured in OVS agent's bridge_mappings
will be destroyed and created again (for example by running ifup-ovs
script on Centos) bridge wasn't configured by OVS agent.
That might cause broken connectivity for OpenStack's dataplane if
dataplane network also uses same bridge.

This patch adds additional ovsdb-monitor to monitor if any
of physical bridges configured in bridge_mappings was created.
If so, agent will reconfigure it to restore proper openflow rules
on it.

Change-Id: I9c0dc587e70327e03be5a64522d0c679665f79bd
Closes-Bug: #1768990
2018-05-07 22:53:20 +02: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
Terry Wilson 6975e2a48e Ensure ovsdb_connection enabled before calling monitor
ovsdb-client monitor attempts to connect to ovs via the
ovsdb_connection if it is set. Since it is set by default, we need
to ensure that OVS is listening on the socket before calling
ovsdb-client monitor.

Closes-Bug: #1669893
Depends-On: Ibde5417d005265d27e939ca29788c21f73b38980
Change-Id: Ia34b9d599b522dd12ef088100c2b68a75a78d797
2017-03-06 22:19:18 +00:00
Huan Xie 71edbb0d7d Support ovsdb-client monitor with remote connection
When using XenServer as hypervisor, we found we cannot set ovs
agent which runs in compute node with "minimize_polling=True".
Because once set it True, the ovs agent will monitor the local
ovsdb, but we want it monitor ovsdb in Dom0.
This patch is to add support for ovsdb-client to monitor remote
connection.

Change-Id: Idf2a564e96626dab3c4421a1f9139ed9ffcbcab1
Closes-bug: 1647914
2017-01-17 06:00:58 -08:00
Jakub Libosvar 42cc227798 Change default exception in wait_until_true
By default, wait_until_true uses default exception from eventlet which
is eventlet.TimeoutError. This class is not subclass of Exception but
BaseException. In case wait_until_true times out in any test, the whole
test executor worker is stopped leaving scheduled tests not executed.
This patch replaces eventlet.TimeoutError with new WaitTimeout
exception, that inherits from Exception and thus won't break execution
of other test cases in case it's raised.

Related-Bug: 1625221
Change-Id: I44c0c22f427f61d84963e6e59393b90fbaa8f058
2017-01-09 05:37:27 -05:00
Kevin Benton 62e88623d9 Watch for 'new' events in ovsdb monitor for ofport
This adjusts the event handling logic in the ovs interface
monitor to watch for 'new' events as well because this is
when ofports are assigned to the interface. Previously we
were only watching for 'insert' events, which would never
include the ofport so this led to every port being skipped
initially by the OVS agent and then picked up on the next
polling interval.

Closes-Bug: #1560464
Change-Id: I46ac508a839c6db779323d5afb083f3425f96e87
2016-03-17 05:21:37 -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
Ihar Hrachyshka a786a4edad SimpleInterfaceMonitor: get rid of self.data_received flag
It's not used anywhere outside tests, and there are better ways to
wait for updates.

The flag was once used to influence the state of activeness for the
monitor, but not anymore [1].

This cleanup also allows us to remove custom _read_stdout from the
monitor and reuse the one inherited from AsyncProcess. Meaning, we
also can safely get rid of another pile of duplicate tests.

[1]: I05faeddd061ab45af51c044a10462c3a57593d4d

Change-Id: I612d492c8f65a70e18f782a5e4d055de5f7948ef
2015-09-24 17:08:36 +02:00
Ihar Hrachyshka bdcf8e6079 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.

Change-Id: Ic20ded27ba09afdd73e4d96c47469c2d7b4d4db5
Related-Bug: #1495937
2015-09-21 17:55:38 +02:00
rossella cbeee7da50 SimpleInterfaceMonitor handle case when ofport is an empty set
ofport is usually an integer but when a port is not ready
ofport is an empty set.
This patch makes SimpleInterfaceMonitor handle that case too.

Change-Id: I91611d73e8d5551fc458082ce021cbeb5123a6f2
Closes-bug: #1485206
2015-08-26 10:10:42 +00:00
rossella 725543684c Add get_events to OVSDB monitor
OVSDB monitor can generate the events that the OVS agent
needs to process (device added or updated). Instead of
notifying only that a change occurred and that polling
is needed, pass the events to the agent

Change-Id: I3d17bf995ad4508c4c6d089de550148da1465fa1
Partially-Implements: blueprint restructure-l2-agent
2015-06-08 13:39:20 +00:00
rossella 3543d88586 Remove is_active property from SimpleInterfaceMonitor
is_active property from SimpleInterfaceMonitor shadows
the method is_active inherited from AsyncProcess.
The property checks that ovsdb monitor is running and
that it received some data. When ovsdb monitor starts
it always receives data, since it processes the interfaces
present on the machine, so the flag data_received will
always be set to true right after SimpleInterfaceMonitor
starts. Considering that, is_active can be removed and
the method is_active inherited from AsyncProcess can be
used instead.

Change-Id: I05faeddd061ab45af51c044a10462c3a57593d4d
2015-04-29 22:39:10 +00: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
Terry Wilson e627803bf4 Remove root_helper arg from AsyncProcess
Removes the root_helper arg from AsyncProcess and areas whose use
of root_helper was soley for passing it to AsyncProcess.

Change-Id: I6c34f2d8466444c82f8712a2a765975695795fd7
Partially-Implements: rootwrap-daemon-mode
2015-02-18 14:21:29 +00:00
Ihar Hrachyshka 3f44c9e278 Migrate to oslo.i18n
Mostly trivial import changes.

- oslo.i18n no longer provide install() method to inject _() into
  globals(), so removed all calls to it;
- removed Babel from dependencies (it will now be grabbed by oslo.i18n);
- updated tox.ini to ignore import violations for oslo.i18n.

Change-Id: I6623d551f512fb7fe9bf35ee734ed6d4c6cbc287
2014-11-26 22:19:24 +01:00
Gary Kotton e16b3a8f37 Update i18n translation for neutron.agents log msg's
Don't translate debug level logs and enforce log hints
Our translation policy
(https://wiki.openstack.org/wiki/LoggingStandards#Log_Translation) calls
for not translating debug level logs. This is to help prioritize log
translation. Furthermore translation has a performance overhead, even if
the log isn't used (since neutron doesn't support lazy translation yet).

NOTE: this is done on a directory by directory basis to ensure that we
do not have too many conflicts and rebases.

Add a local hacking rule to enforce this.

This patch set enforces the directory neutron/agents

Partial-bug: #1320867

Change-Id: I4bd562e5138c2d2850072440aa121f27e902463a
2014-11-15 00:08:20 -08:00
John Schwarz fdf0fa8b43 Fix leftover Timeout effecting most eventlet calls
When registering a new eventlet.timeout.Timeout object, eventlet
automatically starts a timer for most (if not all) future eventlet
calls. Normally, eventlet codes do not hold a timeout unless such a
timeout is used or a specific timeout length is specified through
the API, but once a Timeout object is initialized, it is left there
unless canceled.

This change fixes an un-canceled Timeout which causes some
functional tests to fail, reintroduces a fix for bug #1358206,
which was written prior to discovering the uncanceled timeout, and
increases the timeout of a test that depended on this timeout.

Closes-bug: #1358206
Related-bug: #1364171
Change-Id: I1bfc5af6917c525894eecd8b477d787763edbd02
2014-09-04 14:03:31 +03:00
Miguel Angel Ajo 44eff5daad Increase ovsdb_monitor.SimpleInterfaceMonitor start timeout
The current timeout fails during functional testing with
slightly higher load. Increasing it will lower the timeout
chances during high load conditions. Changed from 5 seconds
to respawn_interval/2. DEFAULT_OVSDBMON_RESPAWN = 30 , so
the default timeout will be 15 seconds.

Change-Id: I6a9e2977b275e96dcf01c4df90a33169c42287d6
Closes-Bug: #1358206
2014-08-25 20:58:24 +02:00
liu-sheng b30c47233d Remove the useless vim modelines
Change-Id: I41286e0b8f74c90b7078c3d3fb041b6586d95ab0
Closes-Bug: #1229324
2014-06-21 15:07:31 +08:00
Yuriy Taraday 53e784d27e Remove workaround for bug #1219530
Bug #1219530 has been fixed before Havana. We can remove this workaround.

Closes-Bug: #1307472
Change-Id: Ib0b1abf7d11627045be922f79aff6b80448ccbf4
2014-04-14 16:06:47 +04:00
Salvatore Orlando 2702baed39 Avoid processing ports which are not yet ready
This patch changes get_vif_port_set in order to not return
OVS ports for which the ofport is not yet assigned, thus avoiding
a regex match failure in get_vif_port_by_id.
Because of this failure, treat_vif_port is unable to wire
the port.
As get_vif_port_by_id is also used elsewhere in the agent, it has
been enhanced in order to tolerate situations in which ofport might
have not yet been assigned.

The ofport field is added to the list of those monitored by the
SimpleInterfaceMonitor. This will guarantee an event is generated
when the ofport is assigned to a port. Otherwise there is a risk
a port would be never processed if it was not yet ready the first
time is was detected. This change won't trigger any extra processing
on the agent side.

Finally, this patch avoids fetching device details from the plugin
for ports which have disappeared from the OVS bridge. This is a
little optimization which might be beneficial for short lived ports.

Change-Id: Icf7f0c7d6fe5239a358567cc9dc9db8ec11c15be
Partial-Bug: #1253896
2014-02-13 15:38:05 -08:00
Nachi Ueno 88148584f2 Fix misspells
Change-Id: I8be38727ca55ebbead9032cf69f10a1006fd004b
Closes-bug:1257424
2013-12-03 15:03:47 -08:00
Maru Newby cb0df591a9 Add the option to minimize ovs l2 polling
This change adds the ability to monitor the local ovsdb for
interface changes so that the l2 agent can avoid unnecessary
polling.  Minimal changes are made to the agent so the risk
of breakage should be low.  Future efforts to make the agent
entirely event-based may be able to use OvsdbMonitor as a
starting point.

By default polling minimization is not done, and can only be
enabled by setting 'minimize_polling = True' in the ovs
section of the l2 agent's config file.

Closes-Bug: #1177973

Change-Id: I26c035b48a74df2148696869c5a9affae5ab3d27
2013-10-14 22:24:15 +00:00