Commit Graph

38 Commits

Author SHA1 Message Date
Zuul 031aad583d Merge "Change exception messages to error log messages for DNS integration." 2024-04-10 23:53:01 +00:00
Jayce Houtman 5fe5188ce5 Change exception messages to error log messages for DNS integration.
Change non-harmful stack trace errors for dns_exc.DNSDomainNotFound and
dns_exc.DuplicateRecordSet to error log messages. This prevents the logs
from filling with stack traces where error messages would have been
sufficient enough.

Closes-Bug: #2042925
Change-Id: Icf1fff28bb560c506392f16c579de6d92cd56c23
2024-04-10 17:03:29 +02:00
Takashi Kajinami 47d140d4d0 Replace network type names by constants
Each network type name is defined as a constant in neutron-lib. This
replaces the remaining string by the common constants.

This change ignores tests code because updating all test code brings
little gain while it touches huge number of lines.

Change-Id: I26ee715209d7d3f12c39c9e05d4fb9953b9b9537
2023-11-28 16:06:13 +09:00
Nurmatov Mamatisa 129b823a8b use payloads for PORT AFTER_UPDATE events
This patch switches over to callback payloads for PORT
AFTER_UPDATE events.

Change-Id: I5c00eae155afa6c0fc8e3956bc39edbeca3ea1e7
2021-07-07 21:01:24 +00:00
Zuul e431c09438 Merge "Allow to parse keywords in dns labels" 2021-06-22 13:31:32 +00:00
Nurmatov Mamatisa c9fce3a8b6 use payloads for PORT AFTER_CREATE events
This patch switches the code over to the payload style of callbacks [1]
for PORT AFTER_CREATE events. In addition it adds a branch/shim to the
dhcp_rpc_agent_api to support both payload and kwarg style callbacks.

NeutronLibImpact

[1]
https://docs.openstack.org/neutron-lib/latest/contributor/callbacks.html

Change-Id: I25d43d4f8f2390b07e0d11c631f894d88669bbe0
2021-06-03 18:43:30 +00:00
Gregoire Mahe 7727fc07e6 Allow to parse keywords in dns labels
Co-Authored-By: Slawek Kaplonski <skaplons@redhat.com>

Related-Bug: #1843218
Change-Id: Ie8b6eb88e046c172d99212f966bdee327f42ed37
2021-03-10 17:03:12 +01:00
hamalq ea13f2e83f Sync the dns-assignment with the actual designate dns-domain
When a port is created the dns-assignment (dns-domain part)
was always taken form Neutron config dns_domain which is not
always true, since it could be Neutron network dns_domain or
the dns_domain sent when creating the port

Change-Id: I7f4366ff5a26f73013433bfbfb299fd06294f359
Closes-Bug:1873091
2020-06-04 20:45:55 +00:00
Jens Harbott 57bc6d167b Allow to select subnets to publish DNS records
As described in [0] a new attribute ``dns_publish_fixed_ip`` is added
to subnets, allowing to specify directly whether DNS records should be
published for this subnet. This overrides the previous behaviour that
makes this decision based on various properties of the network that
the subnet is contained in, see [1].

[0] https://launchpad.net/bugs/1784879
[1] https://docs.openstack.org/neutron/latest/admin/config-dns-int-ext-serv.html

Change-Id: I14605ead2694d9e9422b3d7b519aed2e3c340e2a
Partial-Bug: 1784879
2019-12-14 13:36:09 +00:00
Brian Haley b79842f289 Start enforcing E125 flake8 directive
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
2019-07-19 23:39:41 -04:00
Brian Haley eaf990b2bc Fix pep8 E128 warnings in non-test code
Reduces E128 warnings by ~260 to just ~900,
no way we're getting rid of all of them at once (or ever).
Files under neutron/tests still have a ton of E128 warnings.

Change-Id: I9137150ccf129bf443e33428267cd4bc9c323b54
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
2019-03-12 21:22:33 +00:00
Boden R f0051e68f6 use api def ALIAS in _supported_extension_aliases
Today a number of classes define their _supported_extension_aliases
using static strings rather than API definition ALIASes. This patch
switches them to use the ALIAS where applicable.

Change-Id: Id3be9ff7d84811c05793811306a13262fd3c0787
2019-02-15 11:26:28 -07:00
Boden R 453f39f23d use payloads for PORT BEFORE_DELETE callbacks
This patch switches BEFORE_DELETE callback events for PORT resources
over to the payload style args use a DBEventPayload object.

NeutronLibImpact

Change-Id: I8d8ff8f9ed7e2a1a6a66e3c3e6fc8e38cd9e29ca
2019-01-30 11:30:40 -07:00
IWAMOTO Toshihiro 0f180d8e2e Adopt hacking 1.1.0
This incorporates flake8 2.6.x and pycodestyle will be used
instead of older pep8.  This ensures future python3 compatibility
and a bit better code styling.

Change-Id: Ia7c7c5a44727f615a151e1e68dd94c7ed42f974f
2018-07-05 11:31:40 +09:00
Brian Haley 7cfdf4aa81 Fix all pep8 E129 errors
Fixed all pep8 E129 errors and changed tox.ini to no longer
ignore them.

Change-Id: I0b06d99ce1d473b79a4cfdd173baa4f02e653847
2018-05-03 13:44:04 +09:00
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
2018-04-17 12:06:28 -06:00
Boden R a2c36d7e00 use ml2 driver api from neutron-lib
The ml2 plugin driver API was rehomed into neutron-lib with commit
Ifc829953ef4d5859c3475903965dc08aba42fd9c and the API was shimmed in
neutron with I86a10091b55d1123e8d16f16155e0312bb10e54c. This patch
consumes the ML2 driver api from neutron lib thereby removing the
driver_api module from neutron.

NeutronLibImpact

Change-Id: Ice49572e217eeaf820e48d40f2251d08766490b5
2017-11-10 08:41:28 -07:00
Boden R 72b6db9379 use dns api def from neutron-lib
neutron-lib contains the dns API definition and associated exceptions,
constants, etc. This patch moves all references over to use the API
def from neutron-lib.

NeutronLibImpact

Change-Id: If180cf92d8ae31a0857080239e8233095cd6c768
2017-10-20 16:38:33 -06:00
Jens Harbott 22d6a1540f Fix port deletion when dns_integration is enabled
The records found in ip_allocations contain objects of type IPAddress,
but the external dns service expects them as string, so we need to
insert a conversion.

Change-Id: I622993fc273121bfd051d2fd9c7811e2ae49a1d8
Closes-Bug: 1714641
2017-09-03 08:05:49 +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
Miguel Lavalle 4a77533259 Add port dns_domain processing logic
This patchset adds logic to the ML2 DNS integration extension to process
a new dns_domain attribute associated to ports.

This patchset belongs to a series that adds dns_domain attribute
functionality to ports.

DocImpact: Ports have a new dns_domain attribute, that takes precedence
           over networks dns_domain when published to an external DNS
           service.

APIImpact: Users can now specify a dns_domain attribute in port POST and
           PUT operations.

Change-Id: I02d8587d3a1f9f3f6b8cbc79dbe8df4b4b99a893
Partial-Bug: #1650678
2017-08-08 18:42:43 -05:00
Miguel Lavalle 727039bce8 Add port dns_domain to DB and object models
This patchset adds a new dns_domain attribute to the PortDNS DB model
and OVO object.

This patchset belongs to a series that adds dns_domain attribute
functionality to ports.

Change-Id: Ib1ea7d0faee4f0544141fdcbb75164aadcfc5056
Partial-Bug: #1650678
2017-07-13 17:00:04 -05:00
Miguel Lavalle 190b31e03a Add dns_domain attribute to ports in the API
This change adds a dns_domain attribute to ports in the API.

This patchset belongs to a series that adds dns_domain attribute
functionality to ports.

Change-Id: Ied1f2f0c1e96ae21c309b6e6fed9e3c602b0450b
Partial-Bug: #1650678
2017-07-13 16:51:54 -05:00
Victor Morales 6670954de3 Integration of IPAllocation
This patch integrates the Oslo-Versioned Object created for
IPAllocation model class.

Change-Id: Ibb731c4635d89c848081fac73f216d2ecf10b599
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
2017-06-21 17:33:41 +09:00
Boden R 0e2b667bf1 use neutron-lib callbacks
The callback modules have been available in neutron-lib since commit [1]
and are ready for consumption.

As the callback registry is implemented with a singleton manager
instance, sync complications can arise ensuring all consumers switch to
lib's implementation at the same time. Therefore this consumption has
been broken down:
1) Shim neutron's callbacks using lib's callback system and remove
existing neutron internals related to callbacks (devref, UTs, etc.).
2) Switch all neutron's callback imports over to neutron-lib's.
3) Have all sub-projects using callbacks move their imports over to use
neutron-lib's callbacks implementation.
4) Remove the callback shims in neutron-lib once sub-projects are moved
over to lib's callbacks.
5) Follow-on patches moving our existing uses of callbacks to the new
event payload model provided by neutron-lib.callback.events

This patch implements #2 from above, moving all neutron's callback
imports to use neutron-lib's callbacks.

There are also a few places in the UT code that still patch callbacks,
we can address those in step #4 which may need [2].

NeutronLibImpact

[1] fea8bb64ba7ff52632c2bd3e3298eaedf623ee4f
[2] I9966c90e3f90552b41ed84a68b19f3e540426432

Change-Id: I8dae56f0f5c009bdf3e8ebfa1b360756216ab886
2017-04-26 12:12:53 -06:00
Duan Jiong c5f5bd0c4f Fix some reST field lists in docstrings
Probably the most common format for documenting arguments is reST field
lists [1]. This change updates some docstrings to comply with the field
lists syntax.

[1] http://sphinx-doc.org/domains.html#info-field-lists

Change-Id: I8fb91bcb8ae4bfbfa68ddf7c38a4f1f5cf548b36
2017-03-23 08:50:01 +08:00
Ann Kamyshnikova 12b0e16692 Change passing session to context in segments db functions
We have a number of functions that expect to get session as one
of the arguments. Passing session is not correct and this prevents
using new enginefacade which expects context to be passed and
session will be injected in current context.

NeutronLibImpact

Partially-Implements blueprint: enginefacade-switch

Change-Id: Ie1c54138ceaf9ac6f0674ad2786d4aaea9c80f73
2016-12-23 16:47:41 +04:00
Armando Migliaccio 17563a802e Adopt neutron-lib plugin directory
Neutron Manager is loaded at the very startup of the neutron
server process and with it plugins are loaded and stored for
lookup purposes as their references are widely used across the
entire neutron codebase.

Rather than holding these references directly in NeutronManager
this patch refactors the code so that these references are held
by a plugin directory.

This allows subprojects and other parts of the Neutron codebase
to use the directory in lieu of the manager. The result is a
leaner, cleaner, and more decoupled code.

Usage pattern [1,2] can be translated to [3,4] respectively.

[1] manager.NeutronManager.get_service_plugins()[FOO]
[2] manager.NeutronManager.get_plugin()
[3] directory.get_plugin(FOO)
[4] directory.get_plugin()

The more entangled part is in the neutron unit tests, where the
use of the manager can be simplified as mocking is typically
replaced by a call to the directory add_plugin() method. This is
safe as each test case gets its own copy of the plugin directory.
That said, unit tests that look more like API tests and that rely on
the entire plugin machinery, need some tweaking to avoid stumbling
into plugin loading failures.

Due to the massive use of the manager, deprecation warnings are
considered impractical as they cause logs to bloat out of proportion.

Follow-up patches that show how to adopt the directory in neutron
subprojects are tagged with topic:plugin-directory.

NeutronLibImpact

Partially-implements: blueprint neutron-lib

Change-Id: I7331e914234c5f0b7abe836604fdd7e4067551cf
2016-11-23 04:45:33 -07:00
Manjeet Singh Bhatia 837abf5d4d Add OVO for dns Objects
This patch will introduce ovo for NetworkDNSDomain and
FloatingIPDNS. It also integrates the ovo use for PortDNS
NetworkDNSDomain, FloatingIPDNS

Co-Authored-By: Brandon Logan <brandon.logan@rackspace.com>

Change-Id: I90ace59735c8cb9fa8a02b0e7636a58f0912efa7
Partially-Implements: blueprint adopt-oslo-versioned-objects-for-db
2016-10-27 17:39:45 +00:00
Manjeet Singh Bhatia ead39faa37 Relocate DNS db models
This patch relocate db models for dns.

Partial-Bug: #1597913

Change-Id: I6d1b43d8c5c8d6f8b80730a16eedac5e59cbed44
2016-10-07 21:35:35 +00:00
Graham Hayes 625fdb423e Avoid KeyError when accessing "dns_name" as it may not exist
Neutron LBaaS does not pass a full copy of the request_data
into this function, and causes the port create to fail
with a KeyError

Change-Id: Ib81cbbaf24a4ffaa983e1b05146aea0dc74e29bb
Fixes-Bug: #1605336
2016-08-18 15:43:53 +01:00
Bin Yu 64f5fc8259 Refactor DNS integration out of DB core plugin
This patch set aims to move all the code related to DNS integration
from the DB core plugin to the DNS ML2 extension module.

By doing this, this patchset removes the dns related code in
db_base_plugin_v2 and the dns exteions module talks with core plugin
only through the method extension_manager and apply_dict_extend_functions

By properly implementing the generation of the dns_assignment attribute
for ports in the DNS ML2 extension module, this patchset also fixes
https://bugs.launchpad.net/neutron/+bug/1579977

Change-Id: I63afb1a1bfeeb14eefb54681dc64959144deeb25
Closes-Bug: #1579601
Closes-Bug: #1579977
2016-07-26 07:33:50 +00:00
Takashi NATSUME 5cef3f726e Add a hacking rule for string interpolation at logging
String interpolation should be delayed to be handled
by the logging code, rather than being done
at the point of the logging call.
So add a hacking rule for it.

See the oslo i18n guideline.

* http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: I91e8d59d508c594256d5f74514e62f8f928d1df5
Closes-Bug: #1596829
2016-07-11 22:54:56 +00:00
Hong Hui Xiao 66c357400b Deprecate the functions map after segment moving out of ml2
This is a clean up for patch [1], the functions map should be removed
to make code easy to read. Start a deprecation cycle for these functions
in case external projects will use them.

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

Change-Id: I77c83bd7ee0c8ef92d8aaaa8e968479b848532fe
Partially-Implements: blueprint routed-networks
2016-06-08 02:55:59 +00:00
Henry Gessau 78fff41ee3 Use converters and validators from neutron-lib
Related-Blueprint: neutron-lib

Change-Id: I6b9079e9e703c6fd75adbed3846e7257685433e8
2016-04-24 19:13:10 -04:00
James Anziano 69ef84e21f Updates external DNS service if IP address changes
Previously the external DNS service was only notified when dns_name
was updated in a port, but it should also be alerted when the IP
address changes. This patch propogates the changes invoked in a port
update to the external DNS service when either the dns_name or the IP
address of a port changes.

Change-Id: I319f7a3265caaee5edaab19695a99d84e8e9a8ab
Closes-Bug: 1554207
2016-03-09 17:48:43 +00:00
James Anziano 4f04102e57 Ensures DNS_DRIVER is loaded before it is checked
Previously it was possible for DNS_DRIVER to be checked here before anything
had attempted to load it, causing the check to erroneuously fail. This patch
makes sure that the check will not fail simply because nothing had loaded it
prior by attempting to load it immediately before the check.

Change-Id: I34537beaf675db2634493dfef27b69051a8d0781
Closes-Bug: 1554151
2016-03-08 15:38:58 +00:00
Miguel Lavalle 93ac8b3a33 External DNS driver reference implementation
An interface with an external DNS service is defined for Neutron. A reference
implementation is also included, based on Designate. The interface and the
driver will enable users to publish in the external DNS service the dns_name
and dns_domain attributes associated with floating ips, ports and networks. As
a consequence, the floating ips and networks api is extended to manage dns_name
and dns_domain attributes. The dns_name attribute was added to ports in a
preceding commit

DocImpact: Introduce config option external_dns_driver to specify a driver
for external dns integration. For more info, see
doc/source/devref/external_dns_integration.rst

APIImpact
Implements: blueprint external-dns-resolution

Change-Id: Ic298ad2558410ab9a614f22e1757d1fc8b22c482
2016-01-21 21:55:08 +00:00