Commit Graph

127 Commits

Author SHA1 Message Date
Erik Olof Gunnar Andersson 57f2e367bf Restructure testing
- Moved all functional tests to dedicated folder.
- Updated a few tests to use faster oslo tests.
- Renamed fixtures.py to base_fixtures.py.

Change-Id: Ie8c5591dd12a91350173bec2b418b6c9ddea79fe
2024-01-05 15:09:29 -08:00
Erik Olof Gunnar Andersson cc0431ba62 Standardize all configuration loading
There was a large config refactor many releases ago, but
we never standardized on the new pattern. This will also
help ensure that config is always loaded in the right order.

- Standardize how config is setup throughout designate.
- Removed unecessary import_opt.


Change-Id: I8913d2569f174208740a76c474c73316f6c1d89e
2023-11-03 11:19:11 +00:00
Erik Olof Gunnar Andersson 68fc28527a pyupgrade changes for Python3.8+
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1] and Octavia [2]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place designate

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986
[2]: https://review.opendev.org/c/openstack/octavia/+/899263

Change-Id: Idfa757d7ba238012db116fdb3e98cc7c5ff4b169
2023-11-03 11:19:07 +00:00
Erik Olof Gunnar Andersson ef4640347a Removed unused storage_driver config
Change-Id: Idecbaebe2a85d2c5f65e83b542b47e535067c47f
2023-10-29 08:05:14 -07:00
Erik Olof Gunnar Andersson 38c591eaa1 Fix TsigKeyring issues with dnspython 2.x
- Fixed issues in TsigKeyring.
- Fixed tsgi issues in mdns handler.
- Fixed invalid secret used in tests.
- Added additional test coverage.
- Re-enabled previously broken test.

Closes-Bug: #1982252
Change-Id: I04c104cfc9ee2f03d0c5adca3c80bbfff20afb70
2023-06-28 10:15:16 +02:00
Erik Olof Gunnar Andersson 0c30fc491b Restructured SQL code
We have a lot of abstraction that isn't really needed. This patch
removes some of that abstraction and reorganizes the code accordingly.

- Merged storage and sqlalchemy folders.
- Deprecated [central].storage_driver.
- Minor cleanup to SQL code.
- Cleaned up comments and unit tests.

Change-Id: I8f0508aedcc028b1a6e74c790c5d757a0d6c98d7
2023-05-11 21:28:36 -07:00
Erik Olof Gunnar Andersson 437d2d9639 Use monotonic time to protect from system time jumps
Change-Id: I44a51bef79109600a3f93844ac51a1f5738508b9
2023-05-07 18:47:39 -07:00
Igor Malinovskiy f39704dcd8 Implement sharing of zones
Author: Igor Malinovskiy <u.glide@gmail.com>
Co-Authored-By: Sergey Drozdov <sergey.drozdov.dev@gmail.com, sergey.drozdov93@thehutgroup.com>
Co-Authored-By: Michael Johnson <johnsomor@gmail.com>

Change-Id: Ibd780f3c695a95be00ff97d7736d5a0bebea79b9
Closes-Bug: #1714088
Depends-On: https://review.opendev.org/c/openstack/designate-tempest-plugin/+/872069
2023-02-14 01:54:15 +00:00
Erik Olof Gunnar Andersson 6fee42ecac Remove unicode
No longer necessary as we no longer support Python 2.7.

Change-Id: Icae82ed323d25d85a35e12b8b4c980f0f71d5d85
2022-10-11 16:14:50 +00:00
Michael Johnson 60c378763a Switch Designate to Alembic database migrations
Currently Designate is using sqlalchemy-migrate for database schema
migrations. sqlalchemy-migrate/migrate have been deprecated for some
time. This patch moves switches Designate to use Alembic for database
migrations.

Change-Id: I90ecb4d409b8b609b384997fa4cc9c65755409b3
2022-08-04 17:15:09 +00:00
Michael Johnson 38178c079a Improve quota API validations
This patch improves the quotas API validations and test coverage. Invalid quota settings will now be caught at the API/Central layer and not down in the storage layer(DB).

Depends-On: https://review.opendev.org/c/openstack/designate-tempest-plugin/+/842238
Closes-Bug: #1934596
Change-Id: I474bdd988a6cc3a9bcce1b65c2f49216dd85addf
2022-05-17 22:08:51 +00:00
Erik Olof Gunnar Andersson 7e543c2d22 Fixed incorrect message when zone import failed due to quota
Closes-Bug: #1960764
Change-Id: Ib91e49081855e5f4ec9f46a060d1587dcfeaac29
2022-02-18 07:33:48 +00:00
Erik Olof Gunnar Andersson c38810b15f Remove unused central code
The following unused rpc calls were removed.
- create_record
- update_record
- delete_record
- sync_record
- sync_zone
- sync_zones
- touch_zone

Change-Id: Iaccdb9b7d586ee04270dad656924a8867f8f7c2c
2022-02-14 20:35:31 +00:00
kpdev 9541a29761 Integrate OSprofiler and Designate
*) Add osprofiler wsgi middleware

This middleware is used for 2 things:
1) It checks that person who want to trace is trusted and knows
secret HMAC key.
2) It start tracing in case of proper trace headers and add
first wsgi trace point, with info about HTTP request
*) Add initialization of osprofiler at start of serivce.

You should use python-designateclient with this patch:

https://review.opendev.org/#/c/773575

Run any command with --os-profile SECRET_KEY

  $ openstack zone create --email <email_id> <zone_name> \
    --os-profile SECRET_KEY
  # it will print <Trace ID>

Get pretty HTML with traces:

  $ osprofiler trace show --html <Trace ID> --connection-string \
   <connection_string> --out <output.html>
  e.g. --connection-string can be redis://localhost:6379

Note that osprofiler should be run from admin user name & tenant.

Implements: blueprint designate-os-profiler
Change-Id: I2a3787b6428d679555a9add3a57ffe8c2112b6d3
2022-02-07 07:12:18 +00:00
Erik Olof Gunnar Andersson 0c7d218ba1 Fix duplicate zone when creating ptr records
This fixes a race-condition when creating multiple PTR records
under the same zone. There is a brief window when creating two
identical zones can cause an error. This adds a fallback that
should prevent the error.

I also added a threaded test that caught multiple additional
bugs in this code.
- Wrong find_recordset used caused the wrong exception to be thrown.
- The transaction workflow would break error handling.

Change-Id: Ia1194ab838c52d5d91cb1d26c4556c73b4f3a745
2022-01-26 05:58:39 +00:00
Michael Johnson 5f87d207b4 Fix support for scoped tokens and default roles
This patch is the base patch to enable support for Keystone
scoped tokens[1] and default roles[2] in the Designate API.

It also migrates to using project_id in the context objects instead of
the deprecated tenant_id.

[1] https://docs.openstack.org/keystone/latest/admin/tokens-overview.html#authorization-scopes
[2] https://docs.openstack.org/keystone/latest/admin/service-api-protection.html

Depends-On: https://review.opendev.org/c/openstack/designate-tempest-plugin/+/821632

Change-Id: I43bb76dc4dc1d167d86fd5ea139a50f95f3b0b4a
2021-12-14 01:02:50 +00:00
Michael Johnson 0e16095a80 Enable H306 check and fix import ordering
To better align with other OpenStack projects and to reduce the
ongoing problem with duplicate imports, this patch re-enables the
H306 check for proper module import order.

Change-Id: Iced92590829f6d9177d64ad4868aebe6eafd6a8a
2021-11-18 00:30:05 +00:00
michaeltchapman d46eb24980 Fix inspect module deprecation warning
DeprecationWarning: inspect.getargspec() is deprecated since
Python 3.0, use inspect.signature() or inspect.getfullargspec()

Change-Id: I3707546e77acb9dec56ec33cbabb3e6228525f9c
2020-07-10 03:50:10 +00:00
Erik Olof Gunnar Andersson 3fccc25bf6 Re-factored Heartbeat implementation
The use of this code path is very limited at the moment,
and this patch further simplifies the code to make it easier
to either deprecate or extend it in the future.

* Renamed service_status.py -> heartbeat_emitter.py.
* Merged HeartbeatEmitter and Heartbeat.

Change-Id: I68a4a49dd3e6bbc123c3ed5d3d3661aa08ad0bbb
2020-03-09 03:15:21 +00:00
Erik Olof Gunnar Andersson 52ad1c4c13 Removed deprecated pool-manager implementation
The pool-manager has been deprecated since Newton and
is now being removed with the Train release.

Change-Id: Ib258043d492bb25e1c061d765b40885317c73804
2019-09-24 11:10:54 +00:00
Zuul 5dc69b9cb7 Merge "Finalized centralization of configuration" 2019-06-23 20:14:33 +00:00
Erik Olof Gunnar Andersson a31982b53e Fixed oslo deprecated warning when running devstack
Moved notification driver and topics from DEFAULT to the
oslo_messaging_notifications group.

Change-Id: Iab163987fb8b27b21d4870eeb59f5d5f84229f91
2019-06-18 19:51:14 +00:00
Erik Olof Gunnar Andersson 097ffec548 Finalized centralization of configuration
This patch removes get_cfg_opts from the plugin class,
and moves all configuration directly into designate.conf.

There are no changes in the generated configuration due
to this patch.

Finally, this complets the blueprint to centralize all
configuration, and is a follow up to this patch
I3be68bf294157631a9bac128df0841220020de96

blueprint centralize-config-designate

Change-Id: I007fc004fc533950c5eda3974f41f05c6db5b43f
2019-06-18 18:41:10 +00:00
Erik Olof Gunnar Andersson 03b390dee5 Updated context to use project_id
Fixed a bunch of deprecated warnings from oslo.context.

* Use project_id instead of tenant.
* Use user_id, domain_id etc.

Change-Id: I6e8affbabeca4162f11fb4ba47ffa2e960103ccd
2019-06-13 20:28:12 +00:00
Erik Olof Gunnar Andersson a53c3daf16 Moved most configuration into designate.conf
Based upon the established conf paradigm used in Nova,
this patch moves most of the configuration to a
central location. Making config a lot easier to
manage, as well a lot easier to locate.

There is still some configuration listed in classes,
that I would like to eventually move to
designate.conf as well, but to lower complexity not
all config was moved.

General changes
* Centrelized most configuration under designate.conf.
* Cleaned up configuration.
* Simplified config generation.
* Renamed generated config to designate.conf.sample.

Previously broken
* xfr_timeout now in the appropriate section.
* memcached_servers now in the appropriate section.

Previously missing from sample config
* allowed_remote_exmods listed in sample config.
* backend:akamai section listed in sample config.
* backend:dynect section listed in sample config.
* backend:infoblox section listed in sample config.

blueprint centralize-config-designate

Change-Id: I3be68bf294157631a9bac128df0841220020de96
2019-05-28 23:54:00 +00:00
Zuul eac11a6a97 Merge "Switch to oslo_messaging.ConfFixture.transport_url" 2018-06-14 17:29:45 +00:00
Steve Kowalik 3d8002e2f5 Switch to oslo_messaging.ConfFixture.transport_url
oslo_messaging's rpc_backend setting, which is set by
ConfFixture.transport_driver has been deprecated since Newton. To allow
oslo_messaging to remove it, switch to setting transport_url instead.

Change-Id: I56ed0952f667dc51fb36aa1e85875e2d30097237
Partial-Bug: #1712399
2018-06-12 12:46:49 +10:00
Erik Olof Gunnar Andersson 1924abff40 Add unique constraint to service_statuses
In the current implementation, if for any reason a duplicate
service entry gets created, the call to update that service
will fail endlessly, and instead cause the service to create
new entries everytime update_service_status gets called. Causing
it to fill the database with duplicate entries.

This patch adds a unique constraint to the service_statuses
table based on the service_name and hostname, to ensure that
this cannot happen.

In addition we add a new test to the storage driver and further
expanded the central service test coverage.

Change-Id: I307a8f7dd8b8a83effa447a846db3288efa32dba
Closes-Bug: #1768824
2018-05-20 12:41:21 -07:00
Nguyen Van Trung 96a5691ca2 Fix issue with 'priority' value in pool_ns_record
- 'priority' must be equal or higher minimal value [1]

[1] https://github.com/openstack/designate/blob/master/designate/objects/pool_ns_record.py#L32

Change-Id: Ib20c62e49e15814ba904de05bc2709ee47190a12
2017-06-05 23:04:18 +07:00
Thomas Herve ad65e6a01e Fix test notification driver configuration
The tests try to configure oslo messaging notifications to use the
"test" driver, but it needs a list, not a single value. You can see the
warning in the logs:

WARNING [stevedore.named] Could not load s, e, t

This properly declare the driver as a single item list.

Change-Id: Ia0b57580c00fe0f7b9c0a19ac5190282972f624f
2017-05-23 12:04:25 +02:00
Hieu LE cbdec03b82 Refactor NSD4 UT for using upstream eventlet
This patch refactor NSD4 UT by mocking out instead of using eventlet
for fake NSD4 backend.

This patch also remove pinned eventlet version and use upper constraint
of eventlet for UT.

Closes-Bug: 1686601
Change-Id: Iabc7fe6a1f6932959f4531a333bcbd1ad6f06e4f
2017-04-27 17:11:16 +07:00
Graham Hayes b56a7b14f3 Bump hacking to new required version
Change-Id: Ice127b5e673cee3159b780e3da06cec496c845e3
2017-03-07 21:56:28 +00:00
Federico Ceratto 35bb49cb84 Return early from _find_recordsets_with_records
Prevent a warning message from SQLAlchemy when formatted_ids is empty
Minor unit test unicode cleanup

Change-Id: Ic4f872c314c472554129c0608090f0dd9f715ae1
2016-04-29 22:03:24 +01:00
Endre Karlson 7abae80c61 Add support for getting Service Status
Change-Id: Iaf10d8486ac8015ecf9f394dfbf074bfb863fb78
2016-04-12 16:32:17 +02:00
sonu.kumar bdeb08e39f Resolves metadata field output on rest call to zone import and export
Earlier on REST API call to zones/tasks/imports or zones/tasks/exports,
metadata field was displayed with no key/val pair.
This patch makes {'total_count : #val'} to be be produced as
output in metadata field on execution of those REST API call.

Closes-Bug: #1532925

Change-Id: I566e370edce5f29aafe793d5fdf7fe2fb7b3a856
2016-04-07 09:07:26 +00:00
Graham Hayes 8030341da5 Do not log pool-manager-caches SQL transactions
Change-Id: I14a376d8e8b65fe96ed55b768a0a115d02463ef0
2016-03-21 15:13:48 +00:00
Kiall Mac Innes e612a3974f Enable use of Pools YAML
This change adds the tooling to use the DB Tables created for pool
config data and the tooling to migrate the config info itself.

Change-Id: If99dbf527ef1ac0f05f15fe77f68f64e357fe0a5
2016-03-17 19:13:31 +00:00
Kiall Mac Innes 1375a45a71 Add New Pools DB Tables and Code
This change adds the new pools DB tables and access code,
but does not make use of or populate the new tables.

Change-Id: I71232bc0087b53b6678295d7900916ec51e0cb2b
2016-03-17 00:15:46 +00:00
Graham Hayes 33f0c1f15c Default to not logging all SQL Quries made during a test run
Our testrepository.subunit was over 50Mb on a recent change
If we need that output:

  export DESIGNATE_SQL_DEBUG=True
  tox

Change-Id: I56d5cb5390ca83311484d72ae5677d3fbf944edb
2016-03-17 00:15:46 +00:00
Graham Hayes 8fabf5f6f9 Add scheduler for pools
This adds a scheduler to central to decide what pool to place a newly
created zone in.

Change-Id: Ie4146212209fa4b22bc271e3f4ce76104090ac9b
2016-03-14 20:59:58 +00:00
Federico Ceratto 8afe975efc Move SOA refresh interval into unit tests
Add fixture to set random.seed temporarily

Change-Id: I0a59a8d0a470a7ab9ed70e5c6461b1bd65e7c2b7
Closes-Bug: #1548904
2016-02-23 20:07:21 +00:00
Federico Ceratto 7d28927488 Use unicode strings in description fields
Change-Id: I3c1fd87b57bb01e557ed2f52f89575c9be2e518d
2016-02-04 21:01:36 +00:00
Federico Ceratto 4cf00bfb7f Check TXT record length limit
Change-Id: Ie423cb7037625d0cfaf4084bf8660790c45cd7c6
Closes-Bug: #1474012
2015-12-01 13:25:58 +00:00
Graham Hayes c5949ccb28 Rename all references of Domain to Zone
This is a pretty invasive change :)

A non complete list of changes:

* Database Tables
* Database Columns
* Designate Objects and fields on Objects
* Designate Objects Adaptors stop doing some of the renames
* All RPCAPI versions are bumped - totally backward
  incompatable (function names have changed)

Change-Id: Ib99e918998a3909fa4aa92bf1ee0475f8a519196
2015-11-17 15:22:16 +00:00
Bertrand Lallau 63d1b2a590 Fix argument order in assertEqual to (expect, obs)
assertEqual expects that the arguments provided to it should be
(expected, observed). If a particular order is kept as a convention,
then it helps to provide a cleaner message to the developer if Unit Tests
fail. There are several Unit Test files where the arguments for assertEqual
have been swapped.

Change-Id: I6fdedcde67f76883257d35d1b812ab8a0e3e0733
Related-Bug: #1259292
2015-11-05 21:39:38 +01:00
TimSimmons 523395dec0 Refactor Zone Import Internals
In preparation for async zone exports, move imports to be their own objects,
away from zone tasks. This is essentially a giant renaming.

Change-Id: If6eefbf5553d0fc09e638e879b88c73c133c56fe
2015-08-28 10:27:34 -05:00
Federico Ceratto b57623499a Implement test timeout helper. Minor fixes
Change-Id: Ic10f76dd3a06260582e5f64f9324017ae9e13a51
2015-08-01 15:02:21 +01:00
Pradeep Kumar Singh 703a3f47ae Correct 'DESIGNATE_SQL_DEBUG' export behaviour
Currently when i export 'DESIGNATE_SQL_DEBUG' from terminal
to false like 'export DESIGNATE_SQL_DEBUG=false',  this setting
does not work properly. This patch fixes this behaviour.

Change-Id: Ia6f68b3638e16651f9ba300378f5f68938799cdc
2015-07-07 21:21:32 +05:30
Pradeep Kumar Singh 7ef90aeccf Replace dict.iteritems() with dict.items()
Partially-Implements: blueprint designate-py3

Change-Id: I068d05e77bd94cbe2ce613dd4428545144214786
2015-06-30 09:39:51 +05:30
Tim Simmons 021946e386 Asynchronous Zone Import
* Creates /v2/zones/tasks/imports, which allows users to view imports as resources
* Creates new database table zone_tasks for asynchronous tasks related to zones, along
with the associated objects/adapters
* Imports are done by passing over the request body, creating an async record in the db,
and spawning a thread to do the import
* Adds a config option to enable zone import

Implements: async-import-export
APIImpact: Adds /zones/tasks/imports and removes import from admin api

Change-Id: Ib23810bf8b25d962b9d2d75e042bb097f3c12f7a
2015-06-22 14:45:39 +00:00