diff --git a/nova/conf/__init__.py b/nova/conf/__init__.py index 416d64779087..17c4a98e37f1 100644 --- a/nova/conf/__init__.py +++ b/nova/conf/__init__.py @@ -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) diff --git a/nova/conf/s3.py b/nova/conf/s3.py new file mode 100644 index 000000000000..14ec6be9210d --- /dev/null +++ b/nova/conf/s3.py @@ -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} diff --git a/nova/image/s3.py b/nova/image/s3.py index 47c1fea366b2..1f2375e77fc6 100644 --- a/nova/image/s3.py +++ b/nova/image/s3.py @@ -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):