config options: move s3 related options

Move the s3 related options to "nova/conf/". A follow up patch will
deprecate those as they aren't used anymore since the EC2 API got
removed in Mitaka.

bp centralize-config-options-newton

Change-Id: If3994be79aa92fc0179e87c123eedb8a958f4aa9
This commit is contained in:
Markus Zoeller
2016-05-09 16:58:59 +02:00
committed by John Garbutt
parent be22885793
commit d3a1fd56ca
3 changed files with 56 additions and 31 deletions

View File

@@ -70,6 +70,7 @@ from nova.conf import quota
from nova.conf import rdp
from nova.conf import remote_debug
from nova.conf import rpc
from nova.conf import s3
from nova.conf import scheduler
# from nova.conf import security
from nova.conf import serial_console
@@ -141,6 +142,7 @@ pci.register_opts(CONF)
quota.register_opts(CONF)
rdp.register_opts(CONF)
rpc.register_opts(CONF)
s3.register_opts(CONF)
scheduler.register_opts(CONF)
# security.register_opts(CONF)
serial_console.register_opts(CONF)

54
nova/conf/s3.py Normal file
View File

@@ -0,0 +1,54 @@
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2016 OpenStack Foundation
# 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.
from oslo_config import cfg
s3_opts = [
cfg.StrOpt('image_decryption_dir',
default='/tmp',
help='Parent directory for tempdir used for image decryption'),
cfg.StrOpt('s3_host',
default='$my_ip',
help='Hostname or IP for OpenStack to use when accessing '
'the S3 api'),
cfg.IntOpt('s3_port',
default=3333,
min=1,
max=65535,
help='Port used when accessing the S3 api'),
cfg.StrOpt('s3_access_key',
default='notchecked',
help='Access key to use for S3 server for images'),
cfg.StrOpt('s3_secret_key',
default='notchecked',
help='Secret key to use for S3 server for images'),
cfg.BoolOpt('s3_use_ssl',
default=False,
help='Whether to use SSL when talking to S3'),
cfg.BoolOpt('s3_affix_tenant',
default=False,
help='Whether to affix the tenant id to the access key '
'when downloading from S3'),
]
def register_opts(conf):
conf.register_opts(s3_opts)
def list_opts():
return {'DEFAULT': s3_opts}

View File

@@ -26,7 +26,6 @@ import tempfile
import boto.s3.connection
from lxml import etree
from oslo_concurrency import processutils
from oslo_config import cfg
from oslo_log import log as logging
from nova.api.ec2 import ec2utils
@@ -40,37 +39,7 @@ from nova import utils
LOG = logging.getLogger(__name__)
s3_opts = [
cfg.StrOpt('image_decryption_dir',
default='/tmp',
help='Parent directory for tempdir used for image decryption'),
cfg.StrOpt('s3_host',
default='$my_ip',
help='Hostname or IP for OpenStack to use when accessing '
'the S3 api'),
cfg.IntOpt('s3_port',
default=3333,
min=1,
max=65535,
help='Port used when accessing the S3 api'),
cfg.StrOpt('s3_access_key',
default='notchecked',
help='Access key to use for S3 server for images'),
cfg.StrOpt('s3_secret_key',
default='notchecked',
help='Secret key to use for S3 server for images'),
cfg.BoolOpt('s3_use_ssl',
default=False,
help='Whether to use SSL when talking to S3'),
cfg.BoolOpt('s3_affix_tenant',
default=False,
help='Whether to affix the tenant id to the access key '
'when downloading from S3'),
]
CONF = nova.conf.CONF
CONF.register_opts(s3_opts)
class S3ImageService(object):