Partial revert of ec2 removal patch

In Id7936be290b6febd18deb4c2db8ea4d678d4d9b1 and
I8bf7cbaa7015bb61656ab90ccc8f944aaeebb095 parts of the ec2
infrastructure were removed that had been deprecated and warned about
in Liberty.

However, changes were made to the metadata server in these changes as
well, none of which had been warned about, and arguably should not be
removed ever. The metadata server is an AWS construct, and given the
implementation order of APIs in Nova (ec2 was the first API) it shares
code with the ec2 base classes. But it's the ec2 API we were
deprecating out and deleting.

Removing these breaks anyone upgrading using the metadata server, as
was seen by the neutron multinode job.

In addition, paste filters should *never* return a response code
directly. Doing so means they block processing the rest of the
pipeline. Which means that the deprecation approach that was used here
actually forcably broke anyone with existing deploys.

Change-Id: I22eb3a3fcd8e74a1d9085acde15c25a927ae12cb
Closes-Bug: #1545101
This commit is contained in:
Matt Riedemann
2016-02-12 10:46:13 -08:00
committed by Sean Dague
parent 12d224e7df
commit f2c1cfae53

View File

@@ -17,33 +17,69 @@
import webob.dec import webob.dec
import webob.exc import webob.exc
from oslo_log import log as logging
from nova.i18n import _LW
from nova import wsgi from nova import wsgi
LOG = logging.getLogger(__name__)
_DEPRECATED_MIDDLEWARE = (
'%s has been deprecated and removed from Nova in Mitaka. '
'You will need to remove lines referencing it in your paste.ini before '
'upgrade to Newton or your cloud will break.')
_DEPRECATION_MESSAGE = ('The in tree EC2 API has been removed in Mitaka. ' _DEPRECATION_MESSAGE = ('The in tree EC2 API has been removed in Mitaka. '
'Please remove entries from api-paste.ini') 'Please remove entries from api-paste.ini')
# NOTE(sdague): this whole file is safe to remove in Newton. We just
# needed a release cycle for it.
class DeprecatedMiddleware(wsgi.Middleware): class DeprecatedMiddleware(wsgi.Middleware):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(DeprecatedMiddleware, self).__init__(args[0]) super(DeprecatedMiddleware, self).__init__(args[0])
LOG.warn(_LW(_DEPRECATED_MIDDLEWARE % type(self).__name__)) # noqa
@webob.dec.wsgify(RequestClass=wsgi.Request) @webob.dec.wsgify(RequestClass=wsgi.Request)
def __call__(self, req): def __call__(self, req):
return webob.exc.HTTPException(message=_DEPRECATION_MESSAGE) # deprecated middleware needs to be a no op, not an exception
return req.get_response(self.application)
class DeprecatedApplication(wsgi.Application): class FaultWrapper(DeprecatedMiddleware):
pass
class Lockout(DeprecatedMiddleware):
pass
class EC2KeystoneAuth(DeprecatedMiddleware):
pass
class NoAuth(DeprecatedMiddleware):
pass
class Requestify(DeprecatedMiddleware):
pass
class Authorizer(DeprecatedMiddleware):
pass
class RequestLogging(DeprecatedMiddleware):
pass
class Validator(DeprecatedMiddleware):
pass
class Executor(wsgi.Application):
@webob.dec.wsgify(RequestClass=wsgi.Request) @webob.dec.wsgify(RequestClass=wsgi.Request)
def __call__(self, req): def __call__(self, req):
return webob.exc.HTTPException(message=_DEPRECATION_MESSAGE) return webob.exc.HTTPNotFound(explanation=_DEPRECATION_MESSAGE)
FaultWrapper = DeprecatedMiddleware
RequestLogging = DeprecatedMiddleware
Lockout = DeprecatedMiddleware
EC2KeystoneAuth = DeprecatedMiddleware
NoAuth = DeprecatedMiddleware
Requestify = DeprecatedMiddleware
Authorizer = DeprecatedMiddleware
Validator = DeprecatedMiddleware
Executor = DeprecatedApplication