diff options
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/auth.py | 11 | ||||
| -rw-r--r-- | nova/api/ec2/__init__.py | 31 | ||||
| -rw-r--r-- | nova/api/openstack/compute/__init__.py | 11 |
3 files changed, 37 insertions, 16 deletions
diff --git a/nova/api/auth.py b/nova/api/auth.py index 54fff94df..84ba3376d 100644 --- a/nova/api/auth.py +++ b/nova/api/auth.py @@ -21,17 +21,22 @@ Common Auth Middleware. import webob.dec import webob.exc +from nova.common import cfg from nova import context from nova import flags from nova import log as logging from nova import wsgi -FLAGS = flags.FLAGS -flags.DEFINE_boolean('use_forwarded_for', False, - 'Treat X-Forwarded-For as the canonical remote address. ' +use_forwarded_for_opt = \ + cfg.BoolOpt('use_forwarded_for', + default=False, + help='Treat X-Forwarded-For as the canonical remote address. ' 'Only enable this if you have a sanitizing proxy.') +FLAGS = flags.FLAGS +FLAGS.add_option(use_forwarded_for_opt) + class InjectContext(wsgi.Middleware): """Add a 'nova.context' to WSGI environ.""" diff --git a/nova/api/ec2/__init__.py b/nova/api/ec2/__init__.py index b052f7010..dfcddbc4e 100644 --- a/nova/api/ec2/__init__.py +++ b/nova/api/ec2/__init__.py @@ -32,6 +32,7 @@ from nova.api.ec2 import ec2utils from nova.api.ec2 import faults from nova.api import validator from nova.auth import manager +from nova.common import cfg from nova import context from nova import exception from nova import flags @@ -39,17 +40,27 @@ from nova import log as logging from nova import utils from nova import wsgi -FLAGS = flags.FLAGS + LOG = logging.getLogger("nova.api") -flags.DEFINE_integer('lockout_attempts', 5, - 'Number of failed auths before lockout.') -flags.DEFINE_integer('lockout_minutes', 15, - 'Number of minutes to lockout if triggered.') -flags.DEFINE_integer('lockout_window', 15, - 'Number of minutes for lockout window.') -flags.DEFINE_string('keystone_ec2_url', - 'http://localhost:5000/v2.0/ec2tokens', - 'URL to get token from ec2 request.') + +ec2_opts = [ + cfg.IntOpt('lockout_attempts', + default=5, + help='Number of failed auths before lockout.'), + cfg.IntOpt('lockout_minutes', + default=15, + help='Number of minutes to lockout if triggered.'), + cfg.IntOpt('lockout_window', + default=15, + help='Number of minutes for lockout window.'), + cfg.StrOpt('keystone_ec2_url', + default='http://localhost:5000/v2.0/ec2tokens', + help='URL to get token from ec2 request.'), + ] + +FLAGS = flags.FLAGS +FLAGS.add_options(ec2_opts) + flags.DECLARE('use_forwarded_for', 'nova.api.auth') diff --git a/nova/api/openstack/compute/__init__.py b/nova/api/openstack/compute/__init__.py index f074ac941..514b3b319 100644 --- a/nova/api/openstack/compute/__init__.py +++ b/nova/api/openstack/compute/__init__.py @@ -35,16 +35,21 @@ from nova.api.openstack.compute import servers from nova.api.openstack.compute import server_metadata from nova.api.openstack.compute import versions from nova.api.openstack import wsgi +from nova.common import cfg from nova import flags from nova import log as logging from nova import wsgi as base_wsgi LOG = logging.getLogger('nova.api.openstack.compute') + +allow_instance_snapshots_opt = \ + cfg.BoolOpt('allow_instance_snapshots', + default=True, + help='Permit instance snapshot operations.') + FLAGS = flags.FLAGS -flags.DEFINE_bool('allow_instance_snapshots', - True, - 'When True, this API service will permit instance snapshot operations.') +FLAGS.add_option(allow_instance_snapshots_opt) class APIRouter(base_wsgi.Router): |
