Commit Graph

33 Commits (master)

Author SHA1 Message Date
Jakub Libosvar 4d3a274765 Don't register config options on imports
Importing some modules lead to registering config options that may
collide with config options from a project that calls the import. This
patch wraps the side effect that registers config options into a
function that needs to be called in case the caller wants to register
the options.

This solution is also not perfect as it guards the common options to be
registered only once even if the function is called multiple times. This
is to solve problems in unittests, ideally we should always call the
function just once even in our testing suites.

Resolves-Bug: #1968606
Change-Id: Ic1532eb8de887ff1b1085206df11f53e22f7f524
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
1 year ago
Rodolfo Alonso Hernandez 0fe6c0b8ca Use the "connectivity" property of "MechanismDriver"
The base class "MechanismDriver" now has a property called
"connectivity". This patch overrides the default value in the
in-tree drivers.

The method "_check_drivers_connectivity" now uses this property
that is available in all drivers.

Depends-On: https://review.opendev.org/c/openstack/neutron-lib/+/826501

Closes-Bug: #1959125
bp boot-vm-with-unaddressed-port
Related-Bug: #1821058

Change-Id: I91734835b07d804365b46adfb26e984557107d80
1 year ago
Zuul cee4686710 Merge "Set process name for agents" 3 years ago
Bernard Cafarelli 5ce0595803
Set process name for agents
Now that we use setproctitle for neutron-server workers (and
neutron-keepalived-state-change), this has the side effect of changing
the process name for agents, impacting some monitoring systems. More
details in launchpad bug.

This patch fixes it by setting the name with setproctitle to:
agent name (original process name).

Also use the newly introduced name constants to replace existing
hardcoded uses.

Change-Id: I74c3a4d3e9f833752571a75f196560cd45529385
Closes-Bug: #1881297
3 years ago
Minmin Ren 4c04e60d45 Config privsep in the macvtap agent
The commands executed under a privsep context,
privsep should be initialized first.

Change-Id: I82d67847c71d276184026e5af5787235228035c0
3 years ago
Rodolfo Alonso Hernandez a70f07deb1 Add "connectivity" parameter in vif_details
Added "connectivity" parameter to mech driver vif_details. The default
value is "legacy". The in-tree drivers (Linux Bridge, Open vSwitch, SR-IOV
and MacVTap) have "l2" connectivity.

Change-Id: I45480986fc89e0b2f475ee0ceb13d8742fb8c530
Related-Bug: #1821058
4 years ago
ZhongShengping 161e6b80f0 Replace git.openstack.org URLs with opendev.org URLs
Thorough replacement of git.openstack.org URLs with their opendev.org
counterparts.

Change-Id: Ifc446e00d7f69cb23411b3a50c8d880c719f1e73
4 years ago
Brian Haley a58a527494 Scan for MAC through all devices in macvtap agent
The first device the agent happens to pick could be something
without a MAC address like a 6in6 interface. This was causing
the agent to fail to start if it was unlucky enough to pick
that address.

This patch just adjusts the logic to keep iterating through
the list until we find a MAC.

Change-Id: Iba9c7c3cb200e74a78ea885e8d9323de64c2c663
Closes-Bug: #1801030
5 years ago
Boden R 410a83c89d use plugin common utils from neutron-lib
A bulk of the public APIs that are part of neutron.plugins.common.utils
were rehomed into neutron-lib with [1] and the remaining with [2].

This patch consumes [1] by:
- Removing the rehomed code from neutron.
- Removing the UTs that are no longer applicable.
- Leaving the functions in [2][3] in neutron.plugins.common.utils until
we release [2][3] and can consume it at which point we should be able to
remove the utils module.

NeutronLibImpact

[1] Iabb155b5d2d0ec6104ebee5dd42cf292bdf3ec61
[2] I2c0e4ef03425ba0bb2651ae3e68d6c8cde7b8f90
[3] I73f5e8ad7a1a83392094db846d18964d811b8bb2

Change-Id: I1d63cbea463e92e1d2e053f8e1a564ed52cb84f8
5 years ago
Sławek Kapłoński b6b23a8f77 Enable mutable config in Neutron
New releases of oslo.config support a 'mutable' parameter to Opts.
This is only respected when the new method mutate_config_files is
called instead of reload_config_files. Neutron delegates making this
call to oslo.service. This was provided in patchset
Icec3e664f3fe72614e373b2938e8dee53cf8bc5e

Further patches will be needed to make select config options be
marked as mutable. This change enables support for oslo provided
config options to be updated via SIGHUP such as log level.

Task: 6389
Story: 2001545

Change-Id: I9442965607f3248706464643c6d87a04edcae24e
5 years ago
Boden R ef93f7e7f0 use common agent topics from neutron-lib
The neutron.common.topics module was rehomed into neutron-lib with
commit Ie88b84949cbd55a4e7ad06341aab77b286cdc485
This patch consumes it by removing the rehomed module from neutron
and using the module from neutron-lib instead.

NeutronLibImpact

Change-Id: Ia4a4604c259ce862597de80c6deeb3d408bf0e95
5 years ago
Sławek Kapłoński cbee0f9f88 Use same instance of iptables_manager in L2 agent and extensions
This commit adds common_agent_extension class which is agent API
for L2 extension drivers used e.g. by Linuxbridge agent.
This is necessary to be able to use instance of iptables_manager
used in firewall driver also in L2 extension drivers (like qos).

This patch refactors little bit iptables_manager code to make possible
to initialize e.g. mangle or nat table on demand, even if iptables
is created as "state_less"

Change-Id: I3b66e49b7f176124e8aea3eb96d0d465f1ab1ea0
Closes-Bug: #1736674
5 years ago
Boden R 95f1e03446 use plugin constants from neutron-lib
neutron-lib contains a number of the plugin related constants from
neutron.plugins.common.constants. This patch consumes those constants
from neutron-lib and removes them from neutron. In addition the notion
of the dummy plugin service type is moved strictly into the test
package of neutron since it's not a real service plugin.

NeutronLibImpact

Change-Id: I767c626f3fe6159ab3abd6a7ae3cb9893b79bf66
6 years ago
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
6 years ago
Boden R fde6710515 use MechanismDriver from neutron-lib + shim
The ml2 MechanismDriver is now in neutron-lib along with its associated
constants. This patch switches over to the lib versions of those, but
leaves a shim of the MechanismDriver that just ref's the driver from
lib. This shim allows our broad consumer base of the driver to switch
over at their leisure.

NeutronLibImpact

Change-Id: I99e3de6d933a1bb341394f85415fb07306a82a01
6 years ago
Boden R 7bd521e7ce use neutron_lib's portbindings api-def
Neutron-lib 1.1.0 is now out and contains the portbindings
API definition (as per commit [1]). This patch moves neutron
references over to the neutron-lib version.

NeutronLibImpact
- Consumers using the public constants within neutron's
portbindings API extension must now use the values
from neutron-lib.

[1] 87e42f993c07ae320159d5123662ee9f3bd4d903

Change-Id: I669af9b4c712877772d91a03857ab108714001d4
6 years ago
Kevin Benton 3dddfa56db Macvtap: Check for no original port in is_live_migration
Change 6865f4d9f2 mistakenly
assumed that None would not be present for the 'original'
property on a PortContext. However, this is the default value
for the original field in PortContext, which is what is used
in the construction as part of the _create_port_db process
in ML2.

This resulted in binding failures for the macvtap mech drivers
due to an attribute error in cases like brand new ports.

This patch simply checks for None before trying to determine
if it's a live migration (which it isn't in the case of port creation).

Part of the issue is likely that the FakePortContext in the unit tests
was defaulting to an empty dict which is the not the same behavior as
the real PortContext.

Change-Id: I6659235a70aa4528fd21911c04e651194591e449
Closes-Bug: #1658802
6 years ago
Jenkins f8e942c5bd Merge "Terminate macvtap agent when physical_interface_mapping config not present" 6 years ago
Andreas Scheuring 557e0c0a4c Terminate macvtap agent when physical_interface_mapping config not present
Starting the macvtap agent without specifying at least one
physical_interface_mappings does not make sense. As it only
supports layer2 networks (flat, vlan) an interface mapping is
mandatory. An existing agent deployment without an interface
mapping can not serve any networks to instances!

This patch terminates the agent when no mapping is
provided. As without this mapping the agent cannot serve any networks
for instances, this patch can't really break existing deployments.

UpgradeImpact Agent terminates when no physical_interface_mapping
configuration is provided.

Change-Id: I647cf4da55fda54e32b7047b84e0d7f671629fa7
Closes-Bug: #1587444
6 years ago
Anindita Das 5e1c3c705e Refactoring config options for plugin macvtap opts
Refactoring neutron ml2 plugin macvtap driver config opts to be in
neutron/conf/plugins/ml2/drivers/macvtap so that all the
configuration options for macvtap drivers reside in a centralized
location. This simplifies the process of looking up the macvtap driver
config opts and provides an easy way to import.

Change-Id: I1768eefb9eadcea19bcb675cbd96a6cb728b4123
Partial-Bug: #1563069
7 years ago
Dariusz Smigiel 9733825896 Cleanup of SecurityGroup classes
Commit Ifb70a118cef48c3c4cd313e22e907aa47bc51ad0 intended to remove some
classes, but without DeprecationWarnings. To prevent from possible
problems, if it would be now removed, added Warnings and included info,
about future removal.

Change-Id: Iacb93abc363bf638efc3acb5b29c02a7508bc43a
Related-Bug: #1444112
7 years ago
Jenkins 09f326a6dd Merge "neutron-lib: start using neutron-lib helpers" 7 years ago
Gary Kotton 396abb8ccb neutron-lib: start using neutron-lib helpers
The following helpers are used:
	parse_mappings
	compare_elements
	safe_sort_key

Change-Id: I5947b473330fd29f8d4c1a08f03d007a52c8dfd9
7 years ago
Brian Haley 0963aec572 Refactor code to deprecate get_interface_mac
The ip_lib code is able to get the MAC address of a device
already using the IpLinkCommand class, let's remove
get_interface_mac() since it's not necessary.

Changed all callers to use the new get_device_mac() code
and tagged get_interface_mac() for deprecation since it
could be in use by other callers outside the neutron tree.

Closes-Bug: #1630439

Change-Id: I1695d7e46efe5245eb581bd40d5420250a3bad89
7 years ago
Andreas Scheuring 6865f4d9f2 macvtap: Mech driver detects invalid migration
As of today, Macvtap agent allows invalid live migrations
from a host with interface mapping 'physnet1:eth1' to a host
with mapping 'physnet1:eth2'. Migration places the macvtap on
the target on 'eth2' instead of 'eth1'. This fix detects
such a migration in the mech driver and lets the portbinding fail.

Nova will put the instance in error state. The instance might
still be able to access the wrong network it migrated to, as
today there is no communication to the agent after a failed binding
after a migration. But at least the user is now aware that
something went wrong.

Change-Id: I92cd6411fe88483b921c92f219afa8e846cc0137
Depends-On: Ib1cc44bf9d01baf4d1f1d26c2a368a5ca7c6ab68
Partial-Bug: #1550400
7 years ago
Andreas Scheuring 96d1d914ca Macvtap: Allow noop alias as FW driver
The macvtap agent only works with the NoopFWDriver. If another
driver is configured it terminates. Today only the explicit
configuration "neutron.agent.firewall.NoopFirewallDriver" is
accepted. This patch enables the macvtap agent to also accept
the alias "noop"

Change-Id: I0d6f0b780a3881419243f12487e8b3d10e709f6c
Closes-Bug: #1587498
7 years ago
Henry Gessau 4148a347b3 Use constants from neutron-lib
With this we enable the deprecation warnings by default.

Related-Blueprint: neutron-lib

Change-Id: I5b9e53751dd164010e5bbeb15f534ac0fe2a5105
7 years ago
Akihiro Motoki 44be13a2a6 Hacking rule to check i18n usage
* Detect neutron.i18n import (neutron._i18n is recommended)
* Check builtins _ usage
* 'builtins = _' in tox.ini is no longer required.
* Introduce hacking rule doctest framework.
  Newly added check_builtins_gettext() hacking check takes
  token as argument. It is not a good idea to pass a tokenized
  line manually. Instead it is reasonable to use docstring based
  tests used in hacking repo.

Change-Id: Ib7464658fc4c8a6f1b03af6ab46f0bd3ee0bfb18
7 years ago
Kevin Benton 7afbd3a6b8 Check tap bridge timestamps to detect local changes
During a quick instance rebuild on Nova, it may remove a tap
interface and then plug it in within the agent polling window.
In this scenario the agent will not realize a device has changed
and will therefore not ask the server for info an subsequently
update its status. This will prevent the notification from being
sent back to Nova that the vif plugging has finished so the
VM will never resume state.

This adds a new timestamp collection method to the common agent
manager interface for devices that is used by the common agent
loop to determine if a device has locally changed.

The linux bridge implementation of it checks the timestamps on the
tap interface's 'bridge' directory, which will change whenever
the tap is added to bridge.

Closes-Bug: #1531862
Change-Id: If172470e907848556b6a8aff13520f94245919bb
7 years ago
Jenkins e3691a0269 Merge "macvtap: Macvtap L2 Agent" 7 years ago
Andreas Scheuring 2e7eb09271 macvtap: Macvtap L2 Agent
This agent is required by the macvtap ml2 driver to support
macvtap attachments for libvirt qemu/kvm instances. It introduces
a new configuration option MACVTAP.physical_interface_mappings.

The review is submitted in three parts:
 - Part 1
    Common functions that are used by the ml2 driver and the agent
 - Part 2
     The Mechanism Driver to support port binding for macvtap attachments
 - Part 3 (this part)
    The Macvtap L2 Agent.

DocImpact
New ML2 mech driver + l2 agent
New config option "macvtap.physical_interface_mappings"

Change-Id: I219d80b4c704ac2f41edd3501f4b2198925778d6
Closes-Bug: #1480979
7 years ago
Andreas Scheuring eb9bda12d2 macvtap: ML2 mech driver for macvtap network attachments
This driver uses the vif_type 'macvtap'. It enriches the vif_details
with the corresponding attributes required by nova [1] to support
macvtap attachments for libvirt qemu/kvm guests.

The review is submitted in three parts:
 - Part 1
    Common functions that are used by the ml2 driver and the agent
 - Part 2 (this part)
     The Mechanism Driver to support port binding for macvtap attachments
 - Part 3
    The Macvtap L2 Agent.

[1] https://review.openstack.org/#/c/182283

Change-Id: I206f58a21c36e55de957d8a23993aa9bc26d1595
Partial-Bug: #1480979
7 years ago
Andreas Scheuring bfcad8eec7 macvtap: Common functions and constants
Functions and constants that are shared between the macvtap ml2 driver
and the macvtap agent.

The review is submitted in three parts:
 - Part 1 (this part)
    Common functions that are used by the ml2 driver and the agent
 - Part 2
     The Mechanism Driver to support port binding for macvtap attachments
 - Part 3
    The Macvtap L2 Agent.

Partial-Bug: #1480979

Change-Id: I63a095e6f592b94372ff018f2e73373ad9414d99
7 years ago