Added ``devlink.get_port`` method that provides information about
a devlink port [1]. It is used to retrieve information about a port
representor connected to a local OVS instance (aka: hardware offloaded
ports). This method reports the PF PCI address, the PF index, the VF
index and the PF name; the PF name will be used to enforce the QoS
policies on the SR-IOV parent device (similar to what is done in the
ML2/SRIOV agent).
[1]https://www.kernel.org/doc/html/latest/networking/devlink/devlink-port.html
Related-Bug: #1998608
Change-Id: I34daf554cabcf17cb6371d510d5827457012516d
Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
the ones in neutron/agent and neutron/privileged/agent.
Trivialfix
Change-Id: Ib94257481e62b99b3d7648ae5137af5411b4867a
Implement the "kill" method (send a signal to a process) using the
Python native library "os".
In functional tests, "RootHelperProcess.kill" method should not fail if
the process does not exist.
Closes-Bug: #1843446
Closes-Bug: #1843418
Change-Id: Iee97a83779dd3e20eb3a223fb8557a94b8f15dc0
Replace rootwrap execution with privsep context execution.
This series of patches will progressively replace any
rootwrap call.
This patch migrates the "kill_process" method to privsep and
removes the unneeded rootwrap filters.
Change-Id: I48461be8b08cbc21c8af371f551b944343ba37bf
Story: #2007686
Task: #41558
Replace rootwrap execution with privsep context execution.
This series of patches will progressively replace any
rootwrap call.
This patch replaces some "IpNetnsCommand" command execution
methods.
Change-Id: Ic5fdf221a2a2cd0951539b0e040d2a941feee287
Story: #2007686
Task: #41558
The translation marker _(..) wrapping a variable is meaningless
as no string is extracted and there is no way to translate them.
Only rare exception is the same string is defined in somewhere else
but I've never seen such situations so far.
In addition, we now only support translations in user-visible messages
used in API, so we can safely drop translation markers in exceptions
in the agent side.
Change-Id: Ie1d837d17bf50a4675bec4fe48ab13dde22ebdc2
Related-Bug: #1600788
The main idea of the commit is to fix code
according with the latest oslo.i18n requirements
https://docs.openstack.org/oslo.i18n/latest/
1. removed log translation if log is not seen by users
in raised exception or api call response.
2. keep translated log if it's used in raised exception.
3. removed log message 'Error while reading %s'
which was "dead" (unused) code in the function
"_get_value_from_conf_file"
of module "agent/linux/dhcp.py".
Partial-Bug: 1600788
Change-Id: Ifb5455336b06c2c87a930b816c90b4a766856b1e
Both files cannot be deleted with the default permissions because
those files are created by the "root" user.
Change-Id: I73dd37b3104fac8d3172f520f71cffd85d040c4b
Closes-Bug: #1907695
Since [1], Neutron sets the name of some processes (Neutron agents).
The "ps" output is modified consequently according to the defined
string:
"<process name> (<process command>)"
"AsyncProcess" class should use the process name to parse the "ps"
output correctly.
Closes-Bug: #1902678
[1]https://review.opendev.org/#/c/735125/
Change-Id: If33c49c0f3e1e6696f5d2aa4008b287dc3f76c61
For neutron-l3-agent, after the execution of the linux command fails,
display which command failed to execute
Change-Id: Ia237e1b18e02c9da3ae9ee94e4244828e5c207b2
Closes-Bug: #1893627
Before this patch function get_value_from_file() was only
logging something like "Unable to access {filename}" but it
would be useful sometimes to check what was exact reason of
IOError so lets log this info also.
TrivialFix
Related-bug: #1853652
Change-Id: I28b1753a8d5767babbb6f06a581ffe1fc4ad75d3
Even though we check for the existence of the process before, it may
still terminate before we get to read its command line, so catch the
error that can occur here.
Change-Id: I3e89aca8bedfd2912effe2490718223f7d03133e
Closes-Bug: 1844500
Removed E125 (continuation line does not distinguish itself
from next logical line) from the ignore list and fixed all
the indentation issues. Didn't think it was going to be
close to 100 files when I started.
Change-Id: I0a6f5efec4b7d8d3632dd9dbb43e0ab58af9dff3
In patch [1] get_cmdline_from_pid function was modified to be able
to parse process' cmdline files with arguments separated by space
instead of '\0' char.
This patch adds one extra UT and small refactor which was pointed
in comments to [1] but which I was not able to change there.
[1] https://review.openstack.org/#/c/647605/
Change-Id: Ibd91d0472a686eca79a1126154d9cdf4587c1a19
Related-Bug: #1820870
According to proc man page process arguments in /proc/{pid}/cmdline
should be separated with '\0' char and that char was used in
neutron.agent.linux.utils.get_cmdline_from_pid function.
Recently in fullstack tests it was noticed that sometimes it may
happend that those arguments are separated with space char and this
caused failed test because async_process.AsyncProcess() was not able
to check that process is really active.
This patch adds attempt to split cmdline arguments with space in case
when split with '\0' returns only 1 element.
Change-Id: I35d4c0e2cf56fc3ff15cf307aaf11a8ad8489e1f
Closes-Bug: #1820870
If l3-agent was restarted by a regular action, such as config change,
package upgrade, manually service restart etc. We should not set the
HA port down during such scenarios. Unless the physical host was
rebooted, aka the VRRP processes were all terminated.
This patch adds a new RPC call during l3 agent init, it will try to
retrieve the HA router count first. And then compare the VRRP process
(keepalived) count and 'neutron-keepalived-state-change' count
with the hosting router count. If the count matches, then that
set HA port to 'DOWN' state action will not be triggered anymore.
Closes-Bug: #1798475
Change-Id: I5e2bb64df0aaab11a640a798963372c8d91a06a8
Today the neutron common exceptions already live in neutron-lib and are
shimmed from neutron. This patch removes the neutron.common.exceptions
module and changes neutron's imports over to use their respective
neutron-lib exception module instead.
NeutronLibImpact
Change-Id: I9704f20eb21da85d2cf024d83338b3d94593671e
When eventlet was bumped up to 0.24.1 in upper-constraints [1]
it started generating a pylint warning, since neutron has
support for older versions such as 0.22.0 that take a different
number of arguments. Just silence the warning.
Also, in order to get this through the gate, the
neutron-grenade-dvr-multinode check job is being temporarily
set to non-voting and removed from the gate. That change
should be reverted as soon as we fix bug 1791989.
[1] https://review.openstack.org/#/c/589382/
Change-Id: I169ecb6f33b670c5469919214a32645cd9eda206
Closes-Bug: #1791178
Related-Bug: #1791989
Currently, the neutron-openvswitch-agent does not start on Windows
due to Linux specific imports. This patch addresses this issue.
Also, we're wrapping the object returned by subprocess.Popen using
tpool.Proxy in order to prevent IO operations on the stream
handles from blocking other threads. Currently, the ovs db monitor
blocks the whole process.
Closes-Bug: #1775382
Co-Authored-By: Lucian Petrut <lpetrut@cloudbasesolutions.com>
Change-Id: I8bbc9d1f8332e5644a6071f599a7c6a66bef7928
It was recently decided to uncap eventlet:
http://lists.openstack.org/pipermail/openstack-dev/2018-April/129096.html
So eventlet is now capped at 0.20 not by global requirements,
it is capped in upper-constraints, because currently not every
openstack project is able to work with a newer eventlet version,
mostly because of the caps in projects requirements.txt.
According to global-requirements, last allowed version of
eventlet is 0.22.1:
https://git.openstack.org/cgit/openstack/requirements/tree/global-requirements.txt
In an effort to support both eventlet<0.22 and eventlet>=0.22,
change the code to try and determine the correct number of
arguments to use in the call to initialize the parent class.
Change-Id: Ibe3dc8af6cf9f8bb4f8eababb7f4276e4db3f1f9
Closes-bug: #1777640
Fixed all pep8 E265 errors and changed tox.ini to no longer
ignore them. Also removed an N536 comment missed from a
previous change.
Change-Id: Ie6db8406c3b884c95b2a54a7598ea83476b8dba1
From eventlet v0.22, HttpProtocol.__init__ signature was changed
to take 4 argument to 3 argument.
The changeset of eventlet, 7f53465578543156e7251e243c0636e087a8445f,
https://github.com/eventlet/eventlet/issues/188
changed it.
So try the new signature for HttpProtocol.__init__ first, and then
fallback to the old signature for compatibility.
Change-Id: I2e024f04ceab10afb20b5a402f8ba8dfd50e753d
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
A regular gate run shows this was logged ~2500 times.
It doesn't provide any useful information since the
command executed successfully and we can see the
issued command in the debug statement before it.
Partial-Bug: #1707307
Change-Id: I431d6a59ce36deb9a5fb9deef39655d28d71f24d
The module may be used in scope that is not using eventlet (f.e. from
inside neutron-keepalived-state-change), in which case a call to
greenthread.sleep from the main thread will result in AssertionError.
Instead of that, call time.sleep that will redirect to greenthread.sleep
in eventlet environment.
This reflects what we do in oslo.concurrency execute implementation.
Change-Id: Id73c0e5015feca2c559da4a68a70aeaaf5cec2a7
Closes-Bug: #1680183
If the rootwrap daemon fails to execute a command, it
generates a cryptic message:
Unserializable message: ('#ERROR', ValueError('I/O operation on closed file',))
We should at least log the command that we were trying
to run, which will help users figure out why it failed.
Change-Id: I2c94e5a226630432028351f8287868f4fe5d2fa1
Closes-bug: #1677742
Refactoring Neutron configuration options for agent common config to be
in neutron/conf/agent/common. This will allow centralization of all
configuration options and provide an easy way to import.
Partial-Bug: #1563069
Change-Id: Iebac0cdd3bcfd0135349128921b7ad7a1a939ab8
Needed-By: Ib676003bbe909b5a9013a3178b12dbe291d936af
utils.kill_process() parsed the error string after the kill command
which can lead to internationalization issues. We shouldn't relay upon
different translations so this follow-up patch removes this dependency
by checking if the process is still running after the kill when a
ProcessExecutionError exception occurs.
Before, this was achieved by comparing against "No such process" string
Change-Id: I22bd63992d1029f99fea401f07167383f8ff7dd0
Removing the deprecated method get_interface_mac and from
neutron/agent/linux/utils.py and the associated test in
neutron/tests/unit/agent/linux/test_utils.py. This is scheduled
for removal in Pike.
This was deprecated in I1695d7e46efe5245eb581bd40d5420250a3bad89.
Change-Id: I6b84563c2631a3e47826320f03fa1fdfe44cf2a9
We depend on eventlet 0.19.0 or newer at least, the workaround
is not needed anymore
This reverts commit 21d139d441.
Change-Id: Ib5a8ca113e5a25109b4829db4915e550db86f6e9
For Neutron's compute agent in a XenServer's compute node, the commands
actually need run in Dom0. Currently XenServer only supports rootwrap
for that purpose by invoking a script which invokes XenAPI to execute
commands in dom0. There are much performance overhead due to it requires
parsing on the script and the configuration file every time running
commands.
This change is to support daemon mode with which each agent service will
call XenAPI directly to execute commands in dom0. And it will keep the
single XenAPI session.
DocImpact: Need update the following configuration.
file: /etc/neutron/plugins/ml2/openvswitch_agent.ini
[agent]
root_helper_daemon = xenapi_root_helper
[xenapi]
connection_url = http://169.254.0.1
connection_username = root
connection_password = xenroot
Closes-Bug: #1585510
Change-Id: I684034359fe0571bc92dbcf342a9821553b1da35
This patch will kill processes that are listening on any port/UNIX
socket within the namespace to be cleaned up. To kill them it will
issue a SIGTERM to them (or to their parents if they were forked) and,
if they don't die after a few seconds, a SIGKILL to them and all their
children.
This is intended for those cases when there's no specific cleanup and
serves as a fallback method.
Change-Id: I4195f633ef4a1788496d1293846f19eef89416aa
Partial-Bug: #1403455
wait_until_true is moved to neutron.common.utils
It was marked for removal in Ib8b0e51dbd9edaa58391774d428a737836dfdf77
Change-Id: I9efbbc237acbcebbb36ff239ec234b25abacccae