Remove configs and entries for deprecated registry

Including removal of the example conf in docs.
Including glance-registry command entrypoint to eventlet.
Including rpc_controller from wsgi, changed to reject.
Not including the files devstack is depending on.

This change means that glance-registry starts and announces
that it has been removed.
This change means that when ran as wsgi app, all calls to
/rpc endpoint will be rejected.

This will allow devstack to make a graceful transition to
life without the glance registry, which was deprecated in
Newton release.

Change-Id: I7bf3284cba4c38605fb50b3c458e53f896f34086
This commit is contained in:
Erno Kuvaja 2020-02-13 12:30:50 +00:00
parent f7b1631190
commit 781da9354f
14 changed files with 44 additions and 2176 deletions

View File

@ -28,8 +28,7 @@ programs.
Starting a server
-----------------
There are two ways to start a Glance server (either the API server or the
registry server):
There are two ways to start a Glance server:
* Manually calling the server program
@ -61,8 +60,7 @@ following directories, stopping at the first config file it finds:
* ``/etc``
The filename that is searched for depends on the server application name. So,
if you are starting up the API server, ``glance-api.conf`` is searched for,
otherwise ``glance-registry.conf``.
if you are starting up the API server, ``glance-api.conf`` is searched for.
If no configuration file is found, you will see an error, like::
@ -70,7 +68,7 @@ If no configuration file is found, you will see an error, like::
ERROR: Unable to locate any configuration file. Cannot load application glance-api
Here is an example showing how you can manually start the ``glance-api`` server
and ``glance-registry`` in a shell.::
in a shell.::
$ sudo glance-api --config-file glance-api.conf --debug &
jsuh@mc-ats1:~$ 2011-04-13 14:50:12 DEBUG [glance-api] ********************************************************************************
@ -88,46 +86,16 @@ and ``glance-registry`` in a shell.::
2011-04-13 14:50:12 DEBUG [routes.middleware] Initialized with method overriding = True, and path info altering = True
2011-04-13 14:50:12 DEBUG [eventlet.wsgi.server] (21354) wsgi starting up on http://65.114.169.29:9292/
$ sudo glance-registry --config-file glance-registry.conf &
jsuh@mc-ats1:~$ 2011-04-13 14:51:16 INFO [sqlalchemy.engine.base.Engine.0x...feac] PRAGMA table_info("images")
2011-04-13 14:51:16 INFO [sqlalchemy.engine.base.Engine.0x...feac] ()
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Col ('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk')
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (0, u'created_at', u'DATETIME', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (1, u'updated_at', u'DATETIME', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (2, u'deleted_at', u'DATETIME', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (3, u'deleted', u'BOOLEAN', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (4, u'id', u'INTEGER', 1, None, 1)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (5, u'name', u'VARCHAR(255)', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (6, u'disk_format', u'VARCHAR(20)', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (7, u'container_format', u'VARCHAR(20)', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (8, u'size', u'INTEGER', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (9, u'status', u'VARCHAR(30)', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (10, u'is_public', u'BOOLEAN', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (11, u'location', u'TEXT', 0, None, 0)
2011-04-13 14:51:16 INFO [sqlalchemy.engine.base.Engine.0x...feac] PRAGMA table_info("image_properties")
2011-04-13 14:51:16 INFO [sqlalchemy.engine.base.Engine.0x...feac] ()
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Col ('cid', 'name', 'type', 'notnull', 'dflt_value', 'pk')
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (0, u'created_at', u'DATETIME', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (1, u'updated_at', u'DATETIME', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (2, u'deleted_at', u'DATETIME', 0, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (3, u'deleted', u'BOOLEAN', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (4, u'id', u'INTEGER', 1, None, 1)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (5, u'image_id', u'INTEGER', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (6, u'key', u'VARCHAR(255)', 1, None, 0)
2011-04-13 14:51:16 DEBUG [sqlalchemy.engine.base.Engine.0x...feac] Row (7, u'value', u'TEXT', 0, None, 0)
$ ps aux | grep glance
root 20009 0.7 0.1 12744 9148 pts/1 S 12:47 0:00 /usr/bin/python /usr/bin/glance-api glance-api.conf --debug
root 20012 2.0 0.1 25188 13356 pts/1 S 12:47 0:00 /usr/bin/python /usr/bin/glance-registry glance-registry.conf
jsuh 20017 0.0 0.0 3368 744 pts/1 S+ 12:47 0:00 grep glance
Simply supply the configuration file as the parameter to the ``--config-file``
option (the ``etc/glance-api.conf`` and ``etc/glance-registry.conf`` sample
configuration files were used in the above example) and then any other options
you want to use. (``--debug`` was used above to show some of the debugging
output that the server shows when starting up. Call the server program
with ``--help`` to see all available options you can specify on the
command line.)
option (the ``etc/glance-api.conf`` sample configuration file was used in the
above example) and then any other options you want to use. (``--debug`` was
used above to show some of the debugging output that the server shows when
starting up. Call the server program with ``--help`` to see all available
options you can specify on the command line.)
For more information on configuring the server via the ``paste.deploy``
configuration files, see the section entitled
@ -162,19 +130,15 @@ with ``glance-control`` in the following way::
You must use the ``sudo`` program to run ``glance-control`` currently, as the
pid files for the server programs are written to /var/run/glance/
Here is an example that shows how to start the ``glance-registry`` server
Here is an example that shows how to start the ``glance-api`` server
with the ``glance-control`` wrapper script. ::
$ sudo glance-control api start glance-api.conf
Starting glance-api with /home/jsuh/glance.conf
$ sudo glance-control registry start glance-registry.conf
Starting glance-registry with /home/jsuh/glance.conf
$ ps aux | grep glance
root 20038 4.0 0.1 12728 9116 ? Ss 12:51 0:00 /usr/bin/python /usr/bin/glance-api /home/jsuh/glance-api.conf
root 20039 6.0 0.1 25188 13356 ? Ss 12:51 0:00 /usr/bin/python /usr/bin/glance-registry /home/jsuh/glance-registry.conf
jsuh 20042 0.0 0.0 3368 744 pts/1 S+ 12:51 0:00 grep glance
@ -218,8 +182,8 @@ use the ``glance-control`` program to stop it. Simply do the following::
as this example shows::
$ sudo glance-control registry stop
Stopping glance-registry pid: 17602 signal: 15
$ sudo glance-control api stop
Stopping glance-api pid: 17602 signal: 15
Restarting a server
-------------------
@ -227,9 +191,9 @@ Restarting a server
You can restart a server with the ``glance-control`` program, as demonstrated
here::
$ sudo glance-control registry restart etc/glance-registry.conf
Stopping glance-registry pid: 17611 signal: 15
Starting glance-registry with /home/jpipes/repos/glance/trunk/etc/glance-registry.conf
$ sudo glance-control api restart etc/glance-api.conf
Stopping glance-api pid: 17611 signal: 15
Starting glance-api with /home/jpipes/repos/glance/trunk/etc/glance-api.conf
Reloading a server
------------------

View File

@ -103,4 +103,4 @@ following order:
* ``/etc``
All options set in ``glance-manage.conf`` override those set in
``glance-registry.conf`` and ``glance-api.conf``.
``glance-api.conf``.

View File

@ -1,40 +0,0 @@
===============
glance-registry
===============
--------------------------------------
Server for the Glance Registry Service
--------------------------------------
.. include:: header.txt
.. include:: ../deprecate-registry.inc
SYNOPSIS
========
::
glance-registry [options]
DESCRIPTION
===========
glance-registry is a server daemon that serves image metadata through a
REST-like API.
OPTIONS
=======
**General options**
.. include:: general_options.txt
FILES
=====
**/etc/glance/glance-registry.conf**
Default configuration file for Glance Registry
.. include:: footer.txt

View File

@ -74,8 +74,6 @@ config_generator_config_file = [
'_static/glance-cache'),
('../../etc/oslo-config-generator/glance-manage.conf',
'_static/glance-manage'),
('../../etc/oslo-config-generator/glance-registry.conf',
'_static/glance-registry'),
('../../etc/oslo-config-generator/glance-scrubber.conf',
'_static/glance-scrubber'),
]
@ -162,8 +160,6 @@ man_pages = [
[u'OpenStack'], 1),
('cli/glancemanage', 'glance-manage', u'Glance Management Utility',
[u'OpenStack'], 1),
('cli/glanceregistry', 'glance-registry', u'Glance Registry Server',
[u'OpenStack'], 1),
('cli/glancereplicator', 'glance-replicator', u'Glance Replicator',
[u'OpenStack'], 1),
('cli/glancescrubber', 'glance-scrubber', u'Glance Scrubber Service',

View File

@ -1,13 +0,0 @@
.. _glance-registry.conf:
--------------------
glance-registry.conf
--------------------
.. include:: ../deprecate-registry.inc
This configuration file controls how the register server operates. More
information can be found in :ref:`configuring-the-glance-registry`.
.. show-options::
:config-file: etc/oslo-config-generator/glance-registry.conf

View File

@ -18,15 +18,6 @@ This sample configuration can also be viewed in `glance-api.conf.sample
.. literalinclude:: ../_static/glance-api.conf.sample
Sample configuration for Glance Registry
----------------------------------------
This sample configuration can also be viewed in `glance-registry.conf.sample
<../_static/glance-registry.conf.sample>`_.
.. literalinclude:: ../_static/glance-registry.conf.sample
Sample configuration for Glance Scrubber
----------------------------------------

View File

@ -1,16 +1,17 @@
# Glance Registry has been removed, this file can be removed once devstack doesn't need it.
# Use this pipeline for no auth - DEFAULT
[pipeline:glance-registry]
pipeline = healthcheck osprofiler unauthenticated-context registryapp
pipeline = healthcheck registryapp
# Use this pipeline for keystone auth
[pipeline:glance-registry-keystone]
pipeline = healthcheck osprofiler authtoken context registryapp
pipeline = healthcheck registryapp
# Use this pipeline for authZ only. This means that the registry will treat a
# user as authenticated without making requests to keystone to reauthenticate
# the user.
[pipeline:glance-registry-trusted-auth]
pipeline = healthcheck osprofiler context registryapp
pipeline = healthcheck registryapp
[app:registryapp]
paste.app_factory = glance.registry.api:API.factory
@ -19,17 +20,3 @@ paste.app_factory = glance.registry.api:API.factory
paste.filter_factory = oslo_middleware:Healthcheck.factory
backends = disable_by_file
disable_by_file_path = /etc/glance/healthcheck_disable
[filter:context]
paste.filter_factory = glance.api.middleware.context:ContextMiddleware.factory
[filter:unauthenticated-context]
paste.filter_factory = glance.api.middleware.context:UnauthenticatedContextMiddleware.factory
[filter:authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
[filter:osprofiler]
paste.filter_factory = osprofiler.web:WsgiMiddleware.factory
hmac_keys = SECRET_KEY #DEPRECATED
enabled = yes #DEPRECATED

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,3 @@
wrap_width = 80
output_file = etc/glance-registry.conf.sample
namespace = glance.registry
namespace = oslo.messaging
namespace = oslo.db
namespace = oslo.db.concurrency
namespace = oslo.policy
namespace = keystonemiddleware.auth_token
namespace = oslo.log

View File

@ -18,36 +18,14 @@
# under the License.
"""
Reference implementation server for Glance Registry
Glance Registry has been removed after deprecation
Delete after devstack does not need this anymore.
"""
import os
import sys
import eventlet
# NOTE(jokke): As per the eventlet commit
# b756447bab51046dfc6f1e0e299cc997ab343701 there's circular import happening
# which can be solved making sure the hubs are properly and fully imported
# before calling monkey_patch(). This is solved in eventlet 0.22.0 but we
# need to address it before that is widely used around.
eventlet.hubs.get_hub()
if os.name == 'nt':
# eventlet monkey patching the os module causes subprocess.Popen to fail
# on Windows when using pipes due to missing non-blocking IO support.
eventlet.patcher.monkey_patch(os=False)
else:
eventlet.patcher.monkey_patch()
# Monkey patch the original current_thread to use the up-to-date _active
# global variable. See https://bugs.launchpad.net/bugs/1863021 and
# https://github.com/eventlet/eventlet/issues/592
import __original_module_threading as orig_threading
import threading
orig_threading.current_thread.__globals__['_active'] = threading._active
from oslo_reports import guru_meditation_report as gmr
from oslo_utils import encodeutils
import time
# If ../glance/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
@ -57,45 +35,16 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
if os.path.exists(os.path.join(possible_topdir, 'glance', '__init__.py')):
sys.path.insert(0, possible_topdir)
from oslo_config import cfg
from oslo_log import log as logging
import osprofiler.initializer
from glance.common import config
from glance.common import wsgi
from glance import notifier
from glance import version
CONF = cfg.CONF
CONF.import_group("profiler", "glance.common.wsgi")
logging.register_options(CONF)
wsgi.register_cli_opts()
def main():
try:
config.parse_args()
config.set_config_defaults()
wsgi.set_eventlet_hub()
logging.setup(CONF, 'glance')
gmr.TextGuruMeditation.setup_autorun(version)
notifier.set_defaults()
if CONF.profiler.enabled:
osprofiler.initializer.init_from_conf(
conf=CONF,
context={},
project="glance",
service="registry",
host=CONF.bind_host
)
server = wsgi.Server()
server.start(config.load_paste_app('glance-registry'),
default_port=9191)
server.wait()
except RuntimeError as e:
sys.exit("ERROR: %s" % encodeutils.exception_to_unicode(e))
print("Glance Registry has been removed after deprecation")
# NOTE(jokke): Service is started and running for any init tooling
# purposes. Just being no-op.
while True:
time.sleep(5)
except Exception:
sys.exit("ERROR: Glance Registry has been removed after deprecation")
if __name__ == '__main__':

View File

@ -80,15 +80,7 @@ _api_opts = [
('paste_deploy', glance.common.config.paste_deploy_opts)
]
_registry_opts = [
(None, list(itertools.chain(
glance.api.middleware.context.context_opts,
glance.common.config.common_opts,
glance.common.wsgi.bind_opts,
glance.common.wsgi.socket_opts,
glance.common.wsgi.wsgi_opts,
glance.common.wsgi.eventlet_opts))),
profiler.list_opts()[0],
('paste_deploy', glance.common.config.paste_deploy_opts)
(None, []),
]
_scrubber_opts = [
(None, list(itertools.chain(

View File

@ -13,28 +13,25 @@
# License for the specific language governing permissions and limitations
# under the License.
import debtcollector
"""
Glance Registry has been removed after deprecation
Delete after devstack doesn't require anymore
"""
from oslo_config import cfg
from glance.common import wsgi
from glance.registry.api import v1
from glance.registry.api import v2
CONF = cfg.CONF
CONF.import_opt('enable_v1_registry', 'glance.common.config')
CONF.import_opt('enable_v2_registry', 'glance.common.config')
class API(wsgi.Router):
"""WSGI entry point for all Registry requests."""
def __init__(self, mapper):
mapper = mapper or wsgi.APIMapper()
if CONF.enable_v1_registry:
v1.init(mapper)
if CONF.enable_v2_registry:
debtcollector.deprecate("Glance Registry service has been "
"deprecated for removal.")
v2.init(mapper)
mapper = wsgi.APIMapper()
v2.init(mapper)
super(API, self).__init__(mapper)

View File

@ -14,14 +14,12 @@
# under the License.
from glance.common import wsgi
from glance.registry.api.v2 import rpc
def init(mapper):
rpc_resource = rpc.create_resource()
mapper.connect("/rpc", controller=rpc_resource,
conditions=dict(method=["POST"]),
action="__call__")
reject_method_resource = wsgi.Resource(wsgi.RejectMethodController())
mapper.connect("/rpc", controller=reject_method_resource,
action="reject")
class API(wsgi.Router):

View File

@ -1,53 +0,0 @@
# Copyright 2013 Red Hat, Inc.
# All Rights Reserved.
#
# 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.
"""
RPC Controller
"""
from oslo_config import cfg
from glance.common import rpc
from glance.common import wsgi
import glance.db
from glance.i18n import _
CONF = cfg.CONF
class Controller(rpc.Controller):
def __init__(self, raise_exc=False):
super(Controller, self).__init__(raise_exc)
# NOTE(flaper87): Avoid using registry's db
# driver for the registry service. It would
# end up in an infinite loop.
if CONF.data_api == "glance.db.registry.api":
msg = _("Registry service can't use %s") % CONF.data_api
raise RuntimeError(msg)
# NOTE(flaper87): Register the
# db_api as a resource to expose.
db_api = glance.db.get_api()
self.register(glance.db.unwrap(db_api))
def create_resource():
"""Images resource factory method."""
deserializer = rpc.RPCJSONDeserializer()
serializer = rpc.RPCJSONSerializer()
return wsgi.Resource(Controller(), deserializer, serializer)