Centralize config options - [irmc]
Nova style refactor of config options in Ironic. Change-Id: Ia5d4e49c0a8d2de47d34ef9f0b4dfa740c500efa Partial-Bug: #1561100
This commit is contained in:
parent
700ad0567b
commit
038d600b8e
|
@ -25,6 +25,7 @@ from ironic.conf import iboot
|
||||||
from ironic.conf import ilo
|
from ironic.conf import ilo
|
||||||
from ironic.conf import inspector
|
from ironic.conf import inspector
|
||||||
from ironic.conf import ipmi
|
from ironic.conf import ipmi
|
||||||
|
from ironic.conf import irmc
|
||||||
|
|
||||||
CONF = cfg.CONF
|
CONF = cfg.CONF
|
||||||
|
|
||||||
|
@ -38,3 +39,4 @@ iboot.register_opts(CONF)
|
||||||
ilo.register_opts(CONF)
|
ilo.register_opts(CONF)
|
||||||
inspector.register_opts(CONF)
|
inspector.register_opts(CONF)
|
||||||
ipmi.register_opts(CONF)
|
ipmi.register_opts(CONF)
|
||||||
|
irmc.register_opts(CONF)
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
# Copyright 2016 Intel Corporation
|
||||||
|
# Copyright 2015 FUJITSU LIMITED
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
|
||||||
|
from ironic.common.i18n import _
|
||||||
|
|
||||||
|
opts = [
|
||||||
|
cfg.StrOpt('remote_image_share_root',
|
||||||
|
default='/remote_image_share_root',
|
||||||
|
help=_('Ironic conductor node\'s "NFS" or "CIFS" root path')),
|
||||||
|
cfg.StrOpt('remote_image_server',
|
||||||
|
help=_('IP of remote image server')),
|
||||||
|
cfg.StrOpt('remote_image_share_type',
|
||||||
|
default='CIFS',
|
||||||
|
choices=['CIFS', 'NFS'],
|
||||||
|
ignore_case=True,
|
||||||
|
help=_('Share type of virtual media')),
|
||||||
|
cfg.StrOpt('remote_image_share_name',
|
||||||
|
default='share',
|
||||||
|
help=_('share name of remote_image_server')),
|
||||||
|
cfg.StrOpt('remote_image_user_name',
|
||||||
|
help=_('User name of remote_image_server')),
|
||||||
|
cfg.StrOpt('remote_image_user_password', secret=True,
|
||||||
|
help=_('Password of remote_image_user_name')),
|
||||||
|
cfg.StrOpt('remote_image_user_domain',
|
||||||
|
default='',
|
||||||
|
help=_('Domain name of remote_image_user_name')),
|
||||||
|
cfg.PortOpt('port',
|
||||||
|
default=443,
|
||||||
|
choices=[443, 80],
|
||||||
|
help=_('Port to be used for iRMC operations')),
|
||||||
|
cfg.StrOpt('auth_method',
|
||||||
|
default='basic',
|
||||||
|
choices=['basic', 'digest'],
|
||||||
|
help=_('Authentication method to be used for iRMC '
|
||||||
|
'operations')),
|
||||||
|
cfg.IntOpt('client_timeout',
|
||||||
|
default=60,
|
||||||
|
help=_('Timeout (in seconds) for iRMC operations')),
|
||||||
|
cfg.StrOpt('sensor_method',
|
||||||
|
default='ipmitool',
|
||||||
|
choices=['ipmitool', 'scci'],
|
||||||
|
help=_('Sensor data retrieval method.')),
|
||||||
|
cfg.StrOpt('snmp_version',
|
||||||
|
default='v2c',
|
||||||
|
choices=['v1', 'v2c', 'v3'],
|
||||||
|
help=_('SNMP protocol version')),
|
||||||
|
cfg.PortOpt('snmp_port',
|
||||||
|
default=161,
|
||||||
|
help=_('SNMP port')),
|
||||||
|
cfg.StrOpt('snmp_community',
|
||||||
|
default='public',
|
||||||
|
help=_('SNMP community. Required for versions "v1" and "v2c"')),
|
||||||
|
cfg.StrOpt('snmp_security',
|
||||||
|
help=_('SNMP security name. Required for version "v3"')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def register_opts(conf):
|
||||||
|
conf.register_opts(opts, group='irmc')
|
|
@ -33,8 +33,6 @@ import ironic.drivers.modules.amt.common
|
||||||
import ironic.drivers.modules.amt.power
|
import ironic.drivers.modules.amt.power
|
||||||
import ironic.drivers.modules.deploy_utils
|
import ironic.drivers.modules.deploy_utils
|
||||||
import ironic.drivers.modules.image_cache
|
import ironic.drivers.modules.image_cache
|
||||||
import ironic.drivers.modules.irmc.boot
|
|
||||||
import ironic.drivers.modules.irmc.common
|
|
||||||
import ironic.drivers.modules.iscsi_deploy
|
import ironic.drivers.modules.iscsi_deploy
|
||||||
import ironic.drivers.modules.oneview.common
|
import ironic.drivers.modules.oneview.common
|
||||||
import ironic.drivers.modules.pxe
|
import ironic.drivers.modules.pxe
|
||||||
|
@ -81,9 +79,7 @@ _opts = [
|
||||||
('ilo', ironic.conf.ilo.opts),
|
('ilo', ironic.conf.ilo.opts),
|
||||||
('inspector', ironic.conf.inspector.opts),
|
('inspector', ironic.conf.inspector.opts),
|
||||||
('ipmi', ironic.conf.ipmi.opts),
|
('ipmi', ironic.conf.ipmi.opts),
|
||||||
('irmc', itertools.chain(
|
('irmc', ironic.conf.irmc.opts),
|
||||||
ironic.drivers.modules.irmc.boot.opts,
|
|
||||||
ironic.drivers.modules.irmc.common.opts)),
|
|
||||||
('iscsi', ironic.drivers.modules.iscsi_deploy.iscsi_opts),
|
('iscsi', ironic.drivers.modules.iscsi_deploy.iscsi_opts),
|
||||||
('keystone', ironic.common.keystone.keystone_opts),
|
('keystone', ironic.common.keystone.keystone_opts),
|
||||||
('neutron', ironic.common.neutron.neutron_opts),
|
('neutron', ironic.common.neutron.neutron_opts),
|
||||||
|
|
|
@ -21,7 +21,6 @@ import shutil
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
from ironic_lib import utils as ironic_utils
|
from ironic_lib import utils as ironic_utils
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
|
@ -34,6 +33,7 @@ from ironic.common.i18n import _LI
|
||||||
from ironic.common import images
|
from ironic.common import images
|
||||||
from ironic.common import states
|
from ironic.common import states
|
||||||
from ironic.conductor import utils as manager_utils
|
from ironic.conductor import utils as manager_utils
|
||||||
|
from ironic.conf import CONF
|
||||||
from ironic.drivers import base
|
from ironic.drivers import base
|
||||||
from ironic.drivers.modules import deploy_utils
|
from ironic.drivers.modules import deploy_utils
|
||||||
from ironic.drivers.modules.irmc import common as irmc_common
|
from ironic.drivers.modules.irmc import common as irmc_common
|
||||||
|
@ -41,39 +41,12 @@ from ironic.drivers.modules.irmc import common as irmc_common
|
||||||
|
|
||||||
scci = importutils.try_import('scciclient.irmc.scci')
|
scci = importutils.try_import('scciclient.irmc.scci')
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if CONF.debug:
|
if CONF.debug:
|
||||||
scci.DEBUG = True
|
scci.DEBUG = True
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
opts = [
|
|
||||||
cfg.StrOpt('remote_image_share_root',
|
|
||||||
default='/remote_image_share_root',
|
|
||||||
help=_('Ironic conductor node\'s "NFS" or "CIFS" root path')),
|
|
||||||
cfg.StrOpt('remote_image_server',
|
|
||||||
help=_('IP of remote image server')),
|
|
||||||
cfg.StrOpt('remote_image_share_type',
|
|
||||||
default='CIFS',
|
|
||||||
choices=['CIFS', 'NFS'],
|
|
||||||
ignore_case=True,
|
|
||||||
help=_('Share type of virtual media')),
|
|
||||||
cfg.StrOpt('remote_image_share_name',
|
|
||||||
default='share',
|
|
||||||
help=_('share name of remote_image_server')),
|
|
||||||
cfg.StrOpt('remote_image_user_name',
|
|
||||||
help=_('User name of remote_image_server')),
|
|
||||||
cfg.StrOpt('remote_image_user_password', secret=True,
|
|
||||||
help=_('Password of remote_image_user_name')),
|
|
||||||
cfg.StrOpt('remote_image_user_domain',
|
|
||||||
default='',
|
|
||||||
help=_('Domain name of remote_image_user_name')),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF.register_opts(opts, group='irmc')
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
REQUIRED_PROPERTIES = {
|
REQUIRED_PROPERTIES = {
|
||||||
|
|
|
@ -17,49 +17,14 @@ Common functionalities shared between different iRMC modules.
|
||||||
"""
|
"""
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from oslo_config import cfg
|
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
|
|
||||||
from ironic.common import exception
|
from ironic.common import exception
|
||||||
from ironic.common.i18n import _
|
from ironic.common.i18n import _
|
||||||
|
from ironic.conf import CONF
|
||||||
|
|
||||||
scci = importutils.try_import('scciclient.irmc.scci')
|
scci = importutils.try_import('scciclient.irmc.scci')
|
||||||
|
|
||||||
opts = [
|
|
||||||
cfg.PortOpt('port',
|
|
||||||
default=443,
|
|
||||||
choices=[443, 80],
|
|
||||||
help=_('Port to be used for iRMC operations')),
|
|
||||||
cfg.StrOpt('auth_method',
|
|
||||||
default='basic',
|
|
||||||
choices=['basic', 'digest'],
|
|
||||||
help=_('Authentication method to be used for iRMC '
|
|
||||||
'operations')),
|
|
||||||
cfg.IntOpt('client_timeout',
|
|
||||||
default=60,
|
|
||||||
help=_('Timeout (in seconds) for iRMC operations')),
|
|
||||||
cfg.StrOpt('sensor_method',
|
|
||||||
default='ipmitool',
|
|
||||||
choices=['ipmitool', 'scci'],
|
|
||||||
help=_('Sensor data retrieval method.')),
|
|
||||||
cfg.StrOpt('snmp_version',
|
|
||||||
default='v2c',
|
|
||||||
choices=['v1', 'v2c', 'v3'],
|
|
||||||
help=_('SNMP protocol version')),
|
|
||||||
cfg.PortOpt('snmp_port',
|
|
||||||
default=161,
|
|
||||||
help=_('SNMP port')),
|
|
||||||
cfg.StrOpt('snmp_community',
|
|
||||||
default='public',
|
|
||||||
help=_('SNMP community. Required for versions "v1" and "v2c"')),
|
|
||||||
cfg.StrOpt('snmp_security',
|
|
||||||
help=_('SNMP security name. Required for version "v3"')),
|
|
||||||
]
|
|
||||||
|
|
||||||
CONF = cfg.CONF
|
|
||||||
CONF.register_opts(opts, group='irmc')
|
|
||||||
|
|
||||||
|
|
||||||
REQUIRED_PROPERTIES = {
|
REQUIRED_PROPERTIES = {
|
||||||
'irmc_address': _("IP address or hostname of the iRMC. Required."),
|
'irmc_address': _("IP address or hostname of the iRMC. Required."),
|
||||||
'irmc_username': _("Username for the iRMC with administrator privileges. "
|
'irmc_username': _("Username for the iRMC with administrator privileges. "
|
||||||
|
|
Loading…
Reference in New Issue