diff options
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/ec2/__init__.py | 23 | ||||
| -rw-r--r-- | nova/api/manager.py | 8 | ||||
| -rw-r--r-- | nova/api/metadata/__init__.py | 25 | ||||
| -rw-r--r-- | nova/api/metadata/handler.py (renamed from nova/api/ec2/metadatarequesthandler.py) | 25 |
4 files changed, 51 insertions, 30 deletions
diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index db92ca053..100837631 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -20,10 +20,7 @@ Starting point for routing EC2 requests. """ -from urlparse import urlparse -import eventlet -from eventlet.green import httplib import webob import webob.dec import webob.exc @@ -437,23 +434,3 @@ class Executor(wsgi.Application): (utils.utf8(code), utils.utf8(message), utils.utf8(context.request_id))) return resp - - -class Versions(wsgi.Application): - - @webob.dec.wsgify(RequestClass=wsgi.Request) - def __call__(self, req): - """Respond to a request for all EC2 versions.""" - # available api versions - versions = [ - '1.0', - '2007-01-19', - '2007-03-01', - '2007-08-29', - '2007-10-10', - '2007-12-15', - '2008-02-01', - '2008-09-01', - '2009-04-04', - ] - return ''.join('%s\n' % v for v in versions) diff --git a/nova/api/manager.py b/nova/api/manager.py index 9cb364e2d..35ea8100c 100644 --- a/nova/api/manager.py +++ b/nova/api/manager.py @@ -23,14 +23,14 @@ from nova import utils FLAGS = flags.FLAGS -class EC2Manager(manager.Manager): - """EC2 API manager. +class MetadataManager(manager.Manager): + """Metadata Manager. - This class manages the EC2 API service initialization. Currently, it + This class manages the Metadata API service initialization. Currently, it just adds an iptables filter rule for the metadata service. """ def __init__(self, *args, **kwargs): - super(EC2Manager, self).__init__(*args, **kwargs) + super(MetadataManager, self).__init__(*args, **kwargs) self.network_driver = utils.import_object(FLAGS.network_driver) def init_host(self): diff --git a/nova/api/metadata/__init__.py b/nova/api/metadata/__init__.py new file mode 100644 index 000000000..f09dfc326 --- /dev/null +++ b/nova/api/metadata/__init__.py @@ -0,0 +1,25 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2011 Openstack, LLC. +# +# 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. + +""" +:mod:`nova.api.metadata` -- Nova Metadata Server +================================================ + +.. automodule:: nova.api.metadata + :platform: Unix + :synopsis: Metadata Server for Nova +.. moduleauthor:: Vishvananda Ishaya <vishvananda@gmail.com> +""" diff --git a/nova/api/ec2/metadatarequesthandler.py b/nova/api/metadata/handler.py index 0198bf490..5d63c6dce 100644 --- a/nova/api/ec2/metadatarequesthandler.py +++ b/nova/api/metadata/handler.py @@ -23,18 +23,37 @@ import webob.exc from nova import log as logging from nova import flags -from nova import utils from nova import wsgi from nova.api.ec2 import cloud -LOG = logging.getLogger('nova.api.ec2.metadata') +LOG = logging.getLogger('nova.api.metadata') FLAGS = flags.FLAGS flags.DECLARE('use_forwarded_for', 'nova.api.auth') +class Versions(wsgi.Application): + + @webob.dec.wsgify(RequestClass=wsgi.Request) + def __call__(self, req): + """Respond to a request for all versions.""" + # available api versions + versions = [ + '1.0', + '2007-01-19', + '2007-03-01', + '2007-08-29', + '2007-10-10', + '2007-12-15', + '2008-02-01', + '2008-09-01', + '2009-04-04', + ] + return ''.join('%s\n' % v for v in versions) + + class MetadataRequestHandler(wsgi.Application): - """Serve metadata from the EC2 API.""" + """Serve metadata.""" def __init__(self): self.cc = cloud.CloudController() |
