Move WSGIService to designate/api/service.py and deprecate

Oslo.service will remove oslo_service.wsgi and oslo_service.sslutils
in version 2026.2 as part of eventlet removal.

This patch moves WSGIService from designate/service.py to
designate/api/service.py where it's actually used. This prevents
other services (central, mdns, worker, producer, sink) from importing
eventlet-dependent modules.

A module-level deprecation warning is added via debtcollector to guide
operators to deploy the API via uwsgi (the recommended method
and DevStack default).

Partial-Bug: #2141415
Assisted-By: Claude Code 4.5 Sonnet
Change-Id: I0e85af1e6b1ee957bcf1a1d1aa97cc23ad7c4c6f
Signed-off-by: Omer <oschwart@redhat.com>
This commit is contained in:
Omer
2026-01-29 15:33:52 +02:00
committed by Omer Schwartz
parent 46cb4098e0
commit 4cafb61bcc
4 changed files with 88 additions and 47 deletions

View File

@@ -13,7 +13,16 @@
# 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: This module provides WSGIService which uses oslo_service.wsgi and
# oslo_service.sslutils. These modules will be removed in oslo.service 2026.2
# as they are built on eventlet. WSGIService and the designate-api service are
# deprecated. Deploy Designate API via uwsgi instead. See the DevStack
# configuration for an example of uwsgi deployment.
from debtcollector import removals
from oslo_log import log as logging
from oslo_utils import netutils
from paste import deploy
import designate.conf
@@ -25,8 +34,62 @@ from designate import utils
CONF = designate.conf.CONF
LOG = logging.getLogger(__name__)
removals.removed_module(
__name__,
removal_version="2027.1",
message=(
"The designate.api.service module is deprecated. WSGIService uses "
"oslo_service.wsgi and oslo_service.sslutils which will be removed "
"in oslo.service 2026.2. Deploy Designate API via uwsgi instead. "
"See the DevStack configuration for an example of uwsgi deployment."
),
)
class Service(service.WSGIService):
class WSGIService(service.Service):
def __init__(self, app, name, listen, max_url_len=None):
from oslo_service import sslutils
from oslo_service import wsgi
super().__init__(name)
self.app = app
self.name = name
self.listen = listen
self.servers = []
for address in self.listen:
host, port = netutils.parse_host_port(address)
server = wsgi.Server(
CONF, name, app,
host=host,
port=port,
pool_size=CONF['service:api'].threads,
backlog=CONF.backlog,
use_ssl=sslutils.is_enabled(CONF),
max_url_len=max_url_len
)
self.servers.append(server)
def start(self):
for server in self.servers:
server.start()
super().start()
def stop(self, graceful=True):
for server in self.servers:
server.stop()
super().stop(graceful)
def wait(self):
for server in self.servers:
server.wait()
super().wait()
class Service(WSGIService):
def __init__(self):
super().__init__(
self.wsgi_application,

View File

@@ -25,8 +25,6 @@ import threading
from oslo_log import log as logging
import oslo_messaging as messaging
from oslo_service import service
from oslo_service import sslutils
from oslo_service import wsgi
from oslo_utils import netutils
from designate.common.decorators import rpc as rpc_decorator
@@ -114,46 +112,6 @@ class RPCService(Service):
super().wait()
class WSGIService(Service):
def __init__(self, app, name, listen, max_url_len=None):
super().__init__(name)
self.app = app
self.name = name
self.listen = listen
self.servers = []
for address in self.listen:
host, port = netutils.parse_host_port(address)
server = wsgi.Server(
CONF, name, app,
host=host,
port=port,
pool_size=CONF['service:api'].threads,
backlog=CONF.backlog,
use_ssl=sslutils.is_enabled(CONF),
max_url_len=max_url_len
)
self.servers.append(server)
def start(self):
for server in self.servers:
server.start()
super().start()
def stop(self, graceful=True):
for server in self.servers:
server.stop()
super().stop(graceful)
def wait(self):
for server in self.servers:
server.wait()
super().wait()
class DNSService:
_TCP_RECV_MAX_SIZE = 65535

View File

@@ -20,6 +20,7 @@ from oslo_config import fixture as cfg_fixture
from oslo_service import service
import oslotest.base
from designate.api import service as api_service
from designate.common import profiler
import designate.conf
from designate.mdns import handler
@@ -208,7 +209,7 @@ class TestWSGIService(oslotest.base.BaseTestCase):
self.mock_app = mock.Mock()
self.service = designate_service.WSGIService(
self.service = api_service.WSGIService(
self.mock_app, 'test-wsgi-service', listen
)
mock_wsgi_server.assert_called()
@@ -226,7 +227,7 @@ class TestWSGIService(oslotest.base.BaseTestCase):
self.mock_app = mock.Mock()
self.service = designate_service.WSGIService(
self.service = api_service.WSGIService(
self.mock_app, 'test-wsgi-service', listen
)
mock_wsgi_server.assert_called_once()
@@ -244,7 +245,7 @@ class TestWSGIService(oslotest.base.BaseTestCase):
self.mock_app = mock.Mock()
listen = [('192.0.2.1', '80')]
self.service = designate_service.WSGIService(
self.service = api_service.WSGIService(
self.mock_app, 'test-wsgi-service', listen
)
mock_wsgi_server.assert_called_once()
@@ -259,7 +260,7 @@ class TestWSGIService(oslotest.base.BaseTestCase):
self.mock_app = mock.Mock()
listen = [('192.0.2.1', '80'), ('192.0.2.2', '80')]
self.service = designate_service.WSGIService(
self.service = api_service.WSGIService(
self.mock_app, 'test-wsgi-service', listen
)
mock_wsgi_server.assert_called()

View File

@@ -0,0 +1,19 @@
---
deprecations:
- |
The ``designate-api`` service and the ``designate.api.service`` module
are deprecated and will be removed in a future release. The WSGIService
class relies on ``oslo_service.wsgi`` and ``oslo_service.sslutils``,
which will be removed in oslo.service 2026.2 as part of the eventlet
removal effort.
upgrade:
- |
Operators should migrate to deploying the Designate API using a WSGI
server such as uwsgi or mod_wsgi. This has been the recommended
deployment method and is the default in DevStack. The ``designate-api``
command will continue to work until the planned removal, but operators
are encouraged to migrate to uwsgi deployment as soon as possible.
See the DevStack configuration at
``devstack/lib/designate`` and ``devstack/files/wsgi/designate-api-wsgi``
for an example of uwsgi deployment.