Commit Graph

56 Commits

Author SHA1 Message Date
Brian Haley 01af4b2cda Remove the neutron-debug tool
With removal of the neutron client shell code this tool is
no longer usable. It had been marked for deprecation since
the Newton (9.0) cycle and unmaintained.

This code is also breaking the neutron gate pep8 job.

Change-Id: I3c0c93de0b860d9287019b7834cb8337d9668cc0
2023-05-12 12:42:31 -04:00
Brian Haley 86badcfe2d Fix some pylint indentation warnings
Running with a stricter .pylintrc generates a lot of
C0330 warnings (hanging/continued indentation). Fix
some remaining ones in miscellaneous directories.

Also cleanup any remaining code that I missed in this
series, or has changed since I started.

Trivialfix

Change-Id: I17b4779020a7bfb369c3e721ab6638cd4a6ab50c
2022-12-12 11:48:25 -05:00
Rajesh Tailor 18b1b61401 Fix typos in log/error messages
This change fixes some of the typos in LOG and ERROR
messages, comments and variable names.

Change-Id: I26ebf751b7d187399e8b3d8089e09b9d51ba3625
2022-06-01 21:17:29 +05:30
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>
2022-04-13 05:49:15 +00:00
Rodolfo Alonso Hernandez 7928b0d755 Remove rootwrap execution (2)
Replace rootwrap execution with privsep context execution.
This series of patches will progressively replace any
rootwrap call.

Change-Id: Id3db4fbba44dd5644563481b6767ad0acbdcfb3e
Story: #2007686
Task: #41558
2021-02-06 16:23:03 +00:00
Darragh O'Reilly 27c8391458 Fix neutron debug probe to use integration_bridge
The debug probe stopped working after
https://review.opendev.org/#/c/698783/

Change-Id: I70deb83a1b52d2a34c92f32fb163c931aa0ff76a
2020-03-31 11:17:47 +00:00
Rodolfo Alonso Hernandez 4b3baeb15a Do not inherit from built-in "dict"
This is not recommended because some type methods are implemented not
in Python but in C [1][2] and should not be overridden. Subclassing
the built-in types directly, will yield non-obvious errors that are
hard to debug, and identify at first glance [3].

[1] http://www.kr41.net/2016/03-23-dont_inherit_python_builtin_dict_type.html
[2] https://treyhunner.com/2019/04/why-you-shouldnt-inherit-from-list-and-dict-in-python/
[3] https://medium.com/bynder-tech/using-collections-in-python-36129737b5a1

Closes-Bug: #1849980

Change-Id: I08c712ff1b093370cda2ce66b93e2a0709094fe1
2019-11-29 18:12:07 +00:00
Sławek Kapłoński b09b44608b Remove deprecated 'external_network_bridge' option
This option is deprecated and marked to be deleted in Ocata. So
as we are now in Stein development cycle I think that it's good time
to remove it.

Change-Id: I07474713206c218710544ad98c08caaa37dbf53a
2019-03-09 22:07:38 +00:00
Brian Haley c3b83a9ca6 Fix all pep8 E265 errors
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
2018-04-30 16:35:52 -04:00
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
sindhu devale 51ca683797 Refactoring agent linux&ovsdb config
Refactoring neutron agent linux and ovsdb config opts
to be in neutron/conf/agent so that all the config options
reside in a centralized location. This simplifies the
process of looking up the config opts and provides an easy
way to import.

NeutronLibImpact

Change-Id: Ib1e0e63dec2985c417412d1ecc68e2a74ef87182
Partial-Bug: #1563069
2017-08-25 10:41:39 -04: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
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
2017-03-31 09:16:22 -06:00
John Perkins 7f23ccce23 Agent common config
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
2017-03-15 09:52:18 -06:00
Edan David 151d94521f Replace device owners hard coded strings to neutron_lib constants
Change-Id: I821f0def82164ab1303188d3f1bdfd85473470cd
2016-07-12 04:11:35 -04:00
Armando Migliaccio 1f4c82ce9e Deprecate neutron-debug
We will not follow the typical deprecation cycle and thus we will
not remove this in the release after the deprecation is advertised.

Nonetheless we want to signal the need for a more comprehensive set
of tools and APIs that will eventually make people want to move away
from the limitations of neutron-debug.

Closes-bug: #1583700

Change-Id: Ibe471f186b9b5c9c15c5857a35cbaca6b8d284d6
2016-05-19 20:25:46 +00:00
Henry Gessau 4148a347b3 Use constants from neutron-lib
With this we enable the deprecation warnings by default.

Related-Blueprint: neutron-lib

Change-Id: I5b9e53751dd164010e5bbeb15f534ac0fe2a5105
2016-04-23 21:23:56 -04:00
LiuNanke 83ef6b5677 Using LOG.warning replace LOG.warn
Python 3 deprecated the logger.warn method, see:
https://docs.python.org/3/library/logging.html#logging.warning
so we prefer to use warning to avoid DeprecationWarning.

Closes-Bugs: #1529913

Change-Id: Icc01ce5fbd10880440cf75a2e0833394783464a0
Co-Authored-By: Gary Kotton <gkotton@vmware.com>
2016-03-10 11:02:45 -08:00
Akihiro Motoki c4aa41a25a Make neutron-debug command follow cliff command convention
In the guideline of cliff command, developers implementing
commands should override take_action() rather than run().
The similar effort is being done in neutronclient side and
this fix is required to complete the effort.

Logger definition in each command class is no longer needed.
This commit also drops them.

Closes-Bug: #1532258
Change-Id: I613b7e18b3c058568fc3669ad1524e60a93eb9f8
2016-01-09 03:38:19 +09:00
Gary Kotton 19de679e8a Use the constant HOST_ID instead of 'binding:host_id'
This patch makes use of the constant defined in the extension.
In addition to this having value of debing defined in one place it
also enables the caller to understand that the portbindings
extension is required.

Note: the constant is not used in the API tests. This has import
issues so it is not relevant.

TrivialFix

Change-Id: I7bfe2528dbbd8017ddbdcf949dbb6264ce1eb5d8
2015-12-20 14:00:29 +00:00
Akihiro Motoki 2d8632e412 Use _ from neutron._i18n
Partial-Bug: #1520094
Change-Id: I874a4aa1d71d1f7034a1ff0b7450b419ef5c6864
2015-12-06 19:39:04 +09: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
Martin Hickey 71190773e1 Automatically generate neutron core configuration files
This adds a new tox environment, genconfig, which generates sample
neutron core configuration file using oslo-config-generator.

Updates to some configuration option help messages to reflect useful
details that were missing in the code but were present in config files.

It also adds details to devref on how to update config files.

Partially-Implements: blueprint autogen-neutron-conf-file

DocImpact

Change-Id: I1c6dc4e7d479f1b7c755597caded24a0f018c712
Closes-bug: #1199963
Co-Authored-By: Louis Taylor <louis@kragniz.eu>
2015-11-27 15:22:59 +00: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
Ihar Hrachyshka fb2a5bd4cf Use DEVICE_OWNER_COMPUTE constant everywhere
Now that we have the constant defined, we should reuse it from other
code to avoid potential typos.

Change-Id: Iebb270be46b116df3441370dc1a6784571311aa9
2015-11-14 18:54:17 +01:00
Martin Hickey c4e0574da1 Update neutron-debug to use stevedore aliases
Updating neutron-debug as it is importing interface driver classes
directly and not using the load_driver_interface method.
Also adds unit tests for the neutron-debug tool.

Change-Id: Icf095b2182225e63e85d849d83c2cb36b8a39217
Closes-Bug: #1504536
2015-11-02 14:44:21 +00:00
Kevin Benton f7273b3052 Include external bridge deprecation warning in string
This is to ensure that the deprecation warning shows up
in the docs.[1]

1. https://review.openstack.org/#/c/232353/1/doc/common/tables/neutron-l3_agent.xml

Closes-Bug: #1494066
Change-Id: Id2ddec42df3ab376244bbf37b1cdd8b524382f7c
2015-10-14 00:26:05 -07:00
Kevin Benton 5aab6a5779 Deprecate external_network_bridge option in L3 agent
This option provides another way to attach to a specific bridge
that is not quite equivalent with how bridge_mappings work in the
L2 agent. This creates inconsistencies between how the L3 agent
behaves when configured with a bridge_mapping and provider properties
of the Neutron network vs. when it just ignores all L2 stuff and
plugs itself directly into the bridge.

See the bug report for more info.

Change-Id: I37de3cd6eaaf34856fa72753f471f4f0a9381836
Closes-Bug: #1491668
2015-09-01 20:41:54 -07: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 326e25f932 Remove remaining uses of passing root_helper
This should remove the last bits of passing root_helper around
for execute(). Some tests store and pass the root_helper argument
outside of this, and have been left alone.

Depends-On: I1e3b64e5a1d6cff2aebc638710487bbdbdba61d4
Depends-On: I5d51fa5edc7f427d84d7ae49d3a4c972dca8ac37
Depends-On: I21c6e7795c8b2e8f87bbd2b00a8eb7cb215ece74
Depends-On: I6566e17a1ce07a3bebf2a1a3653ad7e7f397f0b9
Change-Id: I38c901c65fb0c8598589ec56d5afd50d2f882f4f
Partially-Implements: blueprint rootwrap-daemon-mode
2015-02-20 03:24:38 +00:00
Ihar Hrachyshka 7a2a85623d oslo: migrate to namespace-less import paths
Oslo project decided to move away from using oslo.* namespace for all their
libraries [1], so we should migrate to new import path.

This patch applies new paths for:
- oslo.config
- oslo.db
- oslo.i18n
- oslo.messaging
- oslo.middleware
- oslo.rootwrap
- oslo.serialization
- oslo.utils

Added hacking check to enforce new import paths for all oslo libraries.

Updated setup.cfg entry points.

We'll cleanup old imports from oslo-incubator modules on demand or
if/when oslo officially deprecates old namespace in one of the next
cycles.

[1]: https://blueprints.launchpad.net/oslo-incubator/+spec/drop-namespace-packages

Depends-On: https://review.openstack.org/#/c/147248/
Depends-On: https://review.openstack.org/#/c/152292/
Depends-On: https://review.openstack.org/#/c/147240/

Closes-Bug: #1409733
Change-Id: If0dce29a0980206ace9866112be529436194d47e
2015-02-05 15:09:32 +01:00
Ihar Hrachyshka 548ab45a50 hacking: enable H238 (old style class declaration, use new style)
The rule was added in hacking 0.10 and is useful for migration to Python 3.

Change-Id: I8b45413cf34e5a9db8074f9029410e3b22a92640
2015-01-12 23:46:11 +01:00
Angus Lees 7a006a83e9 Use lazy logging interpolation
There are a small number of examples of "eager" interpolation in
neutron:
  logging.debug("foo %s" % arg)

These should be converted to perform the interpolation lazily within
the logging function, since if the severity is below the logging level
then the interpolation can be skipped entirely.

This change addresses all such current examples found in neutron core
via a pylint test.  Vendor plugins and services are fixed elsewhere.

Change-Id: I823d8453cd76e4985cabd31ca6b939f43a80b36c
Partial-Bug: #1404788
2014-12-22 17:12:54 +11: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
Ihar Hrachyshka dac6a0c79e Migrate to oslo.utils
The following modules are removed:
  - excutils,
  - importutils,
  - network_utils,
  - strutils,
  - timeutils.

Closes-Bug: #1385355
Change-Id: I1f34f17f5dbf37032584008f27e65d4dc4d475f4
2014-11-26 10:31:03 +01:00
Gary Kotton cbf2970a57 Update i18n translation for neutron.common/debug log msg's
Validate that hacking rules apply to directories:
    - neutron/common
    - neutron/hacking
    - neutron/debug
    - neutron/locale

Change-Id: I177f5fa5fb7cfdcf332949933aa4bd755a90bb94
Partial-bug: #1320867
2014-11-19 22:37:16 -08:00
Angus Lees ea27c8a162 Purge use of "PRED and A or B" poor-mans-ternary
Since python2.6, python has a proper ternary construct "A if PRED else
B".  The older idiom "PRED and A or B" has a hidden trap - when A is
itself false, the result is (unexpectedly) B.

This change removes all cases of the older construct found using a
trivial git grep " and .* or " - except one case in oslo common
code (fixed in oslo upstream).

Change-Id: I24461f4328e188c8983ad574495e11e033ec5ba4
2014-11-08 00:17:12 +11:00
Weidong Shao 9334d1c98c Empty files should not contain copyright or license
Per instruction from
http://docs.openstack.org/developer/hacking/#openstack-licensing

Enable hacking check H104 in this CL.

Change-Id: I435b9d91877499ebe1e33435f06794164a0ecc34
Partial-Bug: #1262424
2014-10-20 00:50:32 +00:00
Jenkins 0e8d82a89f Merge "Clarify message when no probes are cleared" 2014-09-13 15:29:24 +00:00
Jenkins 291e0859ad Merge "Neutron should not use the neutronclient utils module for import_class" 2014-09-10 07:22:11 +00:00
Aaron Rosen dbc9c0c799 Neutron should not use the neutronclient utils module for import_class
Fixes code to use openstack.common.importutils instead.

Change-Id: Ia449f8b1d7d03f37483cfdc595ad77e71ea6598c
Closes-bug: 1366917
2014-09-08 11:03:40 -07:00
Angus Lees 5defcd0aa6 Remove unused arg to config.setup_logging()
The cfg.CFG argument is ignored and misleading.  This change removes it
and updates all callers.

Closes-Bug: #1355565
Change-Id: I2fcece85d1abe848e5c01125cfb62c02f2dcbc86
2014-09-05 12:05:17 +10:00
Jacek Swiderski 02cfe35694 Clarify message when no probes are cleared
Log number of probes which were deleted by
using neutron-debug probe-clear
Closes-Bug: #1333103

Change-Id: I5b53f0c4651c6df491d414d7d65f98c4a84a5987
2014-09-01 18:21:30 +02:00
liu-sheng b30c47233d Remove the useless vim modelines
Change-Id: I41286e0b8f74c90b7078c3d3fb041b6586d95ab0
Closes-Bug: #1229324
2014-06-21 15:07:31 +08:00
Jakub Libosvar ea1aa77945 Fix H302 violations
H302 violation is reported by flake8 when importing separated objects from
modules instead of importing the whole module.
e.g.   from package.module import function
       function()
is changed to
       from package import module
       module.function()

Change-Id: Ifbf31b52316d3cade40743752a49ce700f384a21
Closes-Bug: #1291032
2014-05-04 12:40:08 +02:00
Jenkins 4f22fb2725 Merge "Remove last parts of Quantum compatibility shim" 2014-04-03 01:04:53 +00:00
Matthew Treinish 0755e7b379 Enable hacking H301 check
This commit enables the H301 hacking rule by removing all the
multiple imports in a single line from neutron.

Partial-Bug: #1291032

Change-Id: I7ba7f82fb36a433d73190eb3d568b6961ccb57c6
2014-04-01 13:10:14 -04:00
Dan Wendlandt c736569c73 Remove last parts of Quantum compatibility shim
Goodbye Quantum!

Change-Id: Idbd0384a892beaff3a937444f04cfc433cb805eb
Closes-Bug:1299046
2014-03-31 23:31:23 -07:00
Isaku Yamahata 9af846caf7 options: consolidate options definitions
Some config options(interface_driver, use_namespaces) are defined
multiple times in ad-hoc way.  It causes DuplicateOptError exception
when using those module at the same time.  Right now the exception is
avoided in ad-hoc way by each executable.  Those duplicated
definitions should be consolidated and treated in uniformed way.

This is the blocker for blueprint: l3-agent-consolidation

neutron.services.loadbalancer.drivers.haproxy.agent periodic_interval
conflicts with neutron.service one. Since there is no way to fix it
without changing existing behavior/default value, it is untouched for now.

Closes-bug: #1279769
Change-Id: Ifed79b7ee0033644854499416f8a2b22a20416fe
2014-02-24 13:25:11 +09:00
Jenkins 06a2684629 Merge "Update RPC code from oslo" 2014-01-16 16:25:15 +00:00