config options: centralize default flavor option

The default flavor was introduced for the ec2 API. That API is
deprecated and this option is not used in functional code anymore
but in unit tests.
A follow up patch will deprecate this option. In the next cycle we
can then remove it. I've put the option to its own module to avoid
merge conflicts with the nova.conf.compute module.
As this option was the last one for the "oslo.config" generator
namespace "nova.compute", the generator file was changed too and
the nova.compute.ops module was deleted.

blueprint centralize-config-options-newton

Change-Id: Ie2be972673498ef984dfd3b5164512d77ef85ace
This commit is contained in:
Markus Zoeller 2016-05-09 15:38:28 +02:00 committed by John Garbutt
parent be22885793
commit 88703e1c87
5 changed files with 36 additions and 34 deletions

View File

@ -6,7 +6,6 @@ namespace = nova.conf
namespace = nova.api namespace = nova.api
namespace = nova.cache_utils namespace = nova.cache_utils
namespace = nova.cells namespace = nova.cells
namespace = nova.compute
namespace = nova.network namespace = nova.network
namespace = oslo.cache namespace = oslo.cache
namespace = oslo.log namespace = oslo.log

View File

@ -21,12 +21,12 @@
import re import re
import uuid import uuid
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import strutils from oslo_utils import strutils
import six import six
from nova.api.validation import parameter_types from nova.api.validation import parameter_types
import nova.conf
from nova import context from nova import context
from nova import db from nova import db
from nova import exception from nova import exception
@ -35,15 +35,7 @@ from nova.i18n import _LE
from nova import objects from nova import objects
from nova import utils from nova import utils
flavor_opts = [ CONF = nova.conf.CONF
cfg.StrOpt('default_flavor',
default='m1.small',
help='Default flavor to use for the EC2 API only. The Nova API '
'does not support a default flavor.'),
]
CONF = cfg.CONF
CONF.register_opts(flavor_opts)
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -1,23 +0,0 @@
# 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.
import nova.compute.flavors
import nova.compute.monitors
import nova.conf
def list_opts():
return [
('DEFAULT',
nova.compute.flavors.flavor_opts,
),
]

View File

@ -40,6 +40,7 @@ from nova.conf import crypto
# from nova.conf import database # from nova.conf import database
# from nova.conf import disk # from nova.conf import disk
from nova.conf import ephemeral_storage from nova.conf import ephemeral_storage
from nova.conf import flavors
from nova.conf import floating_ips from nova.conf import floating_ips
from nova.conf import glance from nova.conf import glance
from nova.conf import guestfs from nova.conf import guestfs
@ -113,6 +114,7 @@ crypto.register_opts(CONF)
# disk.register_opts(CONF) # disk.register_opts(CONF)
ephemeral_storage.register_opts(CONF) ephemeral_storage.register_opts(CONF)
floating_ips.register_opts(CONF) floating_ips.register_opts(CONF)
flavors.register_opts(CONF)
glance.register_opts(CONF) glance.register_opts(CONF)
guestfs.register_opts(CONF) guestfs.register_opts(CONF)
# host.register_opts(CONF) # host.register_opts(CONF)

32
nova/conf/flavors.py Normal file
View File

@ -0,0 +1,32 @@
# 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
flavor_opts = [
cfg.StrOpt('default_flavor',
default='m1.small',
help='Default flavor to use for the EC2 API only. The Nova API '
'does not support a default flavor.'),
]
def register_opts(conf):
conf.register_opts(flavor_opts)
def list_opts():
return {'DEFAULT': flavor_opts}