Isolate eventlet-dependent services for future migration

This commit creates the structure for migrating Designate
services from using eventlet, to using oslo.service threading backend
(standard/native python threading).

Key changes include:
* Eventlet isolation: existing eventlet-dependent service entrypoints
    (central, mdns, producer, sink, worker, manage, status) are moved
    from designate/cmd to a new designate/cmd/eventlet subdirectory.
* Updating their correct path in setup.cfg.

This prepares the codebase for future incremental migrations of
individual services to native threading.

Change-Id: I67941b5c7525d4b9661b30c4cc03dbd061e86083
Signed-off-by: Omer <oschwart@redhat.com>
This commit is contained in:
Omer 2025-10-14 11:21:59 +00:00 committed by Omer Schwartz
parent d88e46016c
commit c1a482a673
18 changed files with 79 additions and 41 deletions

View file

@ -17,18 +17,19 @@ import os
# Eventlet's GreenDNS Patching will prevent the resolution of names in
# the /etc/hosts file, causing problems for installs.
os.environ['EVENTLET_NO_GREENDNS'] = 'yes' # noqa
os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
from oslo_log import log # noqa
from oslo_concurrency import lockutils # noqa
from oslo_log import log # noqa
import oslo_messaging as messaging # noqa
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
_EXTRA_DEFAULT_LOG_LEVELS = [
'kazoo.client=WARN',
'keystone=INFO',
'oslo_service.loopingcall=WARN',
]
BASE_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
# Set some Oslo Log defaults
log.set_defaults(default_log_levels=log.get_default_log_levels() +
@ -37,5 +38,5 @@ log.set_defaults(default_log_levels=log.get_default_log_levels() +
# Set some Oslo RPC defaults
messaging.set_transport_defaults('designate')
# Set some Oslo Oslo Concurrency defaults
# Set some Oslo Concurrency defaults
lockutils.set_defaults(lock_path='$state_path')

View file

@ -13,6 +13,13 @@
import os
# NOTE(oschwart): remove once the default backend is ``BackendType.THREADING``
import oslo_service.backend as service
try:
service.init_backend(service.BackendType.THREADING)
except service.exceptions.BackendAlreadySelected:
pass
from oslo_config import cfg
from oslo_log import log as logging
from paste import deploy
@ -24,7 +31,6 @@ from designate import heartbeat_emitter
from designate import policy
from designate import rpc
CONF = designate.conf.CONF
CONFIG_FILES = ['api-paste.ini', 'designate.conf']

View file

@ -1,18 +0,0 @@
# Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Author: Kiall Mac Innes <kiall@hp.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import eventlet
eventlet.monkey_patch(os=False)

View file

@ -0,0 +1,24 @@
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
# Eventlet's GreenDNS Patching will prevent the resolution of names in
# the /etc/hosts file, causing problems for installs.
os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
import eventlet # noqa
eventlet.monkey_patch(os=False)

View file

@ -0,0 +1,22 @@
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# NOTE(oschwart): remove once the default backend is ``BackendType.THREADING``
import oslo_service.backend as service
try:
service.init_backend(service.BackendType.THREADING)
except service.exceptions.BackendAlreadySelected:
pass

View file

@ -15,7 +15,10 @@
# under the License.
import eventlet
import os
os.environ['EVENTLET_NO_GREENDNS'] = 'yes'
import eventlet # noqa
eventlet.monkey_patch(os=False)
eventlet.monkey_patch(os=False) # noqa

View file

@ -17,7 +17,7 @@ from oslo_upgradecheck import upgradecheck
from sqlalchemy.schema import MetaData
from sqlalchemy.schema import Table
from designate.cmd import status
from designate.cmd.eventlet import status
from designate.storage import sql
import designate.tests.functional

View file

@ -14,12 +14,12 @@ from unittest import mock
from oslo_config import fixture as cfg_fixture
import oslotest.base
from designate.cmd import api
from designate.cmd import central
from designate.cmd import mdns
from designate.cmd import producer
from designate.cmd import sink
from designate.cmd import worker
from designate.cmd.eventlet import api
from designate.cmd.eventlet import central
from designate.cmd.eventlet import mdns
from designate.cmd.eventlet import producer
from designate.cmd.eventlet import sink
from designate.cmd.eventlet import worker
import designate.conf

View file

@ -15,7 +15,7 @@ from unittest import mock
from oslo_config import fixture as cfg_fixture
import oslotest.base
from designate.cmd import manage
from designate.cmd.eventlet import manage
import designate.conf
from designate.manage import base

View file

@ -53,14 +53,14 @@ oslo.policy.enforcer =
console_scripts =
designate-rootwrap = oslo_rootwrap.cmd:main
designate-api = designate.cmd.api:main
designate-central = designate.cmd.central:main
designate-manage = designate.cmd.manage:main
designate-mdns = designate.cmd.mdns:main
designate-sink = designate.cmd.sink:main
designate-worker = designate.cmd.worker:main
designate-producer = designate.cmd.producer:main
designate-status = designate.cmd.status:main
designate-api = designate.cmd.eventlet.api:main
designate-central = designate.cmd.eventlet.central:main
designate-manage = designate.cmd.eventlet.manage:main
designate-mdns = designate.cmd.eventlet.mdns:main
designate-sink = designate.cmd.eventlet.sink:main
designate-worker = designate.cmd.eventlet.worker:main
designate-producer = designate.cmd.eventlet.producer:main
designate-status = designate.cmd.eventlet.status:main
designate.api.admin.extensions =
reports = designate.api.admin.controllers.extensions.reports:ReportsController