Merge "config options: Centralise 'virt.ironic' options"

This commit is contained in:
Jenkins 2016-01-05 04:54:31 +00:00 committed by Gerrit Code Review
commit bef6ce576f
4 changed files with 104 additions and 47 deletions

View File

@ -46,7 +46,7 @@ from nova.conf import ephemeral_storage
# from nova.conf import image
# from nova.conf import imagecache
# from nova.conf import image_file_url
# from nova.conf import ironic
from nova.conf import ironic
# from nova.conf import keymgr
# from nova.conf import keystone_authtoken
# from nova.conf import libvirt
@ -104,7 +104,7 @@ ephemeral_storage.register_opts(CONF)
# image.register_opts(CONF)
# imagecache.register_opts(CONF)
# image_file_url.register_opts(CONF)
# ironic.register_opts(CONF)
ironic.register_opts(CONF)
# keymgr.register_opts(CONF)
# keystone_authtoken.register_opts(CONF)
# libvirt.register_opts(CONF)

98
nova/conf/ironic.py Normal file
View File

@ -0,0 +1,98 @@
# Copyright 2015 Intel Corporation
# 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
ironic_group = cfg.OptGroup(
'ironic',
title='Ironic Options')
api_version = cfg.IntOpt(
'api_version',
default=1,
help='Version of Ironic API service endpoint.')
api_endpoint = cfg.StrOpt(
'api_endpoint',
help='URL for Ironic API endpoint.')
admin_username = cfg.StrOpt(
'admin_username',
help='Ironic keystone admin name')
admin_password = cfg.StrOpt(
'admin_password',
secret=True,
help='Ironic keystone admin password.')
admin_auth_token = cfg.StrOpt(
'admin_auth_token',
secret=True,
deprecated_for_removal=True,
help='Ironic keystone auth token.'
'DEPRECATED: use admin_username, admin_password, and '
'admin_tenant_name instead')
admin_url = cfg.StrOpt(
'admin_url',
help='Keystone public API endpoint.')
client_log_level = cfg.StrOpt(
'client_log_level',
deprecated_for_removal=True,
help='Log level override for ironicclient. Set this in '
'order to override the global "default_log_levels", '
'"verbose", and "debug" settings. '
'DEPRECATED: use standard logging configuration.')
admin_tenant_name = cfg.StrOpt(
'admin_tenant_name',
help='Ironic keystone tenant name.')
api_max_retries = cfg.IntOpt(
'api_max_retries',
default=60,
help=('How many retries when a request does conflict. '
'If <= 0, only try once, no retries.'))
api_retry_interval = cfg.IntOpt(
'api_retry_interval',
default=2,
help='How often to retry in seconds when a request '
'does conflict')
ALL_OPTS = [api_version,
api_endpoint,
admin_username,
admin_password,
admin_auth_token,
admin_url,
client_log_level,
admin_tenant_name,
api_max_retries,
api_retry_interval]
def register_opts(conf):
conf.register_group(ironic_group)
conf.register_opts(ALL_OPTS, group=ironic_group)
def list_opts():
# Because of bug 1395819 in oslo.config we cannot pass in the OptGroup.
# As soon as this bug is fixed is oslo.config and Nova uses the
# version which contains this fix, we can pass in the OptGroup instead
# of its name. This allows the generation of the group help too.
return (ironic_group.name, ALL_OPTS)

View File

@ -27,7 +27,6 @@ import shutil
import tempfile
import time
from oslo_config import cfg
from oslo_log import log as logging
from oslo_service import loopingcall
from oslo_utils import excutils
@ -41,6 +40,7 @@ from nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_mode
from nova.compute import vm_states
import nova.conf
from nova import context as nova_context
from nova import exception
from nova.i18n import _
@ -61,49 +61,8 @@ ironic = None
LOG = logging.getLogger(__name__)
opts = [
cfg.IntOpt('api_version',
default=1,
help='Version of Ironic API service endpoint.'),
cfg.StrOpt('api_endpoint',
help='URL for Ironic API endpoint.'),
cfg.StrOpt('admin_username',
help='Ironic keystone admin name'),
cfg.StrOpt('admin_password',
secret=True,
help='Ironic keystone admin password.'),
cfg.StrOpt('admin_auth_token',
secret=True,
deprecated_for_removal=True,
help='Ironic keystone auth token.'
'DEPRECATED: use admin_username, admin_password, and '
'admin_tenant_name instead'),
cfg.StrOpt('admin_url',
help='Keystone public API endpoint.'),
cfg.StrOpt('client_log_level',
deprecated_for_removal=True,
help='Log level override for ironicclient. Set this in '
'order to override the global "default_log_levels", '
'"verbose", and "debug" settings. '
'DEPRECATED: use standard logging configuration.'),
cfg.StrOpt('admin_tenant_name',
help='Ironic keystone tenant name.'),
cfg.IntOpt('api_max_retries',
default=60,
help=('How many retries when a request does conflict. '
'If <= 0, only try once, no retries.')),
cfg.IntOpt('api_retry_interval',
default=2,
help='How often to retry in seconds when a request '
'does conflict'),
]
ironic_group = cfg.OptGroup(name='ironic',
title='Ironic Options')
CONF = cfg.CONF
CONF.register_group(ironic_group)
CONF.register_opts(opts, ironic_group)
CONF = nova.conf.CONF
_POWER_STATE_MAP = {
ironic_states.POWER_ON: power_state.RUNNING,

View File

@ -12,6 +12,7 @@
import itertools
import nova.conf
import nova.virt.configdrive
import nova.virt.disk.api
import nova.virt.disk.mount.nbd
@ -25,7 +26,6 @@ import nova.virt.hyperv.vmops
import nova.virt.hyperv.volumeops
import nova.virt.imagecache
import nova.virt.images
import nova.virt.ironic.driver
import nova.virt.libvirt.driver
import nova.virt.libvirt.imagebackend
import nova.virt.libvirt.imagecache
@ -73,7 +73,7 @@ def list_opts():
nova.virt.hyperv.vmops.hyperv_opts,
nova.virt.hyperv.volumeops.hyper_volumeops_opts,
)),
('ironic', nova.virt.ironic.driver.opts),
nova.conf.ironic.list_opts(),
('libvirt',
itertools.chain(
nova.virt.libvirt.driver.libvirt_opts,